Skip to main content

Module elementary

Module elementary 

Source
Expand description

Parameterization of the analytic primitives.

Evaluation, derivatives and parameter inversion for every shape in crate::conic and crate::quadric. Each shape’s parameterization is defined relative to its own Frame, which is what makes a parameter value mean the same place across a save, a reload and a transform.

§Conventions

  • Circle, ellipse: angle from the frame’s x axis towards y.
  • Hyperbola: (a cosh t, b sinh t), describing the +x branch.
  • Parabola: (t^2 / (4 f), t) with the apex at t = 0.
  • Plane: (u, v) are the coordinates along x and y.
  • Cylinder: (angle, height).
  • Cone: (angle, height), with the radius varying along the height.
  • Sphere: (longitude, latitude), latitude in [-pi/2, pi/2].
  • Torus: (angle about the axis, angle around the tube).

Every surface here follows the same (u, v) order, u going around and v going along. Getting that consistent matters: a caller that has to remember which surface reverses the convention will eventually forget.

Structs§

CurvePoint
A point on a curve with its first two derivatives.
SurfacePoint
A point on a surface with its first derivatives.

Functions§

circle_at
Evaluate a circle at angle.
circle_parameter
The angle of the point on a circle nearest p, in [0, 2*pi).
cone_at
Evaluate a cone at (angle, height).
cone_parameters
The (angle, height) of the point on a cone nearest p.
cylinder_at
Evaluate a cylinder at (angle, height).
cylinder_parameters
The (angle, height) of the point on a cylinder nearest p.
ellipse_at
Evaluate an ellipse at angle.
ellipse_parameter
The eccentric angle of the point on an ellipse in the direction of p.
hyperbola_at
Evaluate a hyperbola at t, on the +x branch.
hyperbola_parameter
The parameter of the point on a hyperbola in the direction of p.
line_at
Evaluate a line at t, measured in length along its direction.
line_parameter
The parameter of the projection of p onto a line.
parabola_at
Evaluate a parabola at t.
parabola_parameter
The parameter of the point on a parabola level with p.
plane_at
Evaluate a plane at (u, v), the coordinates along its x and y axes.
plane_parameters
The (u, v) of the projection of p onto a plane.
sphere_at
Evaluate a sphere at (longitude, latitude).
sphere_parameters
The (longitude, latitude) of the point on a sphere nearest p.
torus_at
Evaluate a torus at (around the axis, around the tube).
torus_parameters
The (u, v) of the point on a torus nearest p.
wrap_angle
Wrap angle into [0, 2*pi).
wrap_signed_angle
Wrap angle into (-pi, pi].