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: 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.
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) -> [f64; 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 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 diagonal_length(&self) -> f64

Length of the face diagonal between the extreme corner nodes.

Source

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

Compare vertex positions with a tolerance.

Source

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

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

pub fn to_record(&self) -> FaceRecord

Export a FaceRecord representation mirroring the Python dictionary API.

Source

pub fn index_key(&self) -> (usize, usize, usize, usize, usize, usize, usize)

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) -> [f64; 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: f64, dy: f64, dz: f64)

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 tolerance 1e-6.

Source

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.

Source

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.

Source

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

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

Auto Trait Implementations§

§

impl Freeze for Face

§

impl RefUnwindSafe for Face

§

impl Send for Face

§

impl Sync for Face

§

impl Unpin 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> 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.