Skip to main content

BrepFace

The BrepFace class represents a single face within a brep model, supporting various types of geometric surfaces. Each face is characterized by its geometry, material, curves, vertices, and specific properties such as radius, angle, and wrap parameters depending on the type of surface.

#include <format/TellusimBrep.h>

Constructors

explicit BrepFace(const char *name = nullptr)
explicit BrepFace(Type type, const char *name = nullptr)
explicit BrepFace(Type type, BrepGeometry &geometry, const char *name = nullptr)

Methods

Clear face.

void clear()

Face type.

void setType(Type type)
Type getType() const
static const char *getTypeName(Type type)
const char *getTypeName() const
bool isUnknown() const
bool isPlane() const
bool isSphere() const
bool isCylinder() const
bool isCone() const
bool isTorus() const
bool isLemon() const
bool isRevolve() const
bool isExtrude() const
bool isSurface() const
bool hasPhi() const
bool hasTheta() const
bool hasVertices() const
static bool isRevolve(Type type)
static bool isExtrude(Type type)
static bool isSurface(Type type)

Face name.

void setName(const char *name)
String getName() const

Face winding.

void setWinding(float64_t winding)
float64_t getWinding() const

Face geometry.

void setGeometry(BrepGeometry &geometry)
const BrepGeometry getGeometry() const
BrepGeometry getGeometry()

Face material.

void setMaterial(BrepMaterial &material)
const BrepMaterial getMaterial() const
BrepMaterial getMaterial()

Face curves.

void clearCurves()
void reserveCurves(uint32_t num_curves)
uint32_t addCurve(BrepCurve &curve)
bool removeCurve(BrepCurve &curve)
uint32_t findCurve(const BrepCurve &curve) const
uint32_t getNumCurves() const
const Array<BrepCurve> getCurves() const
Array<BrepCurve> getCurves()
const BrepCurve getCurve(uint32_t index) const
BrepCurve getCurve(uint32_t index)

Face vertices.

void clearVertices()
void setNumVertices(uint32_t num_vertices)
void reserveVertices(uint32_t num_vertices)
uint32_t getNumVertices() const
void setVertices(const Vector3d *vertices, uint32_t num_vertices)
const Vector3d *getVertices() const
Vector3d *getVertices()
void setVertex(uint32_t index, Vector3d vertex)
const Vector3d getVertex(uint32_t index) const
Vector3d getVertex(uint32_t index)
uint32_t addVertex(Vector3d vertex)
uint32_t addVertices(Vector3d v0, Vector3d v1)
uint32_t addVertices(Vector3d v0, Vector3d v1, Vector3d v2)
uint32_t addVertices(Vector3d v0, Vector3d v1, Vector3d v2, Vector3d v3)

Sphere parameters.

void setSphereRadius(float64_t radius)
float64_t getSphereRadius() const

Cylinder parameters.

void setCylinderRadius(float64_t radius)
float64_t getCylinderRadius() const

Cone parameters.

void setConeAngle(float64_t angle)
float64_t getConeAngle() const
void setConeRadius(float64_t radius)
float64_t getConeRadius() const

Torus parameters.

void setTorusMajorRadius(float64_t radius)
float64_t getTorusMajorRadius() const
void setTorusMinorRadius(float64_t radius)
float64_t getTorusMinorRadius() const

Lemon parameters.

void setLemonMajorRadius(float64_t radius)
float64_t getLemonMajorRadius() const
void setLemonMinorRadius(float64_t radius)
float64_t getLemonMinorRadius() const

Revolve parameters.

uint32_t getRevolveDegree() const
void setRevolveWrap(float64_t wrap)
float64_t getRevolveWrap() const
Vector3d getRevolveVertex(float64_t x, float64_t y) const

Extrude parameters.

uint32_t getExtrudeDegree() const
void setExtrudeWrap(float64_t wrap)
float64_t getExtrudeWrap() const
void setExtrudeDirection(Vector3d direction)
Vector3d getExtrudeDirection() const
Vector3d getExtrudeVertex(float64_t x, float64_t y) const

