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

Defines a topological face. More...

#include <cadex/ModelData/Face.hxx>

Inheritance diagram for cadex::ModelData::Face:
cadex::ModelData::Shape cadex::BaseObject

Public Member Functions

 Face (const Geom::Surface &theSurface, bool theMakeWire=false)
 Constructor.
 
 Face (const Geom::Surface &theSurface, const Wire &theWire)
 Constructor.
 
 Face (const Geom::Surface &theSurface, double theUMin, double theUMax, double theVMin, double theVMax)
 Constructor.
 
void ParametricDomain (double &theUMin, double &theUMax, double &theVMin, double &theVMax) const
 
bool Append (const Wire &theWire)
 Adds a wire to the face.
 
bool Append (const std::vector< Wire > &theWires)
 Adds a wires to the face.
 
Geom::Surface Surface () const
 Returns underlying surface.
 
Wire OuterWire () const
 Returns outer wire.
 
IndexedTriangleSet Triangulation () const
 Returns triangulation of the face.
 
- Public Member Functions inherited from cadex::ModelData::Shape
ShapeType Type () const
 Returns a shape type. For a null object returns Undefined.
 
ShapeOrientation Orientation () const
 Returns orientation flag.
 
Shape Reversed () const
 Returns a shape that shares the same geometry and subshape graph but has opposite orientation.
 
Shape Oriented (ShapeOrientation theOrientation) const
 Returns a shape that shares the same geometry and subshape graph and has specified orientation.
 
bool IsEqual (const Shape &theOther) const
 Returns true if the shape shares the same geometry and subshape graph, and has equal orientation.
 
bool IsSame (const Shape &theOther) const
 Returns true if the shape shares the same geometry and subshape graph.
 
void SetName (const UTF16String &theName)
 
UTF16String Name () 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 const FaceCast (const Shape &theShape)
 Cast operator.
 
static FaceCast (Shape &theShape)
 Cast operator.
 
static bool CompareType (const BaseObject &theObject)
 Check the type of object. Returns true if the specified object is this class type.
 
- Static Public Member Functions inherited from cadex::ModelData::Shape
static bool CompareType (const BaseObject &theObject)
 Check the type of object. Returns true if the specified object is this class type.
 

Additional Inherited Members

- Public Types inherited from cadex::BaseObject
typedef std::shared_ptr< internal::BaseObjectImpl > ImplType
 
- Protected Member Functions inherited from cadex::ModelData::Shape
 Shape (const ImplType &theImpl)
 
- Protected Member Functions inherited from cadex::BaseObject
 BaseObject (const ImplType &theImpl)
 

Detailed Description

Defines a topological face.

The following image depicts an example of a face:

Face

Face resides on a geometrical surface (returned by Surface()) and is bounded by one or several wires. A face must always have at least one explicit outer wire even if it corresponds to a naturally bounded surface (e.g. torus or a sphere).

Orientation() defines whether face normal matches the normal of the underlying surface, or is opposite to it.

Face Boundaries

Face wires must always be closed, both in 3D and in 2D (i.e. parametric space of the underlying surface). Therefore a face lying on a periodical surface on its full period must have an explicit seam-edge (an edge corresponding to surface boundaries).

A face outer wire can be distinguished using the OuterWire() method.

Face wires must be oriented such that they define a closed portion of material. If to look in the direction opposite to a surface normal, p-curves of an outer wire (taking into account edge orientations) must be oriented counter-clockwise, and p-curve of inner wires (if present) - clockwise. This ensures that the face has a finite area.

The following image depicts an example of face with two wires and p-curves in parametric space of the face surface. P-curves of edges with forward orientation are displayed in green, p-curves of edges with reversed orientation are displayed in red:

Face with two wires
P-curves in surface parametric space
Note
Own face orientation must be ignored when defining correct contour orientation (unlike, for instance, ACIS or Parasolid kernels which do take face orientation into account).

The following code snippet demonstrates how to iterate over face edges p-curves:

