Skip to main content

Face

Struct Face 

Source
pub struct Face { /* private fields */ }
Expand description

Quadrilateral face definition that mimics the Python implementation.

Implementations§

Source§

impl Face

Source

pub fn new() -> Self

Create an empty face.

Source

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.
Source

pub fn set_block_index(&mut self, idx: usize)

Set the owning block index.

Source

pub fn set_id(&mut self, id: usize)

Set the application-defined identifier.

Source

pub fn id(&self) -> Option<usize>

Identifier, if one has been assigned.

Source

pub fn centroid(&self) -> [Float; 3]

Retrieve the centroid.

Source

pub fn block_index(&self) -> Option<usize>

Owning block index, if present.

Source

pub fn indices(&self) -> &[[usize; 3]]

Iterate over stored vertex indices (i, j, k).

Source

pub fn i_values(&self) -> impl Iterator<Item = usize> + '_

All I indices used by this face.

Source

pub fn j_values(&self) -> impl Iterator<Item = usize> + '_

All J indices used by this face.

Source

pub fn k_values(&self) -> impl Iterator<Item = usize> + '_

All K indices used by this face.

Source

pub fn imin(&self) -> usize

Minimum I index among the vertices.

Source

pub fn imax(&self) -> usize

Maximum I index among the vertices.

Source

pub fn jmin(&self) -> usize

Minimum J index among the vertices.

Source

pub fn jmax(&self) -> usize

Maximum J index among the vertices.

Source

pub fn kmin(&self) -> usize

Minimum K index among the vertices.

Source

pub fn kmax(&self) -> usize

Maximum K index among the vertices.

Source

pub fn const_axis(&self) -> Option<FaceAxis>

Determine which index is constant, if the face is structured.

Source

pub fn const_type(&self) -> i8

Integer constant-type matching the Python convention: 0 = I-constant, 1 = J-constant, 2 = K-constant, -1 = none.

Source

pub fn is_edge(&self) -> bool

True when the face collapses to an edge.

Source

pub fn index_equals(&self, other: &Face) -> bool

Compare index ranges with another face.

Source

pub fn vertices(&self) -> &[[Float; 3]]

Read-only access to the stored vertex coordinates.

Source

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.

Source

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.

Source

pub fn diagonal_length(&self) -> Float

Length of the face diagonal between the extreme corner nodes.

Source

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.

Source

pub fn vertices_equals(&self, other: &Face, tol: Float) -> bool

Compare vertex positions with a tolerance.

Source

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.
Source

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.
Source

pub fn to_record(&self) -> FaceRecord

Export a FaceRecord representation mirroring the Python dictionary API.

Source

pub fn index_key(&self) -> FaceKey

Source

pub fn scale_indices(&mut self, factor: usize)

Scale all stored index values by factor.

Source

pub fn is_point(&self) -> bool

True when the face collapses to a single point (all three indices constant).

Source

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.

Source

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.

Source

pub fn shift(&mut self, dx: Float, dy: Float, dz: Float)

Shift all stored vertices by (dx, dy, dz) in place.

Source

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].

Source

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.

Source

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.

Source

pub fn shared_point_fraction( &self, other: &Face, block_self: &Block, block_other: &Block, tol_xyz: Float, stride_u: usize, stride_v: usize, ) -> Float

Fraction of shared grid nodes between this face and other.

Uses quantized point comparison for robustness.

Trait Implementations§

Source§

impl Clone for Face

Source§

fn clone(&self) -> Face

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Face

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Face

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.