pub struct Edge { /* private fields */ }Expand description
An edge topology shape.
Implementations§
Source§impl Edge
impl Edge
pub fn id(&self) -> u64
pub fn helix( radius: f64, pitch: f64, height: f64, axis: DVec3, x_ref: DVec3, ) -> Result<Edge, Error>
pub fn polygon<'a>( points: impl IntoIterator<Item = &'a DVec3>, ) -> Result<Vec<Edge>, Error>
pub fn circle(radius: f64, axis: DVec3) -> Result<Edge, Error>
pub fn line(a: DVec3, b: DVec3) -> Result<Edge, Error>
pub fn arc_3pts(start: DVec3, mid: DVec3, end: DVec3) -> Result<Edge, Error>
pub fn bspline<'a>( points: impl IntoIterator<Item = &'a DVec3>, end: BSplineEnd, ) -> Result<Edge, Error>
pub fn iter_elem(&self) -> impl Iterator<Item = &Edge> + '_
pub fn map_elem(self, f: impl FnMut(Edge) -> Edge) -> Edge
pub fn start_point(&self) -> DVec3
pub fn end_point(&self) -> DVec3
pub fn start_tangent(&self) -> DVec3
pub fn end_tangent(&self) -> DVec3
pub fn is_closed(&self) -> bool
pub fn approximation_segments(&self, tolerance: f64) -> Vec<DVec3>
pub fn project(&self, p: DVec3) -> (DVec3, DVec3)
pub fn translate(self, translation: DVec3) -> Edge
pub fn rotate( self, axis_origin: DVec3, axis_direction: DVec3, angle: f64, ) -> Edge
pub fn rotate_x(self, angle: f64) -> Edge
pub fn rotate_y(self, angle: f64) -> Edge
pub fn rotate_z(self, angle: f64) -> Edge
pub fn scale(self, center: DVec3, factor: f64) -> Edge
pub fn mirror(self, plane_origin: DVec3, plane_normal: DVec3) -> Edge
pub fn align_x(self, new_x: DVec3, y_hint: DVec3) -> Edge
pub fn align_y(self, new_y: DVec3, z_hint: DVec3) -> Edge
pub fn align_z(self, new_z: DVec3, x_hint: DVec3) -> Edge
Trait Implementations§
Source§impl Wire for Edge
impl Wire for Edge
type Elem = Edge
Source§fn iter_elem(&self) -> impl Iterator<Item = &Edge> + '_
fn iter_elem(&self) -> impl Iterator<Item = &Edge> + '_
Borrow each element. For
Edge itself this yields std::iter::once(self);
for Vec<T> / [T; N] it yields self.iter().Source§fn map_elem(self, _: impl FnMut(Edge) -> Edge) -> Self
fn map_elem(self, _: impl FnMut(Edge) -> Edge) -> Self
Replace every element by mapping through
f. Length is preserved.
For Edge this is f(self); for collections it consumes self and
rebuilds in the same shape.fn start_point(&self) -> DVec3
fn end_point(&self) -> DVec3
fn start_tangent(&self) -> DVec3
fn end_tangent(&self) -> DVec3
Source§fn is_closed(&self) -> bool
fn is_closed(&self) -> bool
Empty wire: false. Single-edge wire: defer to that edge’s geometry
(a circle is closed). Multi-edge wire: first edge’s start ≈ last edge’s
end. 1e-6 はモデル単位 (mm) を想定したハードコード — 引数化は API が
増えるため後回し。極小/極大スケールのモデルで誤判定したら直す。
fn approximation_segments(&self, tolerance: f64) -> Vec<DVec3>
Source§fn project(&self, p: DVec3) -> (DVec3, DVec3)
fn project(&self, p: DVec3) -> (DVec3, DVec3)
Project
p onto the wire and return (closest_point, unit_tangent).
The tangent follows the curve’s native parameter direction. Read morefn translate(self, translation: DVec3) -> Self
fn rotate(self, axis_origin: DVec3, axis_direction: DVec3, angle: f64) -> Self
fn rotate_x(self, angle: f64) -> Self
fn rotate_y(self, angle: f64) -> Self
fn rotate_z(self, angle: f64) -> Self
fn scale(self, center: DVec3, factor: f64) -> Self
fn mirror(self, plane_origin: DVec3, plane_normal: DVec3) -> Self
fn align_x(self, new_x: DVec3, y_hint: DVec3) -> Self
fn align_y(self, new_y: DVec3, z_hint: DVec3) -> Self
fn align_z(self, new_z: DVec3, x_hint: DVec3) -> Self
Auto Trait Implementations§
impl Freeze for Edge
impl RefUnwindSafe for Edge
impl Send for Edge
impl !Sync for Edge
impl Unpin for Edge
impl UnsafeUnpin for Edge
impl UnwindSafe for Edge
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
Mutably borrows from an owned value. Read more