pub struct FoldLine {
pub start: Vec3,
pub end: Vec3,
pub direction: Vec3,
pub fold_angle: f64,
pub fold_type: FoldType,
pub adjacent_facets: [Option<usize>; 2],
}Expand description
A single crease line in an origami pattern.
Stores the geometric position and direction of the fold, the current dihedral (fold) angle, and whether it is a mountain or valley crease.
Fields§
§start: Vec3Start point of the fold line (in reference flat configuration).
end: Vec3End point of the fold line (in reference flat configuration).
direction: Vec3Unit direction from start to end.
fold_angle: f64Dihedral fold angle in radians. 0 = flat, π = fully folded.
fold_type: FoldTypeMountain or valley type.
adjacent_facets: [Option<usize>; 2]Indices of the two facets on either side of this crease (if any).
Implementations§
Source§impl FoldLine
impl FoldLine
Sourcepub fn new(start: Vec3, end: Vec3, fold_type: FoldType) -> Self
pub fn new(start: Vec3, end: Vec3, fold_type: FoldType) -> Self
Create a new fold line from two end points.
Sourcepub fn signed_angle(&self) -> f64
pub fn signed_angle(&self) -> f64
Signed fold angle: positive for mountain, negative for valley.
Sourcepub fn rotation_matrix(&self) -> [[f64; 3]; 3]
pub fn rotation_matrix(&self) -> [[f64; 3]; 3]
Rotation matrix that rotates about the fold axis by fold_angle.
Uses Rodrigues’ rotation formula.
Sourcepub fn apply_rotation(&self, point: &Vec3) -> Vec3
pub fn apply_rotation(&self, point: &Vec3) -> Vec3
Apply the fold rotation to a point relative to the fold line start.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for FoldLine
impl RefUnwindSafe for FoldLine
impl Send for FoldLine
impl Sync for FoldLine
impl Unpin for FoldLine
impl UnsafeUnpin for FoldLine
impl UnwindSafe for FoldLine
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.