Skip to main content

Module projective

Module projective 

Source

Structs§

ProjectivePlane
The real projective plane RP^2, modeled as a square with antipodal boundary identification. Crossing any edge puts you on the opposite edge with both coordinates inverted (antipodal identification).

Functions§

cross_ratio
Compute the cross-ratio of four collinear points (a projective invariant). Given four points on a projective line, the cross-ratio is: (AC * BD) / (BC * AD) where AC = distance from A to C, etc. Points are given as 1D projective coordinates [value, 1] or [1, 0] for infinity.
cross_ratio_homogeneous
Cross-ratio of four points given as homogeneous 1D coordinates [x, w].
homogeneous_coords
Convert 2D Euclidean coordinates to homogeneous projective coordinates. (x, y) -> [x, y, 1]
line_intersection
Compute the intersection of two projective lines. In projective geometry, any two distinct lines always intersect (possibly at infinity). Returns the intersection as an affine point if w != 0, None if the lines are identical.
projective_line
Compute the projective line through two points (in homogeneous coordinates). The line is the cross product of the two points.
projective_wrap
Wrap a position in the projective plane’s fundamental domain. The square [0, size) x [0, size) with opposite edges identified with a flip.