Rational Points #
This file defines rational points in the plane and basic geometric operations on them.
@[reducible, inline]
A point in the plane with rational coordinates
Equations
- RationalPoint = (Fin 2 → ℚ)
Instances For
Cross product of two 2D vectors (returns scalar)
Equations
- u.crossProduct v = u 0 * v 1 - u 1 * v 0
Instances For
Euclidean length squared of a vector
Instances For
Check if a point is strictly to the left of the directed line from p1 to p2. Uses the cross product: positive means left, negative means right, zero means collinear.
Equations
- p.isStrictlyLeftOf p1 p2 = decide ((p2 - p1).crossProduct (p - p1) > 0)
Instances For
Check if three points are in counterclockwise order
Equations
- p1.ccw p2 p3 = p3.isStrictlyLeftOf p1 p2
Instances For
Rotate a rational point by 90° counterclockwise about the origin.