9.0
top
← prev up next →

WY Posn UtilπŸ”— i

Andrew Mauer-Oats

This package implements a stack of functions for working with "posn"s.

procedure

( posn=? pq)boolean?

p:posn?
q:posn?
True when two posns have the same coordinates.

procedure

( posn-add pq)posn?

p:posn?
q:posn?
Sum each coordinate separately.

procedure

( posn-subtract pq)posn?

p:posn?
q:posn?
Coordinates of p minus the coordinates of q.

procedure

( posn-scale kp)posn?

p:posn?
Multiply each coordinate of p by the same number k.

procedure

( posn-distance pq)nonnegative-real?

p:posn?
q:posn?
The Euclidean distance between the points specified by p and q.

procedure

( place-image/posn imgptbg)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? pqeps)boolean?

p:posn?
q:posn?
eps:real?
True if each of the corresponding components of p and q are within eps of each other.

procedure

( posn-unit p)posn?

p:posn?
The posn p rescaled so it is of unit length.

procedure

( posn-dotpq)real?

p:posn?
q:posn?
The dot product.

procedure

( posn-projection pq)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 pq)real?

p:posn?
q:posn?
The angle between the vectors, in radians. Uses acos .

procedure

( posn-angle-between-deg pq)real?

p:posn?
q:posn?
The angle between the vectors, in degrees. Uses acos .

procedure

( xy->polar p)posn?

p:posn?
Convert from rectangular to polar representation (radius, angle).

procedure

( polar->xy q)posn?

q:posn?
Convert from polar representation (radius, angle) to rectangular (x,y).

top
← prev up next →

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /