RobWorkProject  22.2.21-
Classes | Public Types | Public Member Functions | List of all members
QuadraticBREP Class Reference

A boundary representation where the geometry of a face is a QuadraticSurface, and an edge curve is a QuadraticCurve. More...

#include <QuadraticBREP.hpp>

Inherits BREP.

Classes

class  CommonQuadraticCurveSet
 Convenience type for a set of curves in a QuadraticBREP. More...
 

Public Types

typedef rw::core::Ptr< QuadraticBREPPtr
 Smart pointer type to QuadraticBREP.
 
- Public Types inherited from BREP
typedef rw::core::Ptr< BREPPtr
 Smart pointer type to BREP.
 
typedef rw::core::Ptr< const BREPCPtr
 Smart pointer type to const BREP.
 
- Public Types inherited from GeometryData
enum  GeometryType {
  PointCloud, LineMesh, PlainTriMesh, IdxTriMesh,
  SpherePrim, BoxPrim, OBBPrim, AABBPrim,
  LinePrim, PointPrim, PyramidPrim, ConePrim,
  TrianglePrim, CylinderPrim, TubePrim, PlanePrim,
  RayPrim, Implicit, Quadratic, UserType
}
 geometry data types
 
typedef rw::core::Ptr< GeometryDataPtr
 smart pointer type to this class
 

Public Member Functions

 QuadraticBREP ()
 Constructor.
 
virtual ~QuadraticBREP ()
 Destructor.
 
virtual GeometryType getType () const
 the type of this primitive More...
 
virtual const rw::geometry::QuadraticSurfacegetSurface (std::size_t surfaceIndex) const
 Get surface. More...
 
virtual const rw::geometry::QuadraticCurvegetCurve (std::size_t curveIndex) const
 Get curve. More...
 
virtual void scale (double factor)
 Scale the object. More...
 
QuadraticBREP::Ptr clone () const
 Make a deep copy of the BREP. More...
 
rw::core::Ptr< const QuadraticShellshellProxy () const
 Get a Shell representation as a proxy to the BREP. More...
 
rw::core::Ptr< PlainQuadraticShellshell () const
 Get a QuadraticShell representation by copying geometric information to a concrete PlainQuadraticShell object. More...
 
std::vector< rw::core::Ptr< rw::geometry::QuadraticCurve > > getCurves (std::size_t loopIdx) const
 Get the curves in a given loop. More...
 
CommonQuadraticCurveSet::CPtr getCommonCurves (const std::set< std::size_t > &faces) const
 Get a set of common curves between a set of faces. More...
 
void addEdge (const rw::geometry::QuadraticCurve &curve, std::size_t v1, std::size_t v2)
 Add a QuadraticCurve to the BREP. More...
 
void setFace (const rw::geometry::QuadraticSurface &surface, std::size_t loop)
 Attach a QuadraticSurface to a face of the BREP. More...
 
- Public Member Functions inherited from BREP
virtual ~BREP ()
 Destructor.
 
virtual rw::core::Ptr< TriMeshgetTriMesh (bool forceCopy=true)
 Create a TriMesh representation from this boundary representation. More...
 
virtual bool isConvex ()
 test if this geometry data is convex More...
 
virtual bool isConvex () const
 test if this geometry data is convex More...
 
BREP::Ptr clone () const
 Make a deep copy of the BREP. More...
 
rw::core::Ptr< const rw::geometry::ShellshellProxy () const
 Get a Shell representation as a proxy to the BREP. More...
 
std::vector< rw::core::Ptr< rw::geometry::Curve > > getCurves (std::size_t loopIdx) const
 Get the curves in a given loop. More...
 
CommonCurveSet::CPtr getCommonCurves (const std::set< std::size_t > &faces) const
 Get a set of common curves between a set of faces. More...
 
std::size_t faceCount () const
 The number of faces. More...
 
std::size_t loopCount () const
 The number of loops. More...
 
