Skip to main content

Module common

Module common 

Source
Expand description

Shared geometry helpers for the constructors in this crate, and Profile, the named curve chain extrude and revolve sweep. Topology construction itself goes straight through Part’s euler operators (mvfs, mve, mef, mer, replace_face, …) — see extrude.rs for a worked example of how they compose.

Structs§

Profile
A chain of profile curves, with a stable name for every curve and every joint between them — what extrude and revolve build the names of the faces, edges and vertices they sweep out of it from (see geop_core_part’s crate docs). For a sketch these are its element ids; for a shape built in code, positions in the chain (Profile::closed).

Functions§

arc2
A degree-2 rational Bezier curve in parameter space from p0 to p2 through the (weighted) control point mid, with middle weight w.
arc3
A degree-2 rational Bezier curve in 3-D from p0 to p2 through the (weighted) control point mid, with middle weight w. For an arc centered at c with w = sqrt2_over_2(), pass mid = p0 + p2 - c (i.e. c + (p0 - c) + (p2 - c), the sum of the two radius vectors relative to the arc’s actual center, offset back into absolute coordinates) to trace an exact 90-degree circular arc of radius |p0 - c| = |p2 - c|.
bilinear
A bilinear (degree 1x1) surface patch with corners P00, P01, P10, P11 (control points laid out [P00, P10, P11, P01], num_v = 2).
embed_curve
The planar 3-D curve origin + x e1 + y e2 for (x, y) along curve. An affine map of the control points, so it is exact for any NURBS.
embed_point
Homogeneous (w (origin + x e1 + y e2), w) for the homogeneous 2-D point cp = (w x, w y, w): linear in cp, so no division.
end_point
Last control point of curve, dehomogenized: its end.
line2
A degree-1 line segment in parameter space from p0 to p1, parametrized over [0, 1].
line3
A degree-1 line segment in 3-D from p0 to p1, parametrized over [0, 1].
polygon
The closed polygon through points (and back to the first), one line per side — the simplest profile loop for crate::extrude::extrude.
polyline
The open chain of lines through points — the simplest profile for crate::revolve::revolve_at_oriented.
pt2
Lift a 2-D point into homogeneous coordinates with weight 1.
pt3
Lift a 3-D point into homogeneous coordinates with weight 1.
sqrt2_over_2
sqrt(2) / 2, the rational weight that makes a 3-point quadratic Bezier trace an exact 90-degree circular arc.
start_point
First control point of curve, dehomogenized: its start, for the clamped knot vectors every profile curve has.