Surface parameters.

uint32_t getSurfaceDegreeX() const
uint32_t getSurfaceDegreeY() const
void setSurfaceWidth(uint32_t width)
uint32_t getSurfaceWidth() const
void setSurfaceHeight(uint32_t height)
uint32_t getSurfaceHeight() const
void setSurfaceWrap(Vector2d wrap)
Vector2d getSurfaceWrap() const
Vector3f getSurfaceVertex(float64_t x, float64_t y) const
Vector3f getSurfaceVertex(float64_t x, float64_t y, Vector3f tangent, Vector3f binormal) const

Trim surface geometry.

void trimSurface(float64_t border = 1e-3)

Project points to parametric coordinates.

bool projectPoints(Vector2d *pcoords, const Vector3d *points, uint32_t num) const
Vector2d projectPoint(Vector3d point) const

Unproject parametric coordinates to points.

bool unprojectPoints(Vector3d *points, const Vector2d *pcoords, uint32_t num) const
Vector3d unprojectPoint(Vector2d pcoord) const

Signed distance to the closest curve.

float64_t getDistanceX(Vector2d pcoord, float64_t epsilon = 1e-6) const
float64_t getDistanceY(Vector2d pcoord, float64_t epsilon = 1e-6) const

Face bound rect.

void setBoundRect(BoundRectd rect)
const BoundRectd getBoundRect() const

Face bound circle.

void setBoundCircle(BoundCircled circle)
const BoundCircled getBoundCircle() const

Face bound box.

void setBoundBox(BoundBoxd box)
const BoundBoxd getBoundBox() const

Face bound sphere.

void setBoundSphere(BoundSphered sphere)
const BoundSphered getBoundSphere() const

Face transform.

void setTransform(float64_t scale)
void setTransform(Matrix4x3d transform)
void setTransform(Matrix4x3d transform, Matrix4x3d itransform)
const Matrix4x3d getTransform() const
const Matrix4x3d getITransform() const

Create wrap curve.

BrepCurve createWrapCurve(Vector2d wrap, float64_t epsilon = 1e-6) const

Wrap curve vertices.

void wrapCurves(Vector2d wrap, float64_t epsilon = 1e-6)

Optimize curve vertices.

void optimizeCurves(float64_t epsilon = 1e-6)

Signed curves area.

float64_t getCurvesArea() const

Create bounds.

bool createBounds(bool force = false, bool clear = true, uint32_t steps = 8, float64_t epsilon = 1e-6)

Compare faces.

int32_t compare(const BrepFace &face, Matrix4x3d transform = Matrix4x3d::identity, float64_t threshold = 1e-6, bool spatial = true) const

Memory usage.

size_t getMemory() const

Enums

Type

Face types.

NameValueDescription
TypeUnknown0
TypePlane1Place face.
TypeSphere2Sphere face.
TypeCylinder3Cylinder face.
TypeCone4Cone face.
TypeTorus5Torus face.
TypeLemon6Lemon face.
TypeRevolve171st degree revolve face.
TypeRevolve282nd degree revolve face.
TypeRevolve393rd degree revolve face.
TypeExtrude1101st degree extrude face.
TypeExtrude2112nd degree extrude face.
TypeExtrude3123rd degree extrude face.
TypeSurface1x1131x1 degree surface face.
TypeSurface1x2141x2 degree surface face.
TypeSurface1x3151x3 degree surface face.
TypeSurface2x1162x1 degree surface face.
TypeSurface2x2172x2 degree surface face.
TypeSurface2x3182x3 degree surface face.
TypeSurface3x1193x1 degree surface face.
TypeSurface3x2203x2 degree surface face.
TypeSurface3x3213x3 degree surface face.
NumTypes22
BaseTypeOffsetTypePlane
WrapTypeOffsetTypeExtrude1
NumBaseTypes(NumTypes - BaseTypeOffset)
NumWrapTypes(NumTypes - WrapTypeOffset)