CAD Exchanger SDK
cadex::ModelData_Surface Class Reference

Base class for geometrical surfaces. More...

Inheritance diagram for cadex::ModelData_Surface:
cadex::ModelData_BezierSurface cadex::ModelData_BSplineSurface cadex::ModelData_ElementarySurface cadex::ModelData_OffsetSurface cadex::ModelData_RectangularTrimmedSurface cadex::ModelData_SweptSurface cadex::ModelData_ConicalSurface cadex::ModelData_CylindricalSurface cadex::ModelData_Plane cadex::ModelData_SphericalSurface cadex::ModelData_ToroidalSurface cadex::ModelData_SurfaceOfLinearExtrusion cadex::ModelData_SurfaceOfRevolution

Public Member Functions

 ModelData_Surface ()
 Constructor.
 
 ModelData_Surface (const ModelData_Surface &theOther)
 Constructor.
 
 ModelData_Surface (ModelData_Surface &&theOther)
 Constructor.
 
 ~ModelData_Surface ()
 Destructor.
 
ModelData_Surfaceoperator= (const ModelData_Surface &theOther)
 Assignment operator.
 
ModelData_Surfaceoperator= (ModelData_Surface &&theOther)
 Move assignment operator.
 
 operator const Handle_C & () const
 Cast operator.
 
ModelData_SurfaceType Type () const
 Returns a surface type.
 
bool IsNull () const
 Returns true if the object has not been initialized yet.
 
 operator bool () const
 
bool IsUPeriodic () const
 Returns true if the surface is periodic in U direction. More...
 
bool IsVPeriodic () const
 Returns true if the surface is periodic in V direction. More...
 
double UMin () const
 Returns a minimum parameter of a definition domain in U direction. More...
 
double UMax () const
 Returns a maximum parameter of a definition domain in U direction. More...
 
double VMin () const
 Returns a minimum parameter of a definition domain in V direction. More...
 
double VMax () const
 Returns a maximum parameter of a definition domain in V direction. More...
 
void Domain (double &theUMin, double &theUMax, double &theVMin, double &theVMax) const
 Returns a definition domain. More...
 
ModelData_Point Value (double theParameterU, double theParameterV) const
 Evaluates a point on the surface. More...
 
void Transform (const ModelData_Transformation &theTransformation)
 Applies transformation matrix to this object. More...
 
ModelData_Surface Transformed (const ModelData_Transformation &theTransformation) const
 Returns a copy this object after applying transformation. More...
 
ModelData_Continuity Continuity () const
 Returns a continuity type of the surface.
 
void D0 (double theParameterU, double theParameterV, ModelData_Point &theValue) const
 Returns the point theValue of parameter theU, theV on the surface. More...
 
void D1 (double theParameterU, double theParameterV, ModelData_Point &theValue, ModelData_Vector &theD1U, ModelData_Vector &theD1V) const
 Returns the point theValue and the first derivatives in the directions U theD1U and V theD1V at this point. More...
 
void D2 (double theParameterU, double theParameterV, ModelData_Point &theValue, ModelData_Vector &theD1U, ModelData_Vector &theD1V, ModelData_Vector &theD2U, ModelData_Vector &theD2V, ModelData_Vector &theD2UV) const
 Returns the point theValue, the first and the second derivatives in the directions U and V at this point. More...
 
bool DN (double theParameterU, double theParameterV, size_t theDerivativeOrder, ModelData_Point &theValue, ModelData_Vector theD[]) const
 
void Curvature (double theParameterU, double theParameterV, ModelData_Vector &thePrincipalMaxDirection, ModelData_Vector &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, ModelData_Direction &thePrincipalMaxDirection, ModelData_Direction &thePrincipalMinDirection, double &theMaxCurvature, double &theMinCurvature) const
 Returns the max and min principal curvature directions and their values.
 
void Normal (double theParameterU, double theParameterV, ModelData_Direction &theNormal) const
 Returns the normal direction theNormal at the current point.
 
void Mirror (const ModelData_Point &thePoint)
 Mirrors the surface relative to the point.
 
