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: Float,
y: Float,
z: Float,
i: usize,
j: usize,
k: usize,
)
pub fn add_vertex( &mut self, x: Float, y: Float, z: Float, 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 const_type(&self) -> i8
pub fn const_type(&self) -> i8
Integer constant-type matching the Python convention:
0 = I-constant, 1 = J-constant, 2 = K-constant, -1 = none.
Sourcepub fn index_equals(&self, other: &Face) -> bool
pub fn index_equals(&self, other: &Face) -> bool
Compare index ranges with another face.
Sourcepub fn get_corners(&self) -> Option<([Float; 3], [Float; 3])>
pub fn get_corners(&self) -> Option<([Float; 3], [Float; 3])>
Return the spatial coordinates of the two diagonal corners.
The “lower” corner is the vertex at (IMIN, JMIN, KMIN) and the
“upper” corner is at (IMAX, JMAX, KMAX).
Returns None when the face has no vertices.
Sourcepub fn get_all_corners(&self) -> Option<[[Float; 3]; 4]>
pub fn get_all_corners(&self) -> Option<[[Float; 3]; 4]>
Return all four corner vertices in canonical parametric order.
The ordering matches create_face_from_diagonals():
- I-constant:
[(i, jmin, kmin), (i, jmin, kmax), (i, jmax, kmin), (i, jmax, kmax)] - J-constant:
[(imin, j, kmin), (imin, j, kmax), (imax, j, kmin), (imax, j, kmax)] - K-constant:
[(imin, jmin, k), (imin, jmax, k), (imax, jmin, k), (imax, jmax, k)]
Returns None if the face has fewer than 4 vertices or no constant axis.
Sourcepub fn diagonal_length(&self) -> Float
pub fn diagonal_length(&self) -> Float
Length of the face diagonal between the extreme corner nodes.
Sourcepub fn median_edge_spacing(&self, block: &Block) -> Float
pub fn median_edge_spacing(&self, block: &Block) -> Float
Median edge spacing of the face grid using the block’s coordinates.
Walks adjacent grid nodes along both parametric directions and returns
the median of all edge lengths. Falls back to 1.0 for degenerate faces.
Sourcepub fn vertices_equals(&self, other: &Face, tol: Float) -> bool
pub fn vertices_equals(&self, other: &Face, tol: Float) -> bool
Compare vertex positions with a tolerance.
Sourcepub fn grid_points(
&self,
block: &Block,
stride_u: usize,
stride_v: usize,
) -> Vec<[Float; 3]>
pub fn grid_points( &self, block: &Block, stride_u: usize, stride_v: usize, ) -> Vec<[Float; 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: Float,
min_shared_frac: Float,
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: Float, min_shared_frac: Float, 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) -> FaceKey
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) -> [Float; 3]
pub fn normal(&self, block: &Block) -> [Float; 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: Float, dy: Float, dz: Float)
pub fn shift(&mut self, dx: Float, dy: Float, dz: Float)
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 [VERTEX_MATCH_TOL].
Sourcepub fn overlap_fraction(
&self,
other: &Face,
tol_angle_deg: Float,
tol_plane_dist: Float,
) -> Float
pub fn overlap_fraction( &self, other: &Face, tol_angle_deg: Float, tol_plane_dist: Float, ) -> Float
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: Float,
tol_plane_dist: Float,
min_overlap_frac: Float,
) -> bool
pub fn touches( &self, other: &Face, tol_angle_deg: Float, tol_plane_dist: Float, min_overlap_frac: Float, ) -> 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.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Face
impl RefUnwindSafe for Face
impl Send for Face
impl Sync for Face
impl Unpin for Face
impl UnsafeUnpin for Face
impl UnwindSafe for Face
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more