Skip to main content

Crate geomcore

Crate geomcore 

Source
Expand description

A pure, standalone geometric kernel for CAD-grade curves and surfaces.

geomcore provides parametric evaluation of elementary curves and surfaces (lines, circles, ellipses, parabolas, hyperbolas, B-splines; planes, cylinders, cones, spheres, tori, B-spline surfaces), rigid transformations, and analytic curve-on-surface parametrization: computing the exact 2D representation of a 3D curve in a surface’s parameter space wherever a closed form exists.

§Namespace layout

§Quick start

use geomcore::{Cylinder, Point3D, Vector3D};
use geomcore::curves::Circle3D;

// Evaluate a circle at a single parameter, and over a batch of parameters.
let circle = Circle3D::new(Point3D::ORIGIN, Vector3D::Z, 2.0).unwrap();
let point = circle.eval_point(std::f64::consts::PI / 4.0);
let points = circle.eval_points(&[0.0, 1.0, 2.0]);
assert_eq!(points[0], circle.eval_point(0.0));

// Curve-on-surface parametrization: this circle is coaxial with the
// cylinder, so it has an exact 2D image, a horizontal line in (u, v).
let cylinder = Cylinder::new(Point3D::ORIGIN, Vector3D::Z, 2.0).unwrap();
let pcurve = circle.parametrize_on(&cylinder).unwrap();

§Extending the kernel

New curve or surface types are added by implementing curves::ParametricCurve3D (or curves::ParametricCurve2D) and surfaces::ParametricSurface respectively, without touching the existing dispatch code in curves::Curve3D/surfaces::Surface.

Re-exports§

pub use curves::BSplineConstructionError;
pub use curves::BSplineCurve3D;
pub use curves::Circle2D;
pub use curves::Circle3D;
pub use curves::CircleConstructionError;
pub use curves::Curve2D;
pub use curves::Curve3D;
pub use curves::Ellipse3D;
pub use curves::EllipseConstructionError;
pub use curves::Hyperbola3D;
pub use curves::HyperbolaConstructionError;
pub use curves::InterpParametrization;
pub use curves::Line2D;
pub use curves::Line3D;
pub use curves::LineConstructionError;
pub use curves::Parabola3D;
pub use curves::ParabolaConstructionError;
pub use curves::ParametricCurve2D;
pub use curves::ParametricCurve3D;
pub use curves::ParametrizeError;
pub use curves::parametrize_numeric;
pub use frame::Axis2D;
pub use frame::Axis3D;
pub use frame::Frame2D;
pub use frame::Frame3D;
pub use frame::FrameConstructionError;
pub use intersect::intersect_curve_surface;
pub use intersect::marching_intersection;
pub use intersect::CircleCircle2DIntersection;
pub use intersect::CircleCircle3DIntersection;
pub use intersect::CircleSurfaceIntersection;
pub use intersect::ConeConeIntersection;
pub use intersect::ConeCylinderIntersection;
pub use intersect::ConicSurfaceHit;
pub use intersect::ConicSurfaceIntersection;
pub use intersect::CurveCurveExtremum;
pub use intersect::CurveCurveHit;
pub use intersect::CurveSurfaceHit;
pub use intersect::CylinderCylinderIntersection;
pub use intersect::LineCircle2DIntersection;
pub use intersect::LineCircle3DIntersection;
pub use intersect::LineLine2DIntersection;
pub use intersect::LineLine3DIntersection;
pub use intersect::LinePlaneIntersection;
pub use intersect::LineQuadricIntersection;
pub use intersect::PlaneConeIntersection;
pub use intersect::PlaneCylinderIntersection;
pub use intersect::PlanePlaneIntersection;
pub use intersect::PlaneSphereIntersection;
pub use intersect::SphereConeIntersection;
pub use intersect::SphereCylinderIntersection;
pub use intersect::SphereSphereIntersection;
pub use intersect::TorusConeIntersection;
pub use intersect::TorusCylinderIntersection;
pub use intersect::TorusPlaneIntersection;
pub use intersect::TorusSphereIntersection;
pub use intersect::TorusTorusIntersection;
pub use intersect::curve_curve_extrema;
pub use intersect::intersect_curve_curve;
pub use point::Point2D;
pub use point::Point3D;
pub use projection::CurveProjection;
pub use projection::SurfaceProjection;
pub use surfaces::BSplineSurface;
pub use surfaces::Cone;
pub use surfaces::ConeConstructionError;
pub use surfaces::Cylinder;
pub use surfaces::CylinderConstructionError;
pub use surfaces::ParametricSurface;
pub use surfaces::Plane;
pub use surfaces::PlaneConstructionError;
pub use surfaces::Sphere;
pub use surfaces::SphereConstructionError;
pub use surfaces::Surface;
pub use surfaces::Torus;
pub use surfaces::TorusConstructionError;
pub use tolerance::Tolerance;
pub use transform::Transform;
pub use vector::Vector2D;
pub use vector::Vector3D;

Modules§

curves
Public curve types: lines, conics, and B-spline curves. Public curve types: parametric curves in 2D and 3D built on top of the crate’s placement types (crate::Axis3D/crate::Axis2D, crate::Frame3D/crate::Frame2D).
frame
Axis and frame placement types. Axis and frame placement types: the coordinate systems that curves and surfaces are positioned in.
intersect
Analytic intersection result types. Analytic intersection result types.
point
Points in 2D and 3D space.
projection
Point-projection result types. Point-projection result types.
surfaces
Public surface types: planes, cylinders, cones, spheres, tori, and B-spline surfaces. Public surface types: the five elementary analytic surfaces (plane, cylinder, cone, sphere, torus) plus B-spline surfaces, built on top of the crate’s placement type (crate::Frame3D).
tolerance
Distance and angle tolerances shared by all geometric queries.
transform
Rigid and affine transformations. Rigid and affine transformations of points and vectors.
vector
Vectors in 2D and 3D space.