Defines a topological face. More...
#include <cadex/ModelData/Face.hxx>
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. | |
![]() | |
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 |
![]() | |
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 Face & | Cast (const Shape &theShape) |
Cast operator. | |
static Face & | Cast (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 bool | CompareType (const BaseObject &theObject) |
Check the type of object. Returns true if the specified object is this class type. | |
Additional Inherited Members | |
![]() | |
typedef std::shared_ptr< internal::BaseObjectImpl > | ImplType |
![]() | |
Shape (const ImplType &theImpl) | |
![]() | |
BaseObject (const ImplType &theImpl) | |
Defines a topological face.
The following image depicts an example of a 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 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 |
The following code snippet demonstrates how to iterate over face edges p-curves:
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:
cadex::ModelData::Face::Face | ( | const Geom::Surface & | Surface, |
bool | theMakeWire = false ) |
Constructor.
Creates a face on entire surface's definition domain:
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.
cadex::ModelData::Face::Face | ( | const Geom::Surface & | theSurface, |
const Wire & | theWire ) |
Constructor.
Creates a face from a surface and explicitly defined wire:
The wire's edge must lie on a surface (within proximity of their tolerances).
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.
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.
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 operator.
Casts theShape to a face. If theShape is not a face then behavior is undefined (assert will be thrown in debug mode).
Cast operator.
Casts theShape to a face. If theShape is not a face then behavior is undefined (assert will be thrown in debug mode).
IndexedTriangleSet cadex::ModelData::Face::Triangulation | ( | ) | const |
Returns triangulation of the face.
An empty object may be returned.