8.16.0.1
WY Posn Util
(require wy-posn-util) | package: wy-posn-util |
This package implements a stack of functions for working with "posn"s.
True when two posns have the same coordinates.
Sum each coordinate separately.
procedure
(posn-subtract p q) → posn?
p : posn? q : posn?
Coordinates of p minus the coordinates of q.
procedure
(posn-scale k p) → posn?
k : number? p : posn?
Multiply each coordinate of p by the same number k.
procedure
(posn-distance p q) → nonnegative-real?
p : posn? q : posn?
The Euclidean distance between the points specified by p and q.
procedure
(place-image/posn img pt bg) → image?
img : image? pt : posn? bg : image?
Place img at the coordinates specified by pt on the bg image.
procedure
(posn-length p) → nonnegative-real?
p : posn?
The length of the vector p.
procedure
(posn-length-squared p) → nonnegative-real?
p : posn?
The square of the length of the vector p. This will be an integer if the coordinates of p are integers.
procedure
(posn-within? p q eps) → boolean?
p : posn? q : posn? eps : real?
True if each of the corresponding components of p and q are within eps of each other.
The posn p rescaled so it is of unit length.
The dot product.
procedure
(posn-projection p q) → real?
p : posn? q : posn?
The projection of p on q. This is the length of the shadow of p on q when the sun shines perpendicular to q.
procedure
(posn-angle-between-rad p q) → real?
p : posn? q : posn?
The angle between the vectors, in radians. Uses acos.
procedure
(posn-angle-between-deg p q) → real?
p : posn? q : posn?
The angle between the vectors, in degrees. Uses acos.
Convert from rectangular to polar representation (radius, angle).
Convert from polar representation (radius, angle) to rectangular (x,y).