// always use forward orientation when analyzing pcurves orientation
ModelData::Face aFwdFace = ModelData::Face::Cast (aFace.Oriented (ModelData::ShapeOrientation::Forward));
ModelData::Wire anOuterWire = aFwdFace.OuterWire();
while (i.HasNext()) {
const ModelData::Shape& aWire = i.Next(); // wire
assert (aWire.Type() == ModelData::ShapeType::Wire);
if (aWire.IsSame (anOuterWire)) {
// we are exploring an outer wire
} else {
// we are exploring a hole
}
while (j.HasNext()) {
const ModelData::Shape& aShape = j.Next(); // edge
const ModelData::Edge& anEdge = ModelData::Edge::Cast (aShape);
double aF, aL;
Geom::Curve2d aPCurve = anEdge.PCurve (aFwdFace, aF, aL);
if (anEdge.Orientation() == ModelData::ShapeOrientation::Forward) {
// face material is on the left from the pcurve
} else {
// face material is on the right from the pcurve
}
}
}
Base class for 2D curves.
Definition Curve2d.hxx:40
Defines an edge.
Definition Edge.hxx:33
Geom::Curve2d PCurve(const Face &theFace, double &theFirstParameter, double &theLastParameter) const
Returns edge p-curve on a face and its limits.
Definition Edge.cxx:633
static const Edge & Cast(const Shape &theShape)
Casts a base class object to Edge.
Definition Edge.cxx:705
Defines a topological face.
Definition Face.hxx:33
static const Face & Cast(const Shape &theShape)
Cast operator.
Definition Face.cxx:339
Wire OuterWire() const
Returns outer wire.
Definition Face.cxx:317
Base class of topological shapes.
Definition Shape.hxx:32
bool IsSame(const Shape &theOther) const
Returns true if the shape shares the same geometry and subshape graph.
Definition Shape.cxx:307
ShapeOrientation Orientation() const
Returns orientation flag.
Definition Shape.cxx:256
Shape Oriented(ShapeOrientation theOrientation) const
Returns a shape that shares the same geometry and subshape graph and has specified orientation.
Definition Shape.cxx:280
ShapeType Type() const
Returns a shape type. For a null object returns Undefined.
Definition Shape.cxx:244
Iterates over subshapes in a shape.
Definition ShapeIterator.hxx:32
Defines a connected set of edges.
Definition Wire.hxx:32

2D Bounding Box

Face p-curves define a closed contour (or a set of contours in the case of face with holes) in surface parametric space. A 2D bounding box in this surface parametric space can be returned using the Measurements::ComputeBoundingBox() method (its overload accepting ModelData::Face). The following images demonstrate a face lying on a cylindrical surface and its 2D contour and bounding box:

Face on cylindrical surface
2D bounding box

The following example demonstrates how to retrieve this bounding box. Note aHeight below would designate a 3D length of this cylindrical face and if it occupied entire U-range of the cylindrical surface (Geom::CylindricalSurface) then it would correspond to a cylinder's height:

Measurements::ComputeBoundingBox(aFace, Geom::Transformation(), aBox);
double aHeight = aBox.YRange(); // cylindrical surface is parametrized by length in V-range
Defines a transformation matrix.
Definition Transformation.hxx:33
Defines a 3D axis-aligned bounding box.
Definition Box.hxx:30
double YRange() const
Returns the length of range along Y axis.
Definition Box.cxx:218

Constructor & Destructor Documentation

◆ Face() [1/3]

cadex::ModelData::Face::Face ( const Geom::Surface & Surface,
bool theMakeWire = false )

Constructor.

Creates a face on entire surface's definition domain:

Constructing face from surface

The surface must have bounded definition domain (see ModelData::Surface::Domain()). This is the case for instance for Geom::BSplineSurface.

theMakeWire specifies whether the wire must be automatically constructed and added to the face.

◆ Face() [2/3]

cadex::ModelData::Face::Face ( const Geom::Surface & theSurface,
const Wire & theWire )

Constructor.

Creates a face from a surface and explicitly defined wire:

Constructing face from surface and wire

The wire's edge must lie on a surface (within proximity of their tolerances).

◆ Face() [3/3]

cadex::ModelData::Face::Face ( const Geom::Surface & theSurface,
double theUMin,
double theUMax,
double theVMin,
double theVMax )

Constructor.

Creates a face from a surface and its parametric definition domain:

Input surface
Surface definition domain

The parameters must be within surface's definition domain (see ModelData_Surface::Domain()) unless it is periodic. theUMax must be greater than theUMin by at least 1e-9.

Member Function Documentation

◆ Append() [1/2]

bool cadex::ModelData::Face::Append ( const std::vector< Wire > & theWires)

Adds a wires to the face.

There must be single outer wire and zero, one or more inner wires (i.e. holes). It is strongly recommended (although not required) that the first wire being added is an outer wire.

Returns false if one of the theWires is null and true otherwise.

◆ Append() [2/2]

bool cadex::ModelData::Face::Append ( const Wire & theWire)

Adds a wire to the face.

There must be single outer wire and zero, one or more inner wires (i.e. holes). It is strongly recommended (although not required) that the first wire being added is an outer wire.

Returns false if theWire is null and true otherwise.

◆ Cast() [1/2]

const Face & cadex::ModelData::Face::Cast ( const Shape & theShape)
static

Cast operator.

Casts theShape to a face. If theShape is not a face then behavior is undefined (assert will be thrown in debug mode).

◆ Cast() [2/2]

Face & cadex::ModelData::Face::Cast ( Shape & theShape)
static

Cast operator.

Casts theShape to a face. If theShape is not a face then behavior is undefined (assert will be thrown in debug mode).

◆ Triangulation()

IndexedTriangleSet cadex::ModelData::Face::Triangulation ( ) const

Returns triangulation of the face.

An empty object may be returned.