std::size_t edgeCount () const
 The number of edges. More...
 
std::size_t verticeCount () const
 The number of vertices. More...
 
const rw::math::Vector3D< double > & getVertex (std::size_t vertexIndex) const
 Get vertex. More...
 
std::vector< rw::math::Vector3D< double > > getVertices (std::size_t loopIdx) const
 Get the vertices in a given loop. More...
 
bool hasSurfaceSet (std::size_t loop)
 Check if a certain loop has a surface set. More...
 
std::size_t getSurfaceIndex (std::size_t loop)
 Get the surface index of a loop. More...
 
rw::geometry::OBB obb (const rw::math::Rotation3D<> &R)
 Create Oriented Bounding Box with certain principal directions. More...
 
rw::geometry::OBB obb ()
 Create Oriented Bounding Box where the directions are estimated. More...
 
void addVertex (const rw::math::Vector3D< double > &point)
 Add a vertex to the BREP. More...
 
void makeLoop (int singleEdgeId)
 Create a loop containing a single edge (typically for circles and ellipses and similar). More...
 
template<typename T >
int makeLoop (T first, T second)
 Create a loop containing two edges. More...
 
template<typename T , typename... Args>
int makeLoop (T first, Args... args)
 Create a loop with a variable number of edges. More...
 
void stitchEdges (std::size_t first, std::size_t second)
 Connect two half-edges. More...
 
void stitchAuto (double eps)
 Try to stitch edges automatically. More...
 
rw::geometry::OBB faceOBB (std::size_t faceIndex)
 Create Oriented Bounding Box for a face. More...
 
rw::geometry::OBB edgeOBR (std::size_t edge) const
 Create Oriented Bounding Rectangle for an edge. More...
 
std::pair< double, double > faceExtremums (std::size_t faceIndex, const rw::math::Vector3D< double > &dir) const
 Find the extent of the surface along a specific direction. More...
 
rw::core::Ptr< rw::geometry::TriMeshfaceTriMesh (std::size_t faceIndex)
 Construct a Triangle Mesh for a face. More...
 
void setMeshResolution (double resolution=10)
 Set the resolution used for discretization in the getTriMesh and faceTriMesh functions. More...
 
virtual void print ()
 Print the structure of the BREP for debugging purposes.
 
- Public Member Functions inherited from GeometryData
virtual ~GeometryData ()
 Destructor.
 

Additional Inherited Members

- Static Public Member Functions inherited from GeometryData
static std::string toString (GeometryType type)
 format GeometryType to string More...
 
- Protected Member Functions inherited from BREP
 BREP ()
 Constructor.
 
void copyTopologyTo (BREP::Ptr brep) const
 Copy the topology of this BREP to another brep. More...
 
void addBREPEdge (std::size_t curveIndex, std::size_t vertex1, std::size_t vertex2)
 Add a edge (will insert a pair of half-edges). More...
 
void setBREPFace (std::size_t surfaceIndex, std::size_t loop)
 Attach a surface to a loop. More...
 
- Protected Attributes inherited from BREP
std::vector< Vertex * > _vertices
 The vertices in the BREP.
 
std::vector< std::pair< HalfEdge *, HalfEdge * > > _edges
 The half-edges in the BREP.
 
std::vector< Face * > _faces
 The faces in the BREP. A face is added for each loop constructed.
 
double _resolution
 Resolution used for discretization functions.
 

Detailed Description

A boundary representation where the geometry of a face is a QuadraticSurface, and an edge curve is a QuadraticCurve.

This implementation adds the geometry related to Quadrics, based on BREP which handles the topology.

