Hide menu
Loading...
Searching...
No Matches

Base class for geometrical surfaces. More...

#include <cadex/Geom/Surface.hxx>

Inheritance diagram for cadex::Geom::Surface:
cadex::Geom::Geometry cadex::BaseObject cadex::Geom::BSplineSurface cadex::Geom::BezierSurface cadex::Geom::ElementarySurface cadex::Geom::OffsetSurface cadex::Geom::SweptSurface cadex::Geom::ConicalSurface cadex::Geom::CylindricalSurface cadex::Geom::Plane cadex::Geom::SphericalSurface cadex::Geom::ToroidalSurface cadex::Geom::SurfaceOfLinearExtrusion cadex::Geom::SurfaceOfRevolution

Public Member Functions

 Surface ()
 Constructor.
 
SurfaceType Type () const
 Returns a surface type.
 
Geom::Continuity Continuity () const
 Returns a continuity type of the surface.
 
Point Value (double theParameterU, double theParameterV) const
 Evaluates a point on the surface.
 
Direction Normal (double theParameterU, double theParameterV) const
 Returns the normal direction theNormal at the current point.
 
bool IsUPeriodic () const
 Returns true if the surface is periodic in U direction.
 
bool IsVPeriodic () const
 Returns true if the surface is periodic in V direction.
 
double UMin () const
 Returns a minimum parameter of a definition domain in U direction.
 
double UMax () const
 Returns a maximum parameter of a definition domain in U direction.
 
double VMin () const
 Returns a minimum parameter of a definition domain in V direction.
 
double VMax () const
 Returns a maximum parameter of a definition domain in V direction.
 
void Domain (double &theUMin, double &theUMax, double &theVMin, double &theVMax) const
 Returns a definition domain.
 
bool IsTrimmed () const
 Returns whether surface is trimmed or not.
 
void SetTrim (double theUFirst, double theULast, double theVFirst, double theVLast)
 Trims surface with [theUFirst, theULast] x [theVFirst, theVLast] section.
 
void Transform (const Transformation &theTransformation)
 Applies transformation matrix to this object.
 
Surface Transformed (const Transformation &theTransformation) const
 Returns a copy this object after applying transformation.
 
void D0 (double theParameterU, double theParameterV, Point &theValue) const
 Returns the point theValue of parameter theU, theV on the surface.
 
void D1 (double theParameterU, double theParameterV, Point &theValue, Vector &theD1U, Vector &theD1V) const
 Returns the point theValue and the first derivatives in the directions U theD1U and V theD1V at this point.
 
void D2 (double theParameterU, double theParameterV, Point &theValue, Vector &theD1U, Vector &theD1V, Vector &theD2U, Vector &theD2V, Vector &theD2UV) const
 Returns the point theValue, the first and the second derivatives in the directions U and V at this point.
 
bool DN (double theParameterU, double theParameterV, size_t theDerivativeOrder, Geom::Point &theValue, std::vector< Geom::Vector > &theD) const
 
void Curvature (double theParameterU, double theParameterV, Direction &thePrincipalMaxDirection, Direction &thePrincipalMinDirection) const
 Returns the max and min principal curvature directions multiplied by max and min value of curvature respectively.
 
void Curvature (double theParameterU, double theParameterV, Direction &thePrincipalMaxDirection, Direction &thePrincipalMinDirection, double &theMaxCurvature, double &theMinCurvature) const
 Returns the max and min principal curvature directions and their values.
 
void Mirror (const Point &thePoint)
 
void Mirror (const Axis1d &theAxis)
 
void Mirror (const Axis3d &theAxis)
 
Surface Mirrored (const Point &theRef) const
 
Surface Mirrored (const Axis1d &theAxis) const
 
Surface Mirrored (const Axis3d &theAxis) const
 
void Rotate (const Axis1d &theAxis, double theAngle)
 
Surface Rotated (const Axis1d &theAxis, double theAngle) const
 
void Translate (const Vector &theVector)
 
