pub struct OrigamiPattern {
pub vertices: Vec<Vec3>,
pub fold_lines: Vec<FoldLine>,
pub facets: Vec<OrigamiFacet>,
}Expand description
A complete crease pattern: vertices, fold lines, and facets.
The pattern stores both the flat (reference) configuration and can compute fold angles from an input folded state.
Fields§
§vertices: Vec<Vec3>Vertices in the flat (unfolded) configuration.
fold_lines: Vec<FoldLine>All crease lines.
facets: Vec<OrigamiFacet>All planar facets.
Implementations§
Source§impl OrigamiPattern
impl OrigamiPattern
Sourcepub fn add_vertex(&mut self, v: Vec3) -> usize
pub fn add_vertex(&mut self, v: Vec3) -> usize
Add a vertex, returning its index.
Sourcepub fn add_fold_line(&mut self, fl: FoldLine) -> usize
pub fn add_fold_line(&mut self, fl: FoldLine) -> usize
Add a fold line, returning its index.
Sourcepub fn add_facet(&mut self, facet: OrigamiFacet) -> usize
pub fn add_facet(&mut self, facet: OrigamiFacet) -> usize
Add a facet, returning its index.
Sourcepub fn dihedral_angle(n1: &Vec3, n2: &Vec3) -> f64
pub fn dihedral_angle(n1: &Vec3, n2: &Vec3) -> f64
Compute the fold angle of crease i given two face normals on either side.
Returns the dihedral angle in radians.
Sourcepub fn set_fold_parameter(&mut self, t: f64)
pub fn set_fold_parameter(&mut self, t: f64)
Set all fold angles proportionally to t ∈ [0, 1], where 0 = flat and
1 = maximum angle (π for mountain/valley).
Sourcepub fn degrees_of_freedom(&self) -> usize
pub fn degrees_of_freedom(&self) -> usize
Return the total number of degrees of freedom (independent fold angles).
For a generic crease pattern this is F - 1 by Euler’s formula, where F
is the number of interior vertices.
Sourcepub fn gaussian_curvature_at(&self, _vi: usize) -> f64
pub fn gaussian_curvature_at(&self, _vi: usize) -> f64
Compute approximate Gaussian curvature at vertex vi using the angle deficit.
Returns None if the vertex index is out of range or has no adjacent facets.
Trait Implementations§
Source§impl Clone for OrigamiPattern
impl Clone for OrigamiPattern
Source§fn clone(&self) -> OrigamiPattern
fn clone(&self) -> OrigamiPattern
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OrigamiPattern
impl Debug for OrigamiPattern
Auto Trait Implementations§
impl Freeze for OrigamiPattern
impl RefUnwindSafe for OrigamiPattern
impl Send for OrigamiPattern
impl Sync for OrigamiPattern
impl Unpin for OrigamiPattern
impl UnsafeUnpin for OrigamiPattern
impl UnwindSafe for OrigamiPattern
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.