To build a geometry composed of Quadratic surfaces and curves, follow the following procedure:

  1. Add all the needed vertices by using the addVertex function. Each vertex is given an index starting, increasing from zero.
  2. Add the edges with the addEdge function. An edge is added between two vertices using their vertex indexes. The edge requires a QuadraticCurve and two vertex indicies. Notice that the curve must have limits, such that it start in the first vertex and ends in the second vertex (the curve has a direction). Each edge is given an index, increasing from zero.
  3. Use the makeLoop function to form loops, based on the edges just added. The makeLoop takes an arbitrary number of edge indexes. Notice that makeLoop expects the edge indexing to start at 1, and supports negative indices to indicate direction of the edge. To form a loop, a list of these indexes is given, to form a counter clockwise loop of edges. Each loop is given a loop index, increasing from zero.
  4. Attach a QuadraticSurface to a loop, by using the setSurface function. Each surface is given an increasing surface index, starting from zero. Notice that this index is not necessarily the same as the loop index.

Together this forms a connected set of surfaces, curves and vertices, that forms a closed geometry. Functions are provided that makes it easy to search for various neighbouring primitives in the boundary representation.

It is also possible to retrieve a non-connected shell representation, either by making a PlainQuadraticShell with all information fully copied, or by using a the more lightweight shellProxy which retrieves its information from the underlying QuadraticBREP.

Member Function Documentation

◆ addEdge()

void addEdge ( const rw::geometry::QuadraticCurve curve,
std::size_t  v1,
std::size_t  v2 
)

Add a QuadraticCurve to the BREP.

Notice that the curve has direction. It is expected to have limits such that it starts in vertex v1 and end in v2.

Parameters
curve[in] curve to add.
v1[in] the start vertex.
v2[in] the end vertex.

◆ clone()

QuadraticBREP::Ptr clone ( ) const

Make a deep copy of the BREP.

Returns
a copy of the BREP.

◆ getCommonCurves()

CommonQuadraticCurveSet::CPtr getCommonCurves ( const std::set< std::size_t > &  faces) const

Get a set of common curves between a set of faces.

Parameters
faces[in] loop indexes for the faces to consider.
Returns
set of common curves as a CommonCurveSet.

◆ getCurve()

virtual const rw::geometry::QuadraticCurve& getCurve ( std::size_t  curveIndex) const
virtual

Get curve.

Parameters
curveIndex[in] index of the curve. Should be less than the number returned by edgeCount().
Returns
a reference to the curve.

Implements BREP.

◆ getCurves()

std::vector< rw::core::Ptr< rw::geometry::QuadraticCurve > > getCurves ( std::size_t  loopIdx) const

Get the curves in a given loop.

The curves will be traversed in an ordered way, and curves will have a direction that leads to the next curve.

Parameters
loopIdx[in] the loop index.
Returns
an ordered vector of curves.

◆ getSurface()

virtual const rw::geometry::QuadraticSurface& getSurface ( std::size_t  surfaceIndex) const
virtual

Get surface.

Parameters
surfaceIndex[in] the index of the surface. Should be less than the number returned by size().
Returns
a reference to the surface.

Implements BREP.

◆ getType()

virtual GeometryType getType ( ) const
virtual

the type of this primitive

Implements BREP.

◆ scale()

virtual void scale ( double  factor)
virtual

Scale the object.

Parameters
factor[in] the factor to scale with.

Implements BREP.

◆ setFace()

void setFace ( const rw::geometry::QuadraticSurface surface,
std::size_t  loop 
)

Attach a QuadraticSurface to a face of the BREP.

Parameters
surface[in] surface to add.
loop[in] the loop index for the loop to attach surface to.

◆ shell()

rw::core::Ptr< PlainQuadraticShell > shell ( ) const

Get a QuadraticShell representation by copying geometric information to a concrete PlainQuadraticShell object.

Returns
smart pointer to a PlainQuadraticShell object.

◆ shellProxy()

rw::core::Ptr< const QuadraticShell > shellProxy ( ) const

Get a Shell representation as a proxy to the BREP.

Returns
smart pointer to a Shell proxy object.

The documentation for this class was generated from the following file: