Struct truck_geometry::decorators::RevolutedCurve [−][src]
pub struct RevolutedCurve<C> { /* fields omitted */ }
Expand description
surface constructed by revoluting a curve
Examples
Revoluted sphere
use truck_geometry::*;
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
Creates a surface by revoluting a curve.
Returns the curve before revoluted.
Into the curve before revoluted.
Returns true if the front point of the curve is on the axis of rotation.
Examples
use truck_geometry::*;
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());
Returns true if the back point of the curve is on the axis of rotation.
Examples
use truck_geometry::*;
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
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
Returns whether the curve curve
is included in the surface self
.
Returns whether the curve curve
is included in the surface self
.
Returns whether the curve curve
is included in the surface self
.
Returns whether the curve curve
is included in the surface self
.
Returns whether the curve curve
is included in the surface self
.
Returns whether the curve curve
is included in the surface self
.
Returns whether the curve curve
is included in the surface self
.
Returns whether the curve curve
is included in the surface self
.
impl<C> ParameterDivision2D for RevolutedCurve<C> where
C: ParametricCurve3D + ParameterDivision1D<Point = Point3>,
impl<C> ParameterDivision2D for RevolutedCurve<C> where
C: ParametricCurve3D + ParameterDivision1D<Point = Point3>,
Auto Trait Implementations
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
Mutably borrows from an owned value. Read more