Surface Translated (const Vector &theVector) const
 
void Scale (const Point &thePoint, double theScale)
 
Surface Scaled (const Point &thePoint, double theScale) const
 
- Public Member Functions inherited from cadex::BaseObject
size_t Id () const
 Return unique identifier of public object.
 
internal::BaseObjectImpl * Impl () const
 
bool IsNull () const
 
 operator bool () const
 
template<typename T >
bool IsOfType () const
 
template<typename T >
T * Impl () const
 Reserved for internal use.
 

Static Public Member Functions

static bool CompareType (const BaseObject &theObject)
 
- Static Public Member Functions inherited from cadex::Geom::Geometry
static bool CompareType (const BaseObject &theObject)
 

Protected Member Functions

 Surface (const ImplType &theImpl)
 
- Protected Member Functions inherited from cadex::Geom::Geometry
 Geometry (const ImplType &theImpl)
 
- Protected Member Functions inherited from cadex::BaseObject
 BaseObject (const ImplType &theImpl)
 

Additional Inherited Members

- Public Types inherited from cadex::BaseObject
typedef std::shared_ptr< internal::BaseObjectImpl > ImplType
 

Detailed Description

Base class for geometrical surfaces.

Surfaces in 3D space are used to represent boundaries of a body (e.g. solid or sheet body). Each face must refer to a surface.

Types

Refer to Surface Types for the list of supported surface types. Type() returns a surface type as enumeration value which can be used to downcast to a respective subclass type, for instance:

Surface aSurface = ...;
if (aSurface.Type() == gEOM::ShapeType::Cylinder) {
const CylindricalSurface& aCylSurf = static_cast<const CylindricalSurface&> (aSurface);
double aRadius = aCylSurf.Radius();
...
}
Defines a cylindrical surface.
Definition CylindricalSurface.hxx:31
double Radius() const
Returns radius.
Definition CylindricalSurface.cxx:113
Base class for geometrical surfaces.
Definition Surface.hxx:40
SurfaceType Type() const
Returns a surface type.
Definition Surface.cxx:495

Parametric Definition

Surface is defined using parametric definition as \(\mathbf{S}(u,v)\) where \(\mathbf{S}\) is a 3D radius-vector \((x,y,z)\) and \((u, v)\) are parameters from a definition domain \([u_{min}, u_{max}]\times[v_{min}, v_{max}]\).

UMin(), UMax() and VMin(), VMax(), and Domain() return parametric definition range. Parametric range can be bounded (e.g. \([0, 1]\times[0, 1]\) for Bezier surface), unbounded (e.g. \((-\infty, +\infty)\times(-\infty, +\infty)\) for a plane), or semi-unbounded (e.g. \([0, 2\pi]\times(-\infty, +\infty)\) for cylindrical surface).

Evaluation

At any parameter u and v within a definition domain, the surface can be evaluated as follows:

  • Value() and D0() return a 3D point;
  • D1(), D2() and DN() return a derivative of a respective order;
  • Curvature() returns a curvature;
  • Normal() returns a normal to the surface (i.e. perpendicular to a tangential plane).

The following example demonstrates computation of a point on a sphere at parameters \(u=\frac{\pi}{4}\), \(v=\frac{\pi}{6}\):

CylindricalSurface aSphere = ...;
Point aPoint = aSphere.Value (M_PI / 4, M_PI / 6);
Defines a 3D point.
Definition Point.hxx:35

If the surface is periodic in U and/or V (IsUPeriodic() and/or IsVPeriodic() return true) then the surface can be evaluated at any parameter U and/or V, otherwise behavior is undefined (e.g. an exception can be thrown or a weird value can be returned).

Continuity

Continuity() returns continuity (C0, C1, C2, CN) of the surface, minimum of U- and V- continuities, where C0 indicates continuity of the surface only, C1 - of its first derivative and so on.

Transformation

The surface can be modified using the following operations:

  • translation (Translate() and Translated());
  • rotation (Rotate() and Rotated());
  • mirroring (Mirror() and Mirrored());
  • scaling (Scale() and Scaled());
  • arbitrary transformation using 3x4 matrix (Transform() and Transformed()).
Warning
As the surface data is shared via internal pointer modification of the surface may affect other users of the surface (e.g. a face referring to it). So you might want to use method returning a modified copy of the surface (such as Transformed()).
See also
Surfaces, Curve, ModelData::Face.

Member Function Documentation

◆ D0()

void cadex::Geom::Surface::D0 ( double theU,
double theV,
Point & theValue ) const

Returns the point theValue of parameter theU, theV on the surface.

Throws exception only for the Geom::OffsetSurface if it is not possible to compute the current point.

◆ D1()

void cadex::Geom::Surface::D1 ( double theU,
double theV,
Point & theValue,
Vector & theD1U,
Vector & theD1V ) const

Returns the point theValue and the first derivatives in the directions U theD1U and V theD1V at this point.

Throws exception if the continuity of the surface is not C1.

◆ D2()

void cadex::Geom::Surface::D2 ( double theU,
double theV,
Point & theValue,
Vector & theD1U,
Vector & theD1V,
Vector & theD2U,
Vector & theD2V,
Vector & theD2UV ) const

Returns the point theValue, the first and the second derivatives in the directions U and V at this point.

Throws exception if the continuity of the surface is not C2.

◆ DN()

bool cadex::Geom::Surface::DN ( double theParameterU,
double theParameterV,
size_t theDerivativeOrder,
Geom::Point & theValue,
std::vector< Geom::Vector > & theD ) const

Returns true if calculation was passed succsesfully, the returned vectors gives the value of the derivative for the order of derivation theDerivativeOrder. Otherwise returns false. Throws exception if the continuity of the surface is not CN.

Parameters:

  • theDerivativeOrder must belong to range [0, 3].
  • theD should have enough size to store 2 for D1(), 5 for D2() or 9 for D3() derivatives.

◆ Domain()

void cadex::Geom::Surface::Domain ( double & theUMin,
double & theUMax,
double & theVMin,
double & theVMax ) const

Returns a definition domain.

See also
UMin(), UMax(), VMin(), VMax().

◆ IsUPeriodic()

bool cadex::Geom::Surface::IsUPeriodic ( ) const

Returns true if the surface is periodic in U direction.

Examples include sphere, torus or a surface of revolution

◆ IsVPeriodic()

bool cadex::Geom::Surface::IsVPeriodic ( ) const

Returns true if the surface is periodic in V direction.

Examples include torus or a V-periodic B-Spline.

◆ Transform()

void cadex::Geom::Surface::Transform ( const Transformation & theTransformation)

Applies transformation matrix to this object.

Results depends on the actual surface type.

See also
Transformed().

◆ Transformed()

Surface cadex::Geom::Surface::Transformed ( const Transformation & theTransformation) const

Returns a copy this object after applying transformation.

The contents of this object is not modified.

See also
Transform().

◆ UMax()

double cadex::Geom::Surface::UMax ( ) const

Returns a maximum parameter of a definition domain in U direction.

See also
UMin(), Domain().

◆ UMin()

double cadex::Geom::Surface::UMin ( ) const

Returns a minimum parameter of a definition domain in U direction.

See also
UMax(), Domain().

◆ Value()

Point cadex::Geom::Surface::Value ( double theParameterU,
double theParameterV ) const

Evaluates a point on the surface.

theParameterU must be within [UMin(), UMax()] if the surface is not U-periodic. theParameterV must be within [VMin(), VMax()] if the surface is not V-periodic.

◆ VMax()

double cadex::Geom::Surface::VMax ( ) const

Returns a maximum parameter of a definition domain in V direction.

See also
VMin(), Domain().

◆ VMin()

double cadex::Geom::Surface::VMin ( ) const

Returns a minimum parameter of a definition domain in V direction.

See also
VMax(), Domain().