Expand description
Vectors in plain numbers, [f64; N]: for what is only ever a free
choice or a picture — a section placed along a spline, a sample to draw,
a point to suggest — never for a result the kernel reasons about, which
is a crate::vector::Vector of scalars.
Where a direction has no length, normalize gives none; what to do
then is the caller’s choice, made where it is called.
Functions§
- add
- bounds
- The box around
points: its lowest corner and its highest, orNoneif there are no points. - centroid
- The mean of
points, summed in their order and then divided by their count, orNoneif there are no points. - cross
- The cross product
a x b. - cross2
- The 2-D cross product
a.x b.y - a.y b.x: positive whereblies counter-clockwise ofa. - diagonal
- The length of the diagonal of the box from
lotohi: how far apart any two points in it can be. - distance
- How far
ais fromb. - dot
- inverse2
- The inverse of the 2x2 matrix
m: not finite where it is singular. - norm
- The length of
a,sqrt(a . a). - normalize
ascaled to unit length, orNoneif it has no finite, non-zero one.- scale
- signed_
area2 - Twice the signed area of the closed polygon
poly(shoelace formula): positive where it runs counter-clockwise. - solve2
- The solution
xofm x = rfor the 2x2 matrixm, by Cramer’s rule: not finite wheremis singular. - sub
- unwrap_
angle - The angle
a, turned by whole turns to within half a turn ofreference: in[reference - π, reference + π), how an angle measured in(-π, π]is followed on from the one before.