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 origin of revolution

Returns axis of revolution

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

The range of the parameter of the surface.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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.

Inverts self

Returns the inverse.

Creates the surface division Read more

The surface is in the space of Self::Point.

The derivation vector of the curve.

Substitutes the parameter (u, v).

Returns the derivation by u.

Returns the derivation by v.

Returns the 2nd-order derivation by u.

Returns the 2nd-order derivation by v.

Returns the 2nd-order derivation by both u and v.

Returns the normal vector at (u, v).

point

curve => f64, surface => (f64, f64)

Search nearest parameter t such that self.subs(t) is nearest point.
Returns None if could not find such parameter. Read more

point

curve => f64, surface => (f64, f64)

Search parameter t such that self.subs(t) is near point.
Returns None if could not find such parameter. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.