pub struct Face { /* private fields */ }Expand description
Quadrilateral face definition that mimics the Python implementation.
Implementations§
Source§impl Face
impl Face
Sourcepub fn add_vertex(
&mut self,
x: f64,
y: f64,
z: f64,
i: usize,
j: usize,
k: usize,
)
pub fn add_vertex( &mut self, x: f64, y: f64, z: f64, i: usize, j: usize, k: usize, )
Add a vertex and update the centroid.
x,y,z- Cartesian coordinates.i,j,k- Structured-grid indices.
Sourcepub fn set_block_index(&mut self, idx: usize)
pub fn set_block_index(&mut self, idx: usize)
Set the owning block index.
Sourcepub fn block_index(&self) -> Option<usize>
pub fn block_index(&self) -> Option<usize>
Owning block index, if present.
Sourcepub fn const_axis(&self) -> Option<FaceAxis>
pub fn const_axis(&self) -> Option<FaceAxis>
Determine which index is constant, if the face is structured.
Sourcepub fn index_equals(&self, other: &Face) -> bool
pub fn index_equals(&self, other: &Face) -> bool
Compare index ranges with another face.
Sourcepub fn diagonal_length(&self) -> f64
pub fn diagonal_length(&self) -> f64
Length of the face diagonal between the extreme corner nodes.
Sourcepub fn vertices_equals(&self, other: &Face, tol: f64) -> bool
pub fn vertices_equals(&self, other: &Face, tol: f64) -> bool
Compare vertex positions with a tolerance.
Sourcepub fn grid_points(
&self,
block: &Block,
stride_u: usize,
stride_v: usize,
) -> Vec<[f64; 3]>
pub fn grid_points( &self, block: &Block, stride_u: usize, stride_v: usize, ) -> Vec<[f64; 3]>
Structured face points (dense sampling) for node matching.
block- Parent block.stride_u,stride_v- Sampling strides in parametric space.
Sourcepub fn touches_by_nodes(
&self,
other: &Face,
block_self: &Block,
block_other: &Block,
tol_xyz: f64,
min_shared_frac: f64,
min_shared_abs: usize,
stride_u: usize,
stride_v: usize,
) -> bool
pub fn touches_by_nodes( &self, other: &Face, block_self: &Block, block_other: &Block, tol_xyz: f64, min_shared_frac: f64, min_shared_abs: usize, stride_u: usize, stride_v: usize, ) -> bool
Decide if another face shares enough nodes to be considered touching.
other- Candidate face.block_self,block_other- Parent blocks.tol_xyz- Distance tolerance for node equivalence.min_shared_frac- Minimum fraction of shared nodes.min_shared_abs- Minimum absolute number of shared nodes.stride_u,stride_v- Sampling stride along the face grid.
Sourcepub fn to_record(&self) -> FaceRecord
pub fn to_record(&self) -> FaceRecord
Export a FaceRecord representation mirroring the Python dictionary API.
pub fn index_key(&self) -> (usize, usize, usize, usize, usize, usize, usize)
Sourcepub fn scale_indices(&mut self, factor: usize)
pub fn scale_indices(&mut self, factor: usize)
Scale all stored index values by factor.
Sourcepub fn is_point(&self) -> bool
pub fn is_point(&self) -> bool
True when the face collapses to a single point (all three indices constant).
Sourcepub fn face_size(&self) -> usize
pub fn face_size(&self) -> usize
Return parametric face size in index-space cells.
For a face with one constant axis this returns the product of the two varying dimension ranges. For a degenerate or 3D region, returns the product of all three ranges.
Sourcepub fn normal(&self, block: &Block) -> [f64; 3]
pub fn normal(&self, block: &Block) -> [f64; 3]
Compute the (unnormalized) geometric normal using three corner points from the parent block, based on which axis is constant.
Sourcepub fn shift(&mut self, dx: f64, dy: f64, dz: f64)
pub fn shift(&mut self, dx: f64, dy: f64, dz: f64)
Shift all stored vertices by (dx, dy, dz) in place.
Sourcepub fn match_indices(&self, other: &Face) -> Vec<[usize; 2]>
pub fn match_indices(&self, other: &Face) -> Vec<[usize; 2]>
Find vertex-index correspondences between self and other.
Returns pairs [i_self, j_other] where vertex i_self of this face
matches vertex j_other of other within tolerance 1e-6.
Sourcepub fn overlap_fraction(
&self,
other: &Face,
tol_angle_deg: f64,
tol_plane_dist: f64,
) -> f64
pub fn overlap_fraction( &self, other: &Face, tol_angle_deg: f64, tol_plane_dist: f64, ) -> f64
Compute the overlap area fraction between this face and other using
Sutherland-Hodgman polygon clipping.
Returns intersection_area / min(area_self, area_other).
Returns 0.0 if normals are not (anti-)parallel within tol_angle_deg
or if the faces are not coplanar within tol_plane_dist.
Sourcepub fn touches(
&self,
other: &Face,
tol_angle_deg: f64,
tol_plane_dist: f64,
min_overlap_frac: f64,
) -> bool
pub fn touches( &self, other: &Face, tol_angle_deg: f64, tol_plane_dist: f64, min_overlap_frac: f64, ) -> bool
Returns true if overlap_fraction >= min_overlap_frac.
Fraction of shared grid nodes between this face and other.
Uses quantized point comparison for robustness.