Half Spaces and Lines #
This file defines closed and open half-spaces and lines over rational points.
A closed half-space in ℚ², given by a basepoint and an inward-pointing normal.
- basepoint : RationalPoint
A point on the boundary line of the half-space.
- normal : RationalPoint
The normal, where if the dot product of this with (p - basepoint) is nonnegative, then p is in the half-space.
The normal must be nonzero (positive squared length).
Instances For
An open half-space in ℚ², given by a basepoint and an inward-pointing normal.
- basepoint : RationalPoint
A point on the boundary line of the half-space.
- normal : RationalPoint
The normal, where if the dot product of this with (p - basepoint) is positive, then p is in the half-space.
The normal must be nonzero (positive squared length).
Instances For
Decide whether the point p lies in the open half-space h.
Instances For
The open half-space strictly to the left of the directed segment from p1 to p2.
Equations
- p1.toStrictlyLeft p2 hne = { basepoint := p1, normal := (p2 - p1).rotate90Counterclockwise, normal_pos := ⋯ }
Instances For
A line in ℚ², given by a point on the line and a nonzero direction vector.
- point : RationalPoint
A point lying on the line.
- direction : RationalPoint
A nonzero direction vector for the line.
direction must be nonzero
Instances For
Note AI generated
Equations
- One or more equations did not get rendered due to their size.
Instances For
The boundary line of a closed half-space (perpendicular to its normal).
Equations
- h.boundaryLine = { point := h.basepoint, direction := h.normal.rotate90Counterclockwise, direction_pos := ⋯ }
Instances For
Given two closed half-spaces, compute the intersection point of their boundary lines if it exists. Returns none if the lines are parallel (no intersection or infinite intersection).
Equations
- h1.lineIntersection h2 = h1.boundaryLine.intersection h2.boundaryLine
Instances For
Decide whether the point p lies in the closed half-space h.
Instances For
The closed half-space weakly to the left of the directed segment from p1 to p2.
Equations
- p1.toWeaklyLeft p2 hne = { basepoint := p1, normal := (p2 - p1).rotate90Counterclockwise, normal_pos := ⋯ }
Instances For
The closed half-space weakly to the right of the directed segment from p1 to p2.
Equations
- p1.toWeaklyRight p2 hne = { basepoint := p1, normal := (p1 - p2).rotate90Counterclockwise, normal_pos := ⋯ }
Instances For
Change the half-space by moving the basepoint inward by at least dist in the normal direction,
and at most dist + tolerance to account for numerical issues.
Equations
- One or more equations did not get rendered due to their size.