void Mirror (const ModelData_Axis1Placement &theAxis)
 Mirrors the surface relative to the axis placement.
 
void Mirror (const ModelData_Axis2Placement &theAxis)
 Mirrors the surface relative to the axis placement.
 
template<typename T >
ModelData_Surface Mirrored (const T &theRef) const
 
void Rotate (const ModelData_Axis1Placement &theAxis, double theAngle)
 Rotates the surface around the axis.
 
ModelData_Surface Rotated (const ModelData_Axis1Placement &theAxis, double theAngle)
 
void Translate (const ModelData_Vector &theVector)
 Translates the surface along the vector.
 
ModelData_Surface Translated (const ModelData_Vector &theVector)
 
void Scale (const ModelData_Point &thePoint, double theScale)
 Scales the surface with respect to the point.
 
ModelData_Surface Scaled (const ModelData_Point &thePoint, double theScale)
 

Protected Member Functions

 ModelData_Surface (const Handle_C &, ModelData_SurfaceType)
 Constructor.
 
internal::ModelData_SurfaceImpl & Impl ()
 Returns internal implementation object.
 

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:

ModelData_Surface aSurface = ...;
if (aSurface.Type() == ModelData_ST_Cylinder) {
const ModelData_CylindricalSurface& aCylSurf = static_cast<const ModelData_CylindricalSurface&> (aSurface);
double aRadius = aCylSurf.Radius();
...
}

Parametric Definition

Surface is defined using parametric definition as S(u,v) where S is a 3D radius-vector (x,y,z) and u, v are parameters from a definition domain [u_min, u_max; v_min, v_max].

UMin(), UMax() and VMin(), VMax(), and Domain() return parametric definition range. Parametric range can be bounded (e.g. [0, 1; 0, 1] for Bezier surface), unbounded (e.g. (-infinity, + infinity; -infinity, + infinity) for a plane), or semi-unbounded (e.g. [0, 2 * PI; -infinity, + infinity) 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=PI/4, V=PI/6:

ModelData_CylindricalSurface aSphere = ...;
ModelData_Point aPoint = aSphere.Value (M_PI / 4, M_PI / 6);

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:

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, ModelData_Curve, ModelData_Face.
Examples:
exploring/breprepresentation/main.cxx.

Member Function Documentation

◆ D0()

void cadex::ModelData_Surface::D0 ( double  theU,
double  theV,
ModelData_Point theValue 
) const

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

Throws exception only for the ModelData_OffsetSurface if it is not possible to compute the current point.

◆ D1()

void cadex::ModelData_Surface::D1 ( double  theU,
double  theV,
ModelData_Point theValue,
ModelData_Vector theD1U,
ModelData_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::ModelData_Surface::D2 ( double  theU,
double  theV,
ModelData_Point theValue,
ModelData_Vector theD1U,
ModelData_Vector theD1V,
ModelData_Vector theD2U,
ModelData_Vector theD2V,
ModelData_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::ModelData_Surface::DN ( double  theU,
double  theV,
size_t  theDerivativeOrder,
ModelData_Point theValue,
ModelData_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::ModelData_Surface::Domain ( double &  theUMin,
double &  theUMax,
double &  theVMin,
double &  theVMax 
) const

Returns a definition domain.

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

◆ IsUPeriodic()

bool cadex::ModelData_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::ModelData_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::ModelData_Surface::Transform ( const ModelData_Transformation theTransformation)

Applies transformation matrix to this object.

Results depends on the actual surface type.

See also
Transformed().

◆ Transformed()

ModelData_Surface cadex::ModelData_Surface::Transformed ( const ModelData_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::ModelData_Surface::UMax ( ) const

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

See also
UMin(), Domain().

◆ UMin()

double cadex::ModelData_Surface::UMin ( ) const

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

See also
UMax(), Domain().

◆ Value()

ModelData_Point cadex::ModelData_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::ModelData_Surface::VMax ( ) const

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

See also
VMin(), Domain().

◆ VMin()

double cadex::ModelData_Surface::VMin ( ) const

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

See also
VMax(), Domain().