pub struct ManifoldImpl {
pub bbox: Box,
pub epsilon: f64,
pub tolerance: f64,
pub num_prop: usize,
pub status: Error,
pub vert_pos: Vec<Vec3>,
pub halfedge: Vec<Halfedge>,
pub properties: Vec<f64>,
pub vert_normal: Vec<Vec3>,
pub face_normal: Vec<Vec3>,
pub halfedge_tangent: Vec<Vec4>,
pub mesh_relation: MeshRelationD,
}Expand description
Internal halfedge mesh representation, mirroring Manifold::Impl in C++.
Fields§
§bbox: Box§epsilon: f64§tolerance: f64§num_prop: usize§status: Error§vert_pos: Vec<Vec3>§halfedge: Vec<Halfedge>§properties: Vec<f64>§vert_normal: Vec<Vec3>§face_normal: Vec<Vec3>§halfedge_tangent: Vec<Vec4>§mesh_relation: MeshRelationDImplementations§
Source§impl ManifoldImpl
impl ManifoldImpl
pub fn new() -> Self
pub fn num_vert(&self) -> usize
pub fn num_halfedge(&self) -> usize
pub fn num_edge(&self) -> usize
pub fn num_tri(&self) -> usize
pub fn num_prop_vert(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn make_empty(&mut self, status: Error)
Sourcepub fn for_vert<F: FnMut(usize)>(&self, halfedge_idx: usize, func: F)
pub fn for_vert<F: FnMut(usize)>(&self, halfedge_idx: usize, func: F)
Apply func to each halfedge index around the vertex starting from halfedge_idx.
pub fn calculate_bbox(&mut self)
pub fn set_epsilon(&mut self, min_epsilon: f64, use_single: bool)
pub fn is_finite(&self) -> bool
Sourcepub fn is_manifold(&self) -> bool
pub fn is_manifold(&self) -> bool
Check that the halfedge data structure is consistent (oriented even manifold).
Sourcepub fn is_2_manifold(&self) -> bool
pub fn is_2_manifold(&self) -> bool
Check that the mesh is a 2-manifold (no duplicate edges).
Sourcepub fn create_halfedges(&mut self, tri_prop: &[IVec3], tri_vert: &[IVec3])
pub fn create_halfedges(&mut self, tri_prop: &[IVec3], tri_vert: &[IVec3])
Build the halfedge data structure from triangle lists.
tri_prop: property vertex indices per triangle (also geometry iftri_vertis empty)tri_vert: geometry vertex indices per triangle (may be empty)
When tri_vert is empty, tri_prop is used for both geometry and properties.
When tri_vert is present, tri_prop[i][j] = propVert, tri_vert[i][j] = startVert.
Sourcepub fn initialize_original(&mut self)
pub fn initialize_original(&mut self)
Set up the mesh relation for a newly created original mesh.
Sourcepub fn all_have_normals(&self) -> bool
pub fn all_have_normals(&self) -> bool
True only when every meshID carries normals at slot 0..2 — the condition
under which get_mesh_gl(-1) can safely auto-substitute that slot. A
mixed Boolean output (some meshIDs with normals, some without) returns
false; the output MeshGL’s per-run bit 1 still marks the with-normals
runs individually. AND semantics across meshIDs. Per C++ #1718.
Sourcepub fn tri_has_normals(&self, tri: usize) -> bool
pub fn tri_has_normals(&self, tri: usize) -> bool
True iff the meshID owning tri has hasNormals set. False when the
meshID isn’t in mesh_id_transform (treat as no-normals). Per C++ #1718.
Sourcepub fn eager_transform_prop_normals(
halfedge: &[Halfedge],
mesh_relation: &MeshRelationD,
normal_transform: Mat3,
properties: &mut [f64],
num_prop_vert: usize,
stride: usize,
offset: usize,
)
pub fn eager_transform_prop_normals( halfedge: &[Halfedge], mesh_relation: &MeshRelationD, normal_transform: Mat3, properties: &mut [f64], num_prop_vert: usize, stride: usize, offset: usize, )
Eager-transform slot 0..2 of properties for propVerts whose meshID
carries hasNormals. Used by both transform and compose so world-frame
normals stay in sync with vert_pos / face_normal across any sequence of
transforms (including mixed-input Boolean/Compose outputs where some
meshIDs carry normals and others don’t). Per C++ #1718.
properties is laid out as properties[(offset + prop) * stride + i],
so callers can target an in-place properties_ vector (offset=0) or a
per-node slice of a combined array (offset=propVertIndices,
stride=numPropOut). Re-normalizes as it transforms so non-orthogonal
transforms (scale) and upstream barycentric interpolation don’t leave
non-unit values that compound downstream.
Sourcepub fn increment_mesh_ids(&mut self)
pub fn increment_mesh_ids(&mut self)
Allocates fresh unique mesh IDs and remaps all triRef.meshID values. This ensures boolean results don’t collide with source mesh IDs.
Sourcepub fn dedupe_prop_verts(&mut self)
pub fn dedupe_prop_verts(&mut self)
Deduplicates property vertices that share identical property values across paired halfedges within the same mesh.
Sourcepub fn remove_unreferenced_verts(&mut self)
pub fn remove_unreferenced_verts(&mut self)
Mark unreferenced vertices as NaN (to be cleaned up by later passes).
Sourcepub fn set_normals_and_coplanar(&mut self)
pub fn set_normals_and_coplanar(&mut self)
Compute face normals, assign coplanar IDs, and calculate vertex normals.
Sourcepub fn sort_geometry(&mut self)
pub fn sort_geometry(&mut self)
Reorder mesh geometry for cache efficiency using Morton codes.
pub fn tetrahedron(transform: &Mat3x4) -> Self
pub fn cube(transform: &Mat3x4) -> Self
pub fn octahedron(transform: &Mat3x4) -> Self
Source§impl ManifoldImpl
impl ManifoldImpl
Source§impl ManifoldImpl
impl ManifoldImpl
Sourcepub fn get_property(&self, prop: Property) -> f64
pub fn get_property(&self, prop: Property) -> f64
Compute a global scalar property (volume or surface area) using Kahan summation for numerical stability.
Sourcepub fn matches_tri_normals(&self) -> bool
pub fn matches_tri_normals(&self) -> bool
Returns true if all triangles are CCW relative to their face normals.
Sourcepub fn num_degenerate_tris(&self) -> i32
pub fn num_degenerate_tris(&self) -> i32
Returns the number of triangles that are colinear within epsilon.
Sourcepub fn is_convex(&self) -> bool
pub fn is_convex(&self) -> bool
Returns true if the manifold is genus 0 and contains no concave edges.
Sourcepub fn calculate_curvature(&mut self, gaussian_idx: i32, mean_idx: i32)
pub fn calculate_curvature(&mut self, gaussian_idx: i32, mean_idx: i32)
Compute Gaussian and/or mean curvature per vertex, storing results into the property channels at the given indices. Pass -1 to skip.
Sourcepub fn is_index_in_bounds(&self, tri_verts: &[IVec3]) -> bool
pub fn is_index_in_bounds(&self, tri_verts: &[IVec3]) -> bool
Checks that all indices in the given triVerts array are within the bounds of vert_pos.
Source§impl ManifoldImpl
impl ManifoldImpl
pub fn vert_halfedge(&self) -> Vec<i32>
pub fn sharpen_edges( &self, min_sharp_angle: f64, min_smoothness: f64, ) -> Vec<Smoothness>
pub fn sharpen_tangent(&mut self, halfedge: usize, smoothness: f64)
pub fn linearize_flat_tangents(&mut self)
pub fn distribute_tangents(&mut self, fixed_halfedges: &[bool])
pub fn create_tangents_from_normals(&mut self, normal_idx: usize)
Sourcepub fn valid_tangents(&self) -> bool
pub fn valid_tangents(&self) -> bool
Returns true if halfedge tangents form a valid quad/triangle arrangement. Checks that kInsideQuad (-1.0) markers are consistent: paired halfedges must agree, and marked halfedges cannot be adjacent within a triangle.
pub fn create_tangents(&mut self, sharpened_edges: Vec<Smoothness>)
Source§impl ManifoldImpl
impl ManifoldImpl
pub fn get_normal(&self, halfedge: usize, normal_idx: usize) -> Vec3
pub fn tangent_from_normal(&self, normal: Vec3, halfedge: usize) -> Vec4
pub fn is_inside_quad(&self, halfedge: usize) -> bool
pub fn is_marked_inside_quad(&self, halfedge: usize) -> bool
pub fn update_sharpened_edges( &self, sharpened_edges: &[Smoothness], ) -> Vec<Smoothness>
pub fn flat_faces(&self) -> Vec<bool>
pub fn vert_flat_face(&self, flat_faces: &[bool]) -> Vec<i32>
Sourcepub fn set_normals(&mut self, normal_idx: i32, min_sharp_angle: f64)
pub fn set_normals(&mut self, normal_idx: i32, min_sharp_angle: f64)
Port of C++ Manifold::Impl::SetNormals() Fills in vertex properties with unshared normals across edges bent more than minSharpAngle (in degrees).
Source§impl ManifoldImpl
impl ManifoldImpl
pub fn is_self_intersecting(&self) -> bool
pub fn min_gap(&self, other: &ManifoldImpl, search_length: f64) -> f64
Source§impl ManifoldImpl
impl ManifoldImpl
Sourcepub fn get_neighbor(&self, tri: i32) -> i32
pub fn get_neighbor(&self, tri: i32) -> i32
Port of C++ Manifold::Impl::GetNeighbor(int tri)
Sourcepub fn get_halfedges_quad(&self, tri: i32) -> IVec4
pub fn get_halfedges_quad(&self, tri: i32) -> IVec4
Port of C++ Manifold::Impl::GetHalfedges(int tri)
Trait Implementations§
Source§impl Clone for ManifoldImpl
impl Clone for ManifoldImpl
Source§fn clone(&self) -> ManifoldImpl
fn clone(&self) -> ManifoldImpl
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more