diff --git a/collects/images/scribblings/flomap.scrbl b/collects/images/scribblings/flomap.scrbl index e5fe2ed37b..2d5c210894 100644 --- a/collects/images/scribblings/flomap.scrbl +++ b/collects/images/scribblings/flomap.scrbl @@ -1176,18 +1176,19 @@ In the following example, a photo of the State of the Union address was taken us @interaction[#:eval flomap-eval (flomap->bitmap state-of-the-union-fm)] We would like it to have been taken with a perfect ``rectilinear'' (or ``perspective projection'') lens with a 120-degree diagonal angle of view. -Following the steps above, we apply a projection transform using @racket[(equal-area-projection pi)] for @racket[from-proj] and @racket[(perspective-projection (* 2/3 pi))] for @racket[to-proj]: +Following the steps above, we apply a projection transform using @racket[(equal-area-projection (degrees->radians 180))] for @racket[from-proj] and @racket[(perspective-projection (degrees->radians 120))] for @racket[to-proj]: @interaction[#:eval flomap-eval (flomap->bitmap (flomap-transform state-of-the-union-fm - (flomap-projection-transform (perspective-projection (* 2/3 pi)) - (equal-area-projection pi))))] + (flomap-projection-transform + (perspective-projection (degrees->radians 120)) + (equal-area-projection (degrees->radians 180)))))] Notice that the straight geometry in the House chamber (especially the trim around the ceiling) is represented by straight edges in the corrected photo. When @racket[crop?] is @racket[#t], the output flomap is no larger than the input flomap. When @racket[crop?] is @racket[#f], the output flomap is large enough to contain the entire transformed flomap. -An uncropped result can be quite large, especially with angles of view at or near @racket[180] degrees (@racket[pi] radians). +An uncropped result can be quite large, especially with angles of view at or near @racket[180] degrees. @interaction[#:eval flomap-eval (define rectangle-fm (draw-flomap (λ (fm-dc) @@ -1198,24 +1199,27 @@ An uncropped result can be quite large, especially with angles of view at or nea 32 32)) (flomap->bitmap rectangle-fm) (flomap-transform-bounds - (flomap-projection-transform (perspective-projection (* 1/2 pi)) - (equal-area-projection pi) - #f) + (flomap-projection-transform + (perspective-projection (degrees->radians 90)) + (equal-area-projection (degrees->radians 180)) + #f) 32 32) (flomap->bitmap (flomap-transform rectangle-fm - (flomap-projection-transform (perspective-projection (* 1/2 pi)) - (orthographic-projection (* 7/8 pi)) - #f)))] + (flomap-projection-transform + (perspective-projection (degrees->radians 90)) + (orthographic-projection (degrees->radians 160)) + #f)))] To crop manually, apply @racket[flomap-transform] to explicit rectangle arguments: @interaction[#:eval flomap-eval (flomap->bitmap (flomap-transform rectangle-fm - (flomap-projection-transform (perspective-projection (* 1/2 pi)) - (orthographic-projection (* 7/8 pi)) - #f) + (flomap-projection-transform + (perspective-projection (degrees->radians 90)) + (orthographic-projection (degrees->radians 160)) + #f) -10 -10 42 42))] } diff --git a/collects/scribblings/reference/numbers.scrbl b/collects/scribblings/reference/numbers.scrbl index 976b4ff432..194b29bf28 100644 --- a/collects/scribblings/reference/numbers.scrbl +++ b/collects/scribblings/reference/numbers.scrbl @@ -1016,6 +1016,24 @@ is little-endian.} An approximation to the ratio of a circle's circumference to its diameter: @number->string[pi].} +@defproc[(degrees->radians [x real?]) real?]{ + +Converts an @racket[x]-degree angle to radians. +@mz-examples[ +#:eval math-eval +(degrees->radians 180) +(sin (degrees->radians 45)) +]} + +@defproc[(radians->degrees [x real?]) real?]{ + +Converts @racket[x] radians to degrees. +@mz-examples[ +#:eval math-eval +(radians->degrees pi) +(radians->degrees (* 1/4 pi)) +]} + @defproc[(sqr [z number?]) number?]{ Returns @racket[(* z z)].} @@ -1054,6 +1072,26 @@ Returns the hyperbolic cosine of @racket[z].} Returns the hyperbolic tangent of @racket[z].} +@defproc[(exact-round [x real?]) real?]{ + +Equivalent to @racket[(inexact->exact (round x))]. +} + +@defproc[(exact-floor [x real?]) real?]{ + +Equivalent to @racket[(inexact->exact (floor x))]. +} + +@defproc[(exact-ceiling [x real?]) real?]{ + +Equivalent to @racket[(inexact->exact (ceiling x))]. +} + +@defproc[(exact-truncate [x real?]) real?]{ + +Equivalent to @racket[(inexact->exact (truncate x))]. +} + @defproc[(order-of-magnitude [r (and/c real? positive?)]) (and/c exact? integer?)]{ Computes the greatest exact integer @racket[m] such that: @racketblock[(<= (expt 10 m) @@ -1069,6 +1107,14 @@ Hence also: (order-of-magnitude 1/101)] } +@defproc[(nan? [x real?]) boolean?]{ + +Returns @racket[#t] if @racket[x] is @racket[eqv?] to @racket[+nan.0] or @racket[+nan.f], @racket[#f] otherwise.} + +@defproc[(infinite? [x real?]) boolean?]{ + +Returns @racket[#t] if @racket[z] is @racket[+inf.0], @racket[-inf.0], @racket[+inf.f], @racket[-inf.f]; @racket[#f] otherwise.} + @; ---------------------------------------------------------------------- @close-eval[math-eval] @; ----------------------------------------------------------------------