Module cavalier_contours::core::math
source · Expand description
Core/common math functions for working with angles, 2D space, intersections, etc.
Structs
Enums
Holds the result of finding the intersect between two circles.
Holds the result of finding the intersect between a line segment and a circle.
Holds the result of finding the intersect between two line segments.
Functions
Angle of the direction vector described by
p0
to p1
.Returns the arc sweep angle for the given
bulge
.Same as angle_is_between_eps using default epsilon.
Tests if
test_angle
is between a start_angle
and end_angle
.Same as angle_is_within_sweep_eps using default epsilon.
Tests if
test_angle
is within the sweep_angle
starting at start_angle
.Returns the bulge for the given arc
sweep_angle
.Finds the intersects between two circles defined by the radius and center.
Returns the smaller difference between two angles.
Returns the smaller difference between two angles and applies the sign given.
Distance squared between the points
p0
and p1
.Returns true if
point
is left of a direction vector.Same as is_left_or_coincident_eps using default epsilon.
Returns true if
point
is left of a direction vector with fuzzy inclusion.Same as is_left but uses <= operator rather than < for boundary inclusion.
Same as is_right_or_coincident_eps using default epsilon.
Returns true if
point
is right of a direction vector with fuzzy inclusion.Finds the intersects between a line segment and a circle.
Finds the intersects between two lines segments.
Returns the closest point on the line segment from
p0
to p1
to the point
given.Midpoint of a line segment defined by
p0
to p1
.Returns the (min, max) values from
v1
and v2
.Normalize radians to be between
0
and 2PI
, e.g. -PI/4
becomes 7PI/4
and 5PI
becomes
PI
.Returns the parametric value on the line segment going from
p0
to p1
at the point
given.Returns the point on the line segment going from
p0
to p1
at parametric value t
.Returns the point on the circle with
radius
, center
, and polar angle
in radians given.Test if a
point
is within a arc sweep angle region.Returns the solutions to the quadratic equation.