RaidZeroLib
Coroutine robot framework for VEX V5
Loading...
Searching...
No Matches
Geometry

Points, poses, rotations, transforms and twists. More...

Classes

class  rz::Point
 Immutable 2D point / vector with unit-safe Cartesian coordinates. More...
class  rz::Pose
 Rigid-body pose in SE(2) with unit-safe position and rotation. More...
class  rz::Rotation
 Immutable planar rotation about the Z axis. More...
class  rz::Transform
 Rigid-body transform in SE(2): translation (meters) + rotation (radians). More...
class  rz::Twist
 Differential motion (twist) in SE(2) space. More...

Functions

Length rz::circumradius (const Point &A, const Point &B, const Point &C) noexcept
 Circumradius of the triangle defined by three points.
std::optional< double > rz::circleLineIntersection (const Point &start, const Point &end, const Point &center, Length radius) noexcept
 Intersection of a circle with a line segment.
Curvature rz::curvatureToPoint (const Pose &pose, const Point &point) noexcept
 Signed curvature needed to reach a point from a pose assuming an instantaneous circular arc.

Detailed Description

Points, poses, rotations, transforms and twists.

Function Documentation

◆ circleLineIntersection()

std::optional< double > rz::circleLineIntersection ( const Point & start,
const Point & end,
const Point & center,
Length radius )
noexcept

Intersection of a circle with a line segment.

Solves for t in [0, 1] where the parametric segment P(t) = start + t * (end - start) intersects the circle of center and radius.

If two intersections lie on the segment, the larger parameter (farther along the segment, denoted t2) is returned; otherwise the single valid root is returned. If no intersection lies on the segment, returns std::nullopt.

Parameters
startSegment start point.
endSegment end point.
centerCircle center.
radiusCircle radius (meters).
Returns
t in [0, 1] for the intersection point, or std::nullopt.

◆ circumradius()

Length rz::circumradius ( const Point & A,
const Point & B,
const Point & C )
noexcept

Circumradius of the triangle defined by three points.

Uses the formula R = abc/4A, where a = |BC|, b = |AC|, c = |AB|, and A is the triangle area (half the absolute wedge of two sides).

If the points are collinear (A = 0), returns 0 m.

Parameters
AVertex A.
BVertex B.
CVertex C.
Returns
Circumradius in meters.

◆ curvatureToPoint()

Curvature rz::curvatureToPoint ( const Pose & pose,
const Point & point )
noexcept

Signed curvature needed to reach a point from a pose assuming an instantaneous circular arc.

Computes curvature = +-2 * dPerp / chord^2, where dPerp is the perpendicular distance from the point to the pose’s heading line, and the sign is determined by which side of the heading the point lies on (left positive, right negative). If the point lies exactly on the heading line, returns 0.

Parameters
poseCurrent pose (defines line and heading).
pointTarget point.
Returns
Curvature in 1/meters.