Skip to main content

SurfaceGeometry

Enum SurfaceGeometry 

Source
pub enum SurfaceGeometry {
    Plane(PlaneSurface),
    Cylinder(CylinderSurface),
    Cone(ConeSurface),
    Sphere(SphereSurface),
    Torus(TorusSurface),
    BSpline(BSplineSurface),
    Revolution(Box<RevolutionSurface>),
    Extrusion(Box<ExtrusionSurface>),
    Trimmed(Box<TrimmedSurface>),
    Offset(Box<OffsetSurface>),
}
Expand description

A surface.

Variants§

§

Plane(PlaneSurface)

A plane.

§

Cylinder(CylinderSurface)

A circular cylinder.

§

Cone(ConeSurface)

A circular cone.

§

Sphere(SphereSurface)

A sphere.

§

Torus(TorusSurface)

A torus.

§

BSpline(BSplineSurface)

A polynomial or rational B-spline patch.

§

Revolution(Box<RevolutionSurface>)

A curve revolved about an axis.

§

Extrusion(Box<ExtrusionSurface>)

A curve swept along a direction.

§

Trimmed(Box<TrimmedSurface>)

Another surface restricted to a sub-rectangle.

§

Offset(Box<OffsetSurface>)

A surface at a constant signed distance along another’s normal.

Implementations§

Source§

impl SurfaceGeometry

Source

pub fn fitted_bspline( &self, tolerance: f64, tol: Tolerances, ) -> OgeomResult<Fitted<BSplineSurface>>

This surface as a B-spline fitted over its own domain to a stated tolerance: the approximation to_bspline refuses to make silently, for an offset surface or anything else with no exact rational form. A grid of the surface’s points is fitted at degree three at the surface’s own parameters, the fit measured against the surface between the samples as well as at them, and the grid refined where it misses until the tolerance holds or the budget runs out; error is the worst measured, not what was asked. The fit spans the surface’s own domain, but its knots are its own, so a pcurve spoken against the surface is re-derived against the result. Where the surface cannot be evaluated (an offset sphere’s poles, where the basis has no normal) the fit takes the limit of the points around, and the error stated counts how closely they close on it.

§Errors

OgeomError::Construction if the domain is unbounded, the tolerance is not a distance, or the surface cannot be evaluated somewhere and the points around do not close on one (an offset cone’s apex); as fit::fit_surface_grid.

Source§

impl SurfaceGeometry

Source

pub fn to_bspline(&self, tol: Tolerances) -> OgeomResult<BSplineSurface>

This surface as a B-spline patch, exactly, over [0, 1] in both directions.

Every analytic surface here is a surface of revolution or a ruled one, so its exact form falls out of the curve conversion above rather than needing a construction of its own: revolve an exactly-converted profile and the patch is exact wherever the profile was.

As for curves, the parameterization does not survive: a cylinder’s u is an angle and the patch’s is not. See the module documentation.

§Errors

OgeomError::Construction if the surface’s own extents are degenerate, or its geometry cannot be evaluated.

Trait Implementations§

Source§

impl Clone for SurfaceGeometry

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SurfaceGeometry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<BSplineSurface> for SurfaceGeometry

Source§

fn from(s: BSplineSurface) -> Self

Converts to this type from the input type.
Source§

impl From<ConeSurface> for SurfaceGeometry

Source§

fn from(s: ConeSurface) -> Self

Converts to this type from the input type.
Source§

impl From<CylinderSurface> for SurfaceGeometry

Source§

fn from(s: CylinderSurface) -> Self

Converts to this type from the input type.
Source§

impl From<ExtrusionSurface> for SurfaceGeometry

Source§

fn from(s: ExtrusionSurface) -> Self

Converts to this type from the input type.
Source§

impl From<PlaneSurface> for SurfaceGeometry

Source§

fn from(s: PlaneSurface) -> Self

Converts to this type from the input type.
Source§

impl From<RevolutionSurface> for SurfaceGeometry

Source§

fn from(s: RevolutionSurface) -> Self

Converts to this type from the input type.
Source§

impl From<SphereSurface> for SurfaceGeometry

Source§

fn from(s: SphereSurface) -> Self

Converts to this type from the input type.
Source§

impl From<TorusSurface> for SurfaceGeometry

Source§

fn from(s: TorusSurface) -> Self

Converts to this type from the input type.
Source§

impl From<TrimmedSurface> for SurfaceGeometry

Source§

fn from(s: TrimmedSurface) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for SurfaceGeometry

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SurfaceGeometry

Source§

impl Surface for SurfaceGeometry

Source§

fn domain(&self) -> ((f64, f64), (f64, f64))

The u and v parameter intervals.
Source§

fn point_at(&self, u: f64, v: f64, tol: Tolerances) -> OgeomResult<Point>

The point at (u, v). Read more
Source§

fn d1_at( &self, u: f64, v: f64, tol: Tolerances, ) -> OgeomResult<(Vector, Vector)>

The two first derivatives at (u, v). Read more
Source§

fn d2_at( &self, u: f64, v: f64, tol: Tolerances, ) -> OgeomResult<(Vector, Vector, Vector)>

The three second derivatives at (u, v): d2u, duv, d2v. Read more
Source§

fn point_d1_at( &self, u: f64, v: f64, tol: Tolerances, ) -> OgeomResult<(Point, Vector, Vector)>

The point and first derivatives together: (point, du, dv). Read more
Source§

fn jet_at(&self, u: f64, v: f64, tol: Tolerances) -> OgeomResult<SurfaceJet>

The point and every derivative through second order, together. Read more
Source§

fn kind(&self) -> SurfaceKind

What kind of surface this is.
Source§

fn continuity(&self) -> Continuity

How smooth the surface is across its domain.
Source§

fn is_closed_u(&self, tol: Tolerances) -> bool

Whether the surface closes on itself along u.
Source§

fn is_closed_v(&self, tol: Tolerances) -> bool

Whether the surface closes on itself along v.
Source§

fn is_periodic_u(&self) -> bool

Whether u repeats past the domain.
Source§

fn is_periodic_v(&self) -> bool

Whether v repeats past the domain.
Source§

fn normal_at(&self, u: f64, v: f64, tol: Tolerances) -> OgeomResult<Direction>

The unit normal at (u, v), following du x dv. Read more
Source§

fn curvature_at( &self, u: f64, v: f64, tol: Tolerances, ) -> OgeomResult<SurfaceCurvature>

The principal curvatures and directions at (u, v). Read more
Source§

fn is_degenerate_at(&self, u: f64, v: f64, tol: Tolerances) -> OgeomResult<bool>

Whether the surface degenerates at (u, v). Read more
Source§

fn normalize_parameters( &self, u: f64, v: f64, tol: Tolerances, ) -> OgeomResult<(f64, f64)>

Bring (u, v) into the domain, wrapping in whichever directions are periodic, or closed. Read more
Source§

fn parameter_outside( &self, t: f64, a: f64, b: f64, periodic: bool, across: bool, tol: Tolerances, ) -> OgeomResult<f64>

A parameter outside its domain, or on a periodic direction: wrapped where the direction repeats or closes on itself, refused otherwise. Read more
Source§

impl Transformable for SurfaceGeometry

Source§

fn transformed(&self, t: &Transform, tol: Tolerances) -> OgeomResult<Self>

This geometry moved by t. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,

§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.