Struct truck_geometry::decorators::RevolutedCurve
source · pub struct RevolutedCurve<C> { /* private fields */ }
Expand description
surface constructed by revoluting a curve
§Examples
Revoluted sphere
use truck_geometry::prelude::*;
use std::f64::consts::PI;
let knot_vec = KnotVec::bezier_knot(2);
let control_points = vec![
Vector4::new(1.0, 0.0, 0.0, 1.0),
Vector4::new(0.0, 1.0, 0.0, 0.0),
Vector4::new(-1.0, 0.0, 0.0, 1.0),
];
// upper half circle on xy-plane
let uhcircle = NurbsCurve::new(BSplineCurve::new(knot_vec, control_points));
// sphere constructed by revolute circle
let sphere = RevolutedCurve::by_revolution(
uhcircle, Point3::origin(), Vector3::unit_x(),
);
const N: usize = 30;
for i in 0..=N {
for j in 0..=N {
let u = i as f64 / N as f64;
let v = 2.0 * PI * j as f64 / N as f64;
let pt: Vector3 = sphere.subs(u, v).to_vec();
assert_near2!(pt.magnitude2(), 1.0);
assert_near!(pt, sphere.normal(u, v));
}
}
Implementations§
source§impl<C> RevolutedCurve<C>
impl<C> RevolutedCurve<C>
sourcepub fn by_revolution(curve: C, origin: Point3, axis: Vector3) -> Self
pub fn by_revolution(curve: C, origin: Point3, axis: Vector3) -> Self
Creates a surface by revoluting a curve.
sourcepub const fn entity_curve(&self) -> &C
pub const fn entity_curve(&self) -> &C
Returns the curve before revoluted.
sourcepub fn into_entity_curve(self) -> C
pub fn into_entity_curve(self) -> C
Into the curve before revoluted.
source§impl<C: ParametricCurve3D + BoundedCurve> RevolutedCurve<C>
impl<C: ParametricCurve3D + BoundedCurve> RevolutedCurve<C>
sourcepub fn is_front_fixed(&self) -> bool
pub fn is_front_fixed(&self) -> bool
Returns true if the front point of the curve is on the axis of rotation.
§Examples
use truck_geometry::prelude::*;
let line = BSplineCurve::new(
KnotVec::bezier_knot(1),
vec![Point3::new(0.0, 0.0, 0.0), Point3::new(0.0, 0.0, 1.0)],
);
let surface0 = RevolutedCurve::by_revolution(line.clone(), Point3::origin(), Vector3::unit_y());
assert!(surface0.is_front_fixed());
let surface1 = RevolutedCurve::by_revolution(line, Point3::new(1.0, 0.0, 0.0), Vector3::unit_y());
assert!(!surface1.is_front_fixed());
sourcepub fn is_back_fixed(&self) -> bool
pub fn is_back_fixed(&self) -> bool
Returns true if the back point of the curve is on the axis of rotation.
§Examples
use truck_geometry::prelude::*;
let line = BSplineCurve::new(
KnotVec::bezier_knot(1),
vec![Point3::new(0.0, 0.0, 1.0), Point3::new(0.0, 0.0, 0.0)],
);
let surface0 = RevolutedCurve::by_revolution(line.clone(), Point3::origin(), Vector3::unit_y());
assert!(surface0.is_back_fixed());
let surface1 = RevolutedCurve::by_revolution(line, Point3::new(1.0, 0.0, 0.0), Vector3::unit_y());
assert!(!surface1.is_back_fixed());
Trait Implementations§
source§impl<C: ParametricCurve3D + BoundedCurve> BoundedSurface for RevolutedCurve<C>
impl<C: ParametricCurve3D + BoundedCurve> BoundedSurface for RevolutedCurve<C>
source§impl<C: Clone> Clone for RevolutedCurve<C>
impl<C: Clone> Clone for RevolutedCurve<C>
source§fn clone(&self) -> RevolutedCurve<C>
fn clone(&self) -> RevolutedCurve<C>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<C: Debug> Debug for RevolutedCurve<C>
impl<C: Debug> Debug for RevolutedCurve<C>
source§impl<'de, C> Deserialize<'de> for RevolutedCurve<C>where
C: Deserialize<'de>,
impl<'de, C> Deserialize<'de> for RevolutedCurve<C>where
C: Deserialize<'de>,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<'a> IncludeCurve<BSplineCurve<Point3<f64>>> for RevolutedCurve<&'a BSplineCurve<Point3>>
impl<'a> IncludeCurve<BSplineCurve<Point3<f64>>> for RevolutedCurve<&'a BSplineCurve<Point3>>
source§impl<'a> IncludeCurve<BSplineCurve<Point3<f64>>> for RevolutedCurve<&'a NurbsCurve<Vector4>>
impl<'a> IncludeCurve<BSplineCurve<Point3<f64>>> for RevolutedCurve<&'a NurbsCurve<Vector4>>
source§impl IncludeCurve<BSplineCurve<Point3<f64>>> for RevolutedCurve<BSplineCurve<Point3>>
impl IncludeCurve<BSplineCurve<Point3<f64>>> for RevolutedCurve<BSplineCurve<Point3>>
source§impl IncludeCurve<BSplineCurve<Point3<f64>>> for RevolutedCurve<NurbsCurve<Vector4>>
impl IncludeCurve<BSplineCurve<Point3<f64>>> for RevolutedCurve<NurbsCurve<Vector4>>
source§impl<'a> IncludeCurve<NurbsCurve<Vector4<f64>>> for RevolutedCurve<&'a BSplineCurve<Point3>>
impl<'a> IncludeCurve<NurbsCurve<Vector4<f64>>> for RevolutedCurve<&'a BSplineCurve<Point3>>
source§impl<'a> IncludeCurve<NurbsCurve<Vector4<f64>>> for RevolutedCurve<&'a NurbsCurve<Vector4>>
impl<'a> IncludeCurve<NurbsCurve<Vector4<f64>>> for RevolutedCurve<&'a NurbsCurve<Vector4>>
source§impl IncludeCurve<NurbsCurve<Vector4<f64>>> for RevolutedCurve<BSplineCurve<Point3>>
impl IncludeCurve<NurbsCurve<Vector4<f64>>> for RevolutedCurve<BSplineCurve<Point3>>
source§impl IncludeCurve<NurbsCurve<Vector4<f64>>> for RevolutedCurve<NurbsCurve<Vector4>>
impl IncludeCurve<NurbsCurve<Vector4<f64>>> for RevolutedCurve<NurbsCurve<Vector4>>
source§impl<C: Clone> Invertible for RevolutedCurve<C>
impl<C: Clone> Invertible for RevolutedCurve<C>
source§impl<C> ParameterDivision2D for RevolutedCurve<C>
impl<C> ParameterDivision2D for RevolutedCurve<C>
source§impl<C: ParametricCurve3D> ParametricSurface for RevolutedCurve<C>
impl<C: ParametricCurve3D> ParametricSurface for RevolutedCurve<C>
source§fn parameter_range(&self) -> (ParameterRange, ParameterRange)
fn parameter_range(&self) -> (ParameterRange, ParameterRange)
The range of the parameter of the surface.
source§fn u_period(&self) -> Option<f64>
fn u_period(&self) -> Option<f64>
None
in default; Some(period)
if periodic w.r.t. parameter u.source§impl<C: ParametricCurve3D + BoundedCurve> ParametricSurface3D for RevolutedCurve<C>
impl<C: ParametricCurve3D + BoundedCurve> ParametricSurface3D for RevolutedCurve<C>
source§impl<C: PartialEq> PartialEq for RevolutedCurve<C>
impl<C: PartialEq> PartialEq for RevolutedCurve<C>
source§impl<C: ParametricCurve3D + BoundedCurve> SearchNearestParameter<D2> for RevolutedCurve<C>
impl<C: ParametricCurve3D + BoundedCurve> SearchNearestParameter<D2> for RevolutedCurve<C>
source§impl<C: ParametricCurve3D + BoundedCurve> SearchParameter<D2> for RevolutedCurve<C>
impl<C: ParametricCurve3D + BoundedCurve> SearchParameter<D2> for RevolutedCurve<C>
source§impl<C> Serialize for RevolutedCurve<C>where
C: Serialize,
impl<C> Serialize for RevolutedCurve<C>where
C: Serialize,
impl<C: Copy> Copy for RevolutedCurve<C>
impl<C> StructuralPartialEq for RevolutedCurve<C>
Auto Trait Implementations§
impl<C> Freeze for RevolutedCurve<C>where
C: Freeze,
impl<C> RefUnwindSafe for RevolutedCurve<C>where
C: RefUnwindSafe,
impl<C> Send for RevolutedCurve<C>where
C: Send,
impl<C> Sync for RevolutedCurve<C>where
C: Sync,
impl<C> Unpin for RevolutedCurve<C>where
C: Unpin,
impl<C> UnwindSafe for RevolutedCurve<C>where
C: UnwindSafe,
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)