Skip to main content

Module concrete

Module concrete 

Source
Expand description

Compatibility re-exports for the concrete geometry implementation surface. Public entry point for the concrete geometry implementation layer.

This module re-exports the most commonly used concrete types so downstream code can start with a compact import surface while still benefiting from the more focused on-disk organization.

The underlying implementations live in dimension-specific modules such as crate::two_d::coordinate_vector2d, crate::three_d::coordinate_vector3d, crate::two_d::triangle2d, and crate::three_d::surface_mesh3d.

Typical usage starts with a GeometryTableRegistry, which provides the shared keyed tables used by the graph of concrete primitives.

use lib_jsl_geometry::common::{IsGeometryTable, IsGeometryTableBase, PointId};
use lib_jsl_geometry::concrete::{GeometryTableRegistry, FreeVector3D, Line3D, CoordinateVector3D};
use lib_jsl_geometry::one_d::IsLine;

let mut registry = GeometryTableRegistry::new();
registry
    .point_table_mut()
    .insert(PointId(1), CoordinateVector3D::new(0.0, 0.0, 0.0))
    .unwrap();
registry
    .point_table_mut()
    .insert(PointId(2), CoordinateVector3D::new(1.0, 0.0, 0.0))
    .unwrap();

let line = Line3D::new(PointId(1), PointId(2), registry.point_table().clone());
assert!((line.length() - 1.0).abs() < 1e-5);
let shifted = CoordinateVector3D::new(0.0, 0.0, 0.0) + FreeVector3D::new(1.0, 2.0, 3.0);
assert_eq!(shifted, CoordinateVector3D::new(1.0, 2.0, 3.0));

See the book entry Geometric types.

Re-exportsยง

pub use crate::one_d::Line1D;
pub use crate::one_d::Plane1D;
pub use crate::one_d::CoordinateVector1D;
pub use crate::one_d::UnitVector1D;
pub use crate::two_d::FreeVector2D;
pub use crate::two_d::Line2D;
pub use crate::two_d::Mesh2D;
pub use crate::two_d::Plane2D;
pub use crate::two_d::CoordinateVector2D;
pub use crate::two_d::PolygonFace2D;
pub use crate::two_d::Triangle2D;
pub use crate::two_d::UnitVector2D;
pub use crate::registry::GeometryTableRegistry;
pub use crate::tables::HashGeometryTable;
pub use crate::tables::SharedGeometryTable;
pub use crate::three_d::FreeVector3D;
pub use crate::three_d::Line3D;
pub use crate::three_d::Plane3D;
pub use crate::three_d::CoordinateVector3D;
pub use crate::three_d::PolygonFace3D;
pub use crate::three_d::SurfaceMesh3D;
pub use crate::three_d::Tetrahedron3D;
pub use crate::three_d::Triangle3D;
pub use crate::three_d::UnitVector3D;
pub use crate::three_d::VolumeMesh3D;