C3D Toolkit  Kernel - 117982, Vision - 2.9.2.2

Triangulation. More...

#include <mesh_primitive.h>

+ Inheritance diagram for MbGrid:
+ Collaboration diagram for MbGrid:

Public Member Functions

virtual ~MbGrid ()
 Destructor.
 
double DistanceToPoint (const MbCartPoint3D &pnt, size_t &ind) const
 Calculate distance to point. More...
 
double DistanceToLine (const MbAxis3D &axis, double extDistance, double &t, c3d::IndicesPair &tqInd) const
 Calculate the distance to an axis. More...
 
bool IsSearchTreeReady () const
 Whether is elements search tree ready.
 
bool CreateSearchTree (size_t leafElemCount=100) const
 Create elements search tree.
 
void DeleteSearchTree () const
 Delete elements search tree.
 
bool FindIntersectingElementsByCubesTree (const MbAxis3D &ray, c3d::IndicesVector &triIndices, c3d::IndicesVector &quadIndices, double eps=METRIC_EPSILON) const
 Find indices of triangles and quadrangles potentially intersecting with a ray. More...
 
double FindNearest (const MbCartPoint3D &pnt, MbCartPoint3D &pntProj, c3d::IndicesPair &tqInd) const
 Find index of triangle or quadrangle which is closest to a point. More...
 
bool FindIntersectingElements (const MbAxis3D &ray, c3d::IndicesVector &triIndices, c3d::IndicesVector &quadIndices, double eps=METRIC_EPSILON) const
 Find indices of triangles and quadrangles intersecting with a ray. More...
 
Common functions of primitive.
MbePrimitiveType Type () const override
 Get the object type.
 
virtual double DistanceToPoint (const MbCartPoint3D &) const override
 Calculate distance to point.

 
virtual double DistanceToLine (const MbAxis3D &, double extDistance, double &t) const override
 Calculate the distance to the axis.

 
Functions of triangulation.
bool IsComplete () const
 Check data availability.
 
virtual size_t PointsCount () const =0
 Get the number of points.
 
virtual size_t NormalsCount () const =0
 Get the number of normals.
 
virtual size_t ParamsCount () const =0
 Get the number of parameters.
 
virtual size_t EscortsCount () const =0
 Get count of values.
 
virtual ptrdiff_t PointsMaxIndex () const =0
 Get the number of points minus one (maximal index).
 
virtual ptrdiff_t NormalsMaxIndex () const =0
 Get the number of normals minus one (maximal index).
 
virtual ptrdiff_t ParamsMaxIndex () const =0
 Get the number of parameters minus one (maximal index).
 
size_t TrianglesCount () const
 Get the number of triangles.
 
size_t QuadranglesCount () const
 Get the number of quadrangles.
 
size_t LoopsCount () const
 Get the number of loops.
 
virtual void AddPoint (const MbCartPoint &p2D, const MbCartPoint3D &p3D, const MbVector3D &n3D)=0
 Add parameters, point and normal of triangulated surface at point to triangulation.
 
virtual void AddPoint (const MbCartPoint &p2D, const MbCartPoint3D &p3D)=0
 Add parameters and a point to triangulation.
 
virtual void AddPoint (const MbCartPoint3D &p3D, const MbVector3D &n3D)=0
 Add a point and normal at the point to triangulation.
 
virtual void AddPoint (const MbCartPoint3D &p3D)=0
 Add a point to triangulation.
 
virtual void AddNormal (const MbVector3D &n3D)=0
 Add a normal to triangulation.
 
virtual void AddParam (const MbCartPoint &p2D)=0
 Add parameters of triangulated surface to triangulation.
 
virtual void AddPoint (const MbFloatPoint &p2D, const MbFloatPoint3D &p3D, const MbFloatVector3D &n3D)=0
 Add parameters, point and normal of triangulated surface at point to triangulation.
 
virtual void AddPoint (const MbFloatPoint &p2D, const MbFloatPoint3D &p3D)=0
 Add parameters and a point to triangulation.
 
virtual void AddPoint (const MbFloatPoint3D &p3D, const MbFloatVector3D &n3D)=0
 Add a point and normal at the point to triangulation.
 
virtual void AddPoint (const MbFloatPoint3D &p3D)=0
 Add a point to triangulation.
 
virtual void AddNormal (const MbFloatVector3D &n3D)=0
 Add a normal to triangulation.
 
virtual void AddParam (const MbFloatPoint &p2D)=0
 Add parameters of triangulated surface to triangulation.
 
template<class PointsVector >
void AddPoints (const PointsVector &pnts)
 Add points to triangulation.
 
template<class NormalsVector >
void AddNormals (const NormalsVector &norms)
 Add normals to triangulation.
 
template<class ParamsVector >
void AddParams (const ParamsVector &pars)
 Add parameters of triangulated surface to triangulation.
 
template<class TrianglesVector >
void AddTriangles (const TrianglesVector &trngs)
 Add objects to triangulation.
 
template<class QuadranglesVector >
void AddQuadrangles (const QuadranglesVector &qrngs)
 Add objects to triangulation.
 
virtual void AddEscorts (const std::vector< uint32 > &scores)=0
 Add scores to collection.
 
virtual void AddColor (float r, float g, float b, float a)=0
 Add color as an additional information of point (0 <= r,g,b,a <= 1). More...
 
virtual void GetPoint (size_t i, MbCartPoint3D &p) const =0
 Get point by its index.
 
virtual void GetNormal (size_t i, MbVector3D &n) const =0
 Get normal by its index.
 
virtual void GetParam (size_t i, MbCartPoint &p) const =0
 Get parameter by its index.
 
virtual const uint32 & GetEscort (size_t i) const =0
 Get additional information by its index.
 
virtual void GetPoint (size_t i, MbFloatPoint3D &p) const =0
 Get point by its index.
 
virtual void GetNormal (size_t i, MbFloatVector3D &n) const =0
 Get normal by its index.
 
virtual void GetParam (size_t i, MbFloatPoint &p) const =0
 Get parameter by its index.
 
virtual void SetPoint (size_t i, const MbCartPoint3D &p)=0
 Set point by the given index.
 
virtual void SetNormal (size_t i, const MbVector3D &n)=0
 Set normal by the given index.
 
virtual void SetParam (size_t i, const MbCartPoint &p)=0
 Set parameter by the given index.
 
virtual void SetEscort (size_t i, const uint32 &e)=0
 Set additional information by its index.
 
virtual void PointRemove (size_t i)=0
 Delete point by the given index.
 
virtual void NormalRemove (size_t i)=0
 Delete normal by the given index.
 
virtual void ParamRemove (size_t i)=0
 Delete parameters of surface by the given index.
 
void TriangleRemove (size_t k)
 Delete triangle by its index.
 
void QuadrangleRemove (size_t k)
 Delete quadrangle by its index.
 
void LoopRemove (size_t k)
 Delete polygon by its index.
 
virtual void PointsDelete ()=0
 Delete points.
 
virtual void NormalsDelete ()=0
 Delete normal.
 
virtual void ParamsDelete ()=0
 Delete params.
 
virtual void EscortsDelete ()=0
 Delete additional information.
 
void TrianglesDelete ()
 Delete all triangles.
 
void QuadranglesDelete ()
 Delete all quadrangles.
 
void LoopsDelete ()
 Delete all polygons.
 
virtual void NormalsInvert ()=0
 Invert normals.
 
void AddTriangle (const MbTriangle &triangle)
 Add a triangle.
 
void AddTriangle (uint j0, uint j1, uint j2, bool o)
 Add a triangle by the given indices of vertices.
 
void AddQuadrangle (const MbQuadrangle &quadrangle)
 Add a quadrangle.
 
void AddQuadrangle (uint j0, uint j1, uint j2, uint j3, bool o)
 Add a quadrangle by the given indices of vertices.
 
void AddGridLoop (MbGridLoop &poly)
 Add a polygon.
 
void CollectEdges (std::vector< c3d::UintPair > &edges) const
 Collect outer loops.
 
bool GetTrianglePointIndex (size_t i, uint &ind0, uint &ind1, uint &ind2) const
 Get indices of points in 'points' array for i-th triangle (adjacent or non-adjacent).
 
bool GetQuadranglePointIndex (size_t i, uint &ind0, uint &ind1, uint &ind2, uint &ind3) const
 Get indices of points in 'points' array for i-th quadrangle (adjacent or non-adjacent).
 
virtual bool GetTriangleParams (size_t i, MbCartPoint &r0, MbCartPoint &r1, MbCartPoint &r2) const =0
 
virtual bool GetTrianglePoints (size_t i, MbCartPoint3D &p0, MbCartPoint3D &p1, MbCartPoint3D &p2) const =0
 
virtual bool GetTrianglePoints (size_t i, MbFloatPoint3D &p0, MbFloatPoint3D &p1, MbFloatPoint3D &p2) const =0
 
virtual bool GetTriangleNormals (size_t i, MbVector3D &n0, MbVector3D &n1, MbVector3D &n2) const =0
 
virtual bool GetTriangleNormals (size_t i, MbFloatVector3D &n0, MbFloatVector3D &n1, MbFloatVector3D &n2) const =0
 
virtual bool GetQuadrangleParams (size_t i, MbCartPoint &r0, MbCartPoint &r1, MbCartPoint &r2, MbCartPoint &r3) const =0
 
virtual bool GetQuadranglePoints (size_t i, MbCartPoint3D &p0, MbCartPoint3D &p1, MbCartPoint3D &p2, MbCartPoint3D &p3) const =0
 
virtual bool GetQuadranglePoints (size_t i, MbFloatPoint3D &p0, MbFloatPoint3D &p1, MbFloatPoint3D &p2, MbFloatPoint3D &n3) const =0
 
virtual bool GetQuadrangleNormals (size_t i, MbVector3D &n0, MbVector3D &n1, MbVector3D &n2, MbVector3D &n3) const =0
 
virtual bool GetQuadrangleNormals (size_t i, MbFloatVector3D &n0, MbFloatVector3D &n1, MbFloatVector3D &n2, MbFloatVector3D &n3) const =0
 
virtual bool GetSingleNormal (MbVector3D &) const =0
 
virtual bool GetSingleNormal (MbFloatVector3D &) const =0
 
virtual void SynchronizeNormals ()=0
 If count of points is greater than count of normals, then add missing normals (only for planar triangulation).
 
virtual void NormalizeNormals ()=0
 Normalize normals.
 
const MbTriangleGetTriangle (size_t i) const
 Get i-th triangle.
 
const MbQuadrangleGetQuadrangle (size_t i) const
 Get i-th quadrangle.
 
const MbGridLoopGetGridLoop (size_t i) const
 Get i-th polygon.
 
bool GetTriangleIndex (size_t i, uint &i0, uint &i1, uint &i2) const
 Get indices of vertex points for i-th triangle.
 
bool GetQuadrangleIndex (size_t i, uint &i0, uint &i1, uint &i2, uint &i3) const
 Get indices of points of vertices for i-th quadrangle.
 
template<class Param , class ParamsVector >
void GetParams (ParamsVector &paramsVector) const
 Get the container of parameters.
 
template<class Point , class PointsVector >
void GetPoints (PointsVector &pointsVector) const
 Get the container of points.
 
template<class Normal , class NormalsVector >
void GetNormals (NormalsVector &normalsVector) const
 Get the container of normals.
 
template<class TrianglesVector >
void GetTriangles (TrianglesVector &tVector) const
 Get the container of triangles.
 
template<class QuadranglesVector >
void GetQuadrangles (QuadranglesVector &qVector) const
 Get the container of quadrangles.
 
void ConvertQuadranglesToTriangles ()
 Convert quadrangles to triangles.
 
void ConvertAllToTriangles ()
 Convert all objects to triangles and equalize count of points and count of normals.
 
bool FlipTriangle (size_t triIndex, size_t edgeIndex)
 Flip triangle around given edge.

 
virtual bool TriangleIntersectRect (size_t i, MbRect &rect) const =0
 Determine whether the projection of triangle with a given index to the global XY-plane intersects the given rectangle.
 
virtual void TriangleGetGabRect (size_t i, MbRect &rect) const =0
 Determine bounding box of the projection of triangle with given index to the global XY-plane.
 
virtual bool QuadrangleIntersectRect (size_t i, MbRect &rect) const =0
 Determine whether the projection of quadrangle with given index to the global XY-plane intersects the given rectangle.
 
virtual void QuadrangleGetGabRect (size_t i, MbRect &rect) const =0
 Determine bounding box of the projection of quadrangle with given index to the global XY-plane.
 
virtual void AddRect (MbRect &rect) const =0
 Extend given bounding box so that it enclose projection of this object to the global XY-plane.
 
virtual void AddCube (MbCube &r) const =0
 Extend given bounding box so that it encloses the given object.
 
virtual bool RemoveRedundantPoints (bool deleteNormals, double epsilon=LENGTH_EPSILON)=0
 Remove redundant points with a given tolerance (duplicates).
 
virtual MbeItemLocation GetLocation (const MbPlacement3D &pl, double eps, bool onlyInItem=false) const =0
 Define the object position relative to the plane. More...
 
virtual bool InsideLocation (const MbPlacement3D &place, MbRect &rect, double eps) const =0
 Determine the object position relative to the tube. More...
 
virtual void SetVista (const MbCartPoint3D &vista)=0
 Transform triangulation so that its parallel projection looks as the central projection observed from the given 'vista' point.
 
virtual void DeleteVista (const MbCartPoint3D &vista)=0
 Undo the transformation of triangulation for central projection observed from given 'vista' point.
 
virtual void ParamsReserve (size_t n)=0
 Reserve memory for container of elements.
 
virtual void PointsReserve (size_t n)=0
 Reserve memory for container of points.
 
virtual void NormalsReserve (size_t n)=0
 Reserve memory for container of normals.
 
virtual void EscordsReserve (size_t n)=0
 Reserve memory for container of elements.
 
void TrianglesReserve (size_t n)
 Reserve memory for container of triangles.
 
void QuadranglesReserve (size_t n)
 Reserve memory for container of quadrangles.
 
void LoopsReserve (size_t n)
 Reserve memory for container of loops.
 
virtual void ReserveParamsPoints (size_t n)=0
 Reserve memory for some containers.
 
virtual void ReservePointsNormals (size_t n)=0
 Reserve memory for some containers.
 
virtual void ReserveParamsPointsNormals (size_t n)=0
 Reserve memory for some containers.
 
virtual void Flush ()=0
 Delete all triangulation without freeing the memory occupied by containers.
 
virtual void HardFlush ()=0
 Delete all triangulation and free the memory.
 
virtual void Adjust ()=0
 Free the unnecessary memory.
 
virtual size_t SizeOf () const =0
 Get the size of taken memory.
 
virtual void Reverse ()=0
 Reverse the sequence of vertices of triangles and quadrilaterals.
 
virtual bool IsSame (const MbGrid &init, double eps) const =0
 Determine whether objects are equal.
 
const MbStepDataGetStepData () const
 Get the parameter of triangulation calculation.
 
void SetStepData (const MbStepData &stData)
 Set the parameter of triangulation calculation.
 
const MbCubeCube () const
 Return bounding box.
 
const MbCubeGetCube () const
 Return bounding box.
 
virtual void Init (const MbGrid &grid)=0
 
const MbTriangleGetTrianglesAddr () const
 Get the address of the beginning of the array.
 
const MbQuadrangleGetQuadranglesAddr () const
 Get the address of the beginning of the array.
 
virtual const MbCartPoint3DGetExactPointsAddr () const =0
 Get the address of the beginning of the array.
 
virtual const MbVector3DGetExactNormalsAddr () const =0
 Get the address of the beginning of the array.
 
virtual const MbCartPointGetExactParamsAddr () const =0
 Get the address of the beginning of the array.
 
virtual const MbFloatPoint3DGetFloatPointsAddr () const =0
 Get the address of the beginning of the array.
 
virtual const MbFloatVector3DGetFloatNormalsAddr () const =0
 Get the address of the beginning of the array.
 
virtual const MbFloatPointGetFloatParamsAddr () const =0
 Get the address of the beginning of the array.
 
- Public Member Functions inherited from MbPrimitive
virtual ~MbPrimitive ()
 Destructor.
 
virtual MbePrimitiveType IsA () const =0
 
MbeRefType RefType () const override
 Registration type (for copying, duplication).
 
virtual MbPrimitiveDuplicate (MbRegDuplicate *iReg=nullptr) const
 Create a copy of primitive. More...
 
virtual SPtr< MbPrimitiveClone (MbRegDuplicate *iReg=nullptr) const =0
 Create a copy of primitive. More...
 
virtual void Transform (const MbMatrix3D &matr)=0
 Transform primitive according to the matrix. More...
 
virtual void Move (const MbVector3D &to)=0
 Move primitive along a vector. More...
 
virtual void Rotate (const MbAxis3D &axis, double angle)=0
 Rotate primitive about an axis by a given angle. More...
 
MbeImplicationType ImplicationType () const override
 Get attribute container type.
 
virtual void AddYourGabaritTo (MbCube &r) const =0
 Extend given bounding box so that it encloses the given object.
 
virtual void GetProperties (MbProperties &)=0
 Get properties of the object.
 
virtual void SetProperties (const MbProperties &)=0
 Set properties of the object.
 
SimpleName GetPrimitiveName () const
 
void SetPrimitiveName (SimpleName n)
 
const MbNameGetName () const
 Get name of object.
 
MbNameSetName ()
 Get name of object for modification.
 
SimpleName GetFirstName () const
 Get first name.
 
SimpleName GetNameHash () const
 Get hash of name.
 
void SetName (const MbName &n)
 Set name.
 
const MbRefItemGetItem () const
 Get begetter object of primitive.
 
void SetItem (const MbRefItem *g)
 Set begetter object of primitive.
 
MbeRefType GetPrimitiveType () const
 Get type of object.
 
void SetPrimitiveType (MbeRefType t)
 Set type of object.
 
bool NearestType (MbeSpaceType sType, MbeTopologyType tType, MbePlaneType pType) const
 Does the primitive satisfy the nearest object search criteria?
 
const MbSpaceItemSpaceItem () const
 Get spatial object for which the primitive is constructed.
 
const MbPlaneItemPlaneItem () const
 Get two-dimensional object for which the primitive is constructed.
 
const MbTopItemTopItem () const
 Get the topological object for which the primitive is constructed.
 
const MbItemItem () const
 Get geometric model object for which the primitive is constructed.
 
void PrimitiveRead (reader &)
 Reading of primitive from the stream.

 
void PrimitiveWrite (writer &) const
 Writing of primitive to the stream.

 
- Public Member Functions inherited from MbAttributeContainer
 MbAttributeContainer ()
 Constructor without parameters.
 
 MbAttributeContainer (MbAttribute &)
 Constructor by attribute.
 
virtual ~MbAttributeContainer ()
 Destructor.
 
void AttributesRead (reader &)
 Read attributes from stream.
 
void AttributesWrite (writer &) const
 Writing attributes to stream.
 
void GetProperties (MbProperties &)
 Get properties of attributes.
 
void SetProperties (const MbProperties &)
 Set properties of attributes.
 
void SetDensity (double)
 Set density of an object.
 
double GetDensity () const
 Get density of an object.
 
void SetVisual (float a, float d, float sp, float sh, float t, float e, uint rgb=0)
 Set visual properties of the object.
 
void SetVisual (const MbRGBA &ambient, const MbRGBA &diffuse, const MbRGBA &specular, const MbRGBA &emission, uint8 shininess, uint8 opacity, uint8 chrom)
 Set visual properties of the object.
 
bool GetVisual (float &a, float &d, float &sp, float &sh, float &t, float &e, uint rgb=0) const
 Get visual properties of the object. More...
 
bool IsColored () const
 
void SetColor (uint32)
 Change color of the object.

 
void SetColor (int R, int G, int B)
 Change color of the object (0-255).
 
uint32 GetColor () const
 Get color of an object.
 
void SetWidth (int)
 Set thickness of lines for object's representation.
 
int GetWidth () const
 Get thickness of lines for object's representation.
 
void SetStyle (int)
 Set style of lines for object's representation.
 
int GetStyle () const
 Get style of lines for object's representation.
 
void SetSelected (bool s=true)
 To allocate or not to allocate an object.
 
bool IsSelected () const
 Is the object selected.
 
bool ReverseSelected ()
 Invert object selection.
 
void SetChanged (bool c=true)
 Set: the object is changed or isn't changed.
 
bool IsChanged () const
 Is the object changed?
 
void SetVisible (bool)
 Set visibility.

 
bool IsVisible () const
 Is the object visible?
 
bool IsInvisible () const
 Is the object invisible?
 
void AttributesAssign (const MbAttributeContainer &)
 Duplicate attributes of a given object, release existing attributes.
 
size_t AttributesCount () const
 Get the number of objects.
 
bool RemoveAttributes (bool onDeleteOwner=false)
 Delete all attributes from container.
 
MbAttributeAddAttribute (MbAttribute *attr, bool checkSame=true)
 Add attribute in container. More...
 
MbAttributeAddAttribute (const MbAttribute &attr, bool checkSame=true)
 Add attribute in container (adds a copy of the attribute if it can be added). More...
 
void GetAttributes (c3d::AttrVector &attrs, MbeAttributeType aFamily, MbeAttributeType subType) const
 Get attributes of a given type or family. More...
 
void GetAttributes (c3d::AttrVector &attrs, MbeAttributeType aType) const
 Get attributes of a given type. More...
 
template<class AttrVector >
void GetAttributes (AttrVector &attrs) const
 Get attributes. More...
 
void GetCommonAttributes (c3d::AttrVector &, const c3d::string_t &samplePrompt, MbeAttributeType subType=at_Undefined, bool firstFound=false) const
 Get attributes using sample of description string.
 
void GetStringAttributes (c3d::AttrVector &, const c3d::string_t &sampleContent) const
 Get string attributes using sample of contents of the string.
 
bool RemoveAttribute (const MbAttribute *, bool checkAccuracySame=false, double accuracy=LENGTH_EPSILON)
 Get an attribute of a given type, the first one is returned if there are many. More...
 
bool RemoveAttributes (MbeAttributeType type, MbeAttributeType subType)
 Delete attributes of a given type.
 
const MbAttributeGetSimpleAttribute (MbeAttributeType) const
 Get a simple attribute of a given subtype.
 
MbAttributeSetSimpleAttribute (MbeAttributeType)
 Get a simple attribute of a given subtype.
 
MbAttributeSetSimpleAttribute (MbAttribute *simpAttr)
 Set a simple attribute of a given subtype.
 
MbAttributeSetSimpleAttribute (const MbAttribute &simpAttr)
 Set a simple attribute of a given subtype (always copies the attribute).
 
void RemoveSimpleAttribute (MbeAttributeType)
 Delete simple attributes (one or more) of a given subtype.
 
MbAttributeDetachSimpleAttribute (MbeAttributeType)
 Detach a simple attribute of a given subtype.
 
void GetUserAttributes (std::vector< MbUserAttribute * > &attrs, const MbUserAttribType &type) const
 Get a user attribute of a given subtype.
 
void RemoveUserAttributes (const MbUserAttribType &type)
 Delete user attributes (one or more) of a given subtype.
 
void DetachUserAttributes (std::vector< MbUserAttribute * > &attrs, const MbUserAttribType &type)
 Detach a user attribute of a given subtype.
 
void AttributesChange ()
 Perform actions when changing the attributes.

 
void AttributesConvert (MbAttributeContainer &other) const
 Perform actions when converting the attributes.

 
void AttributesTransform (const MbMatrix3D &, MbRegTransform *=nullptr)
 Perform actions when transforming the attributes.

 
void AttributesMove (const MbVector3D &, MbRegTransform *=nullptr)
 Perform actions when moving the attributes.

 
void AttributesRotate (const MbAxis3D &, double angle, MbRegTransform *=nullptr)
 Perform actions when rotating the attributes.

 
void AttributesCopy (MbAttributeContainer &other, MbRegDuplicate *=nullptr) const
 Perform actions when copying the attributes.

 
void AttributesMerge (MbAttributeContainer &other)
 Perform actions when merging the attributes.

 
void AttributesReplace (MbAttributeContainer &other)
 Perform actions when replacing the attributes.
 
void AttributesSplit (const std::vector< MbAttributeContainer * > &others)
 Perform actions when splitting the attributes.
 
void AttributesDelete ()
 Perform actions when deleting the attributes.
 
- Public Member Functions inherited from MbRefItem
refcount_t GetUseCount () const
 Get count of references (get count of owners of an object).
 
refcount_t AddRef () const
 Increase count of references by one.
 
refcount_t DecRef () const
 Decrease count of references by one.
 
refcount_t Release () const
 Decrease count of references by one and if count of references became zero, then remove itself.
 
- Public Member Functions inherited from MbNestSyncItem
void Lock () const
 Switch lock on (locking happens only in parallel region).
 
void Unlock () const
 Switch lock off if locking has been set.
 
CommonRecursiveMutexGetLock () const
 Get a pointer to the mutex object. Return nullptr if no parallelism. For use in ScopedLock.
 

Protected Member Functions

 MbGrid (const MbGrid &, MbRegDuplicate *)
 Copy-constructor with the registrator.
 
 MbGrid ()
 Constructor without parameters.
 
void MoveSearchTree (const MbVector3D &) const
 Move elements search tree.
 
- Protected Member Functions inherited from MbPrimitive
 MbPrimitive (const MbPrimitive &, MbRegDuplicate *iReg)
 Copy-constructor with the registrator.
 
 MbPrimitive ()
 Constructor without parameters.
 
- Protected Member Functions inherited from MbAttributeContainer
 MbAttributeContainer (const MbAttributeContainer &, MbRegDuplicate *)
 Copy-constructor with the registrator.
 
- Protected Member Functions inherited from MbRefItem
 MbRefItem ()
 Constructor without parameters.
 

Protected Attributes

std::vector< MbTriangletriangles
 Set of triangular plates contains numbers of elements of 'params' set and/or of 'points' and 'normals' sets.
 
std::vector< MbQuadranglequadrangles
 Set of quadrangular plates contains numbers of elements of 'params' set and/or of 'points' and 'normals' sets.
 
std::vector< MbGridLoop * > loops
 Set of bounding loops contains numbers of elements of 'points' set and/or of 'params' set. Ownership of elements of set.
 
MbStepData stepData
 Parameter of triangulation calculation.
 
MbCube cube
 Bounding box of object. More...
 
MbGridSearchTree * searchTree
 Elements search tree.
 
- Protected Attributes inherited from MbPrimitive
MbName name
 Name of primitive.
 
const MbRefItemparentItem
 Begetter object (don't own).
 
MbeRefType type
 Type of primitive.
 

Additional Inherited Members

- Static Public Member Functions inherited from MbAttributeContainer
static MbUserAttributeReduceUserAttrib (const MbExternalAttribute &)
 Convert user attribute to "system" one.
 
static MbExternalAttributeAdvanceUserAttrib (const MbUserAttribute &)
 Convert "system" attribute to user one.
 

Detailed Description

Triangulation.

Triangulation represents a set of triangular and quadrangular plates which are joined to each other by their common sides.
In simple case triangulation consists of a set of points and a set of triangles. Triangle is represented as three numbers from the set of points defining vertices of triangle. Triangulation is used for approximation of curved surfaces. In certain cases use of flat plates significantly simplifies work with curved surfaces. Triangulation describes geometric form of objects with the specified accuracy.
Triangulation is used for obtaining point-images, for calculating mass-inertial properties, for collision detection, for numerical experiments with models. For the same object triangulation can have different data depending on its purpose.

Purposes of triangulation
Data depends on purposes of triangulation:
If triangulation is intended for visualization of a geometric form, then 'points' and 'normals' sets are filled (in case of planes 'normals' contains one element), spacing of sample along the curves and the surfaces is calculated by stepData (Step, StepU, StepV functions work).
If triangulation is intended for visualization of geometric form and texture, then 'params', 'points' and 'normals' sets are filled, spacing of sample along curves and surfaces is calculated by stepData.
If triangulation is intended for calculation of mass-inertial properties, then 'params' set is filled, spacing of sample along curves and surfaces is calculated by angle of deviation (DeviationStep, DeviationStepU, DeviationStepV functions work).
If triangulation is intended for collision detection between elements of model, then 'params' and 'points' sets are filled, spacing of sample along curves and surfaces is calculated by stepData (Step, StepU, StepV functions work).
If triangulation is intended for splitting into elements, then 'normals' and 'points' sets are filled, spacing of sampling along curves and surfaces is calculated by angle of deviation with limiting of length (MetricStep, MetricStepU, MetricStepV functions work).

Member Function Documentation

◆ GetLocation()

virtual MbeItemLocation MbGrid::GetLocation ( const MbPlacement3D pl,
double  eps,
bool  onlyInItem = false 
) const
pure virtual

Define the object position relative to the plane.

Determine the object position relative to the XY-plane of a local coordinate system.

Parameters
[in]pl- A local coordinate system which defines a plane.
[in]eps- A metric tolerance.
[in]onlyInItem- Whether the object position relative to the XY-plane of a local coordinate system is interested only.
Returns
Iloc_OnItem - object intersects the XY plane of a local coordinate system,
iloc_InItem - object is located over the XY plane of a local coordinate system,
iloc_OutOfItem - object is located under the XY plane of a local coordinate system.

Implemented in MbFloatGrid, and MbExactGrid.

◆ InsideLocation()

virtual bool MbGrid::InsideLocation ( const MbPlacement3D place,
MbRect rect,
double  eps 
) const
pure virtual

Determine the object position relative to the tube.

Determine whether the object is inside the tube of rectangular section given by a rectangle in the XY plane of a local coordinate system.

Parameters
[in]place- A local coordinate system in the XY plane of which a tube section is located.
[in]rect- A rectangle which defines a tube section.
[in]eps- A metric tolerance.
[in]onlyInItem- Whether the object position relative to the tube is interested only.
Returns
True if the object is inside the tube.

Implemented in MbFloatGrid, and MbExactGrid.

◆ DistanceToPoint()

double MbGrid::DistanceToPoint ( const MbCartPoint3D pnt,
size_t &  ind 
) const

Calculate distance to point.

Calculate the distance from a point to the nearest triangulation reference point.

Parameters
[in]pnt- Point.
[out]ind- Index of the nearest point in the array of triangulation reference points.
Returns
Distance between the given point and the nearest triangulation reference point.

◆ DistanceToLine()

double MbGrid::DistanceToLine ( const MbAxis3D axis,
double  extDistance,
double &  t,
c3d::IndicesPair tqInd 
) const

Calculate the distance to an axis.

Calculate the distance from the axis to the nearest triangle or quadrangle of triangulation.

Parameters
[in]axis- Axis (view ray).
[in]extDistance- Triangulation bounding box extension (set it equal zero by default).
[in,out]t- Parameter on the ray where ray intersects the triangulation.
[out]tqInd- Index of nearest triangle or quadrangle.
Returns
Zero if intersection was found, between the axis and the nearest triangulation triangle or quadrangle.

◆ FindIntersectingElementsByCubesTree()

bool MbGrid::FindIntersectingElementsByCubesTree ( const MbAxis3D ray,
c3d::IndicesVector triIndices,
c3d::IndicesVector quadIndices,
double  eps = METRIC_EPSILON 
) const

Find indices of triangles and quadrangles potentially intersecting with a ray.

Find indices of triangles and quadrangles potentially intersecting with a ray using elements cubes tree (if it can be created).

Parameters
[in]ray- Ray.
[out]triIndices- Triangles indices.
[out]quadIndices- Quadrangles indices.
[in]eps- Accuracy of checking the intersection of a ray with a bounding box of a triangle or quadrangle.
Returns
Returns true if a search by cubes tree was performed.

◆ FindNearest()

double MbGrid::FindNearest ( const MbCartPoint3D pnt,
MbCartPoint3D pntProj,
c3d::IndicesPair tqInd 
) const

Find index of triangle or quadrangle which is closest to a point.

Parameters
[in]pnt- Point.
[out]pntProj- Nearest point from mesh.
[out]tqInd- Index of nearest triangle or quadrangle.
Returns
Distance to the nearest point.

◆ FindIntersectingElements()

bool MbGrid::FindIntersectingElements ( const MbAxis3D ray,
c3d::IndicesVector triIndices,
c3d::IndicesVector quadIndices,
double  eps = METRIC_EPSILON 
) const

Find indices of triangles and quadrangles intersecting with a ray.

Find indices of triangles and quadrangles intersecting with a ray.

Parameters
[in]ray- Ray.
[out]triIndices- Triangles indices.
[out]quadIndices- Quadrangles indices.
[in]eps- Accuracy of checking the intersection of a ray with a bounding box of a triangle or quadrangle.
Returns
Returns true if something was found.

Member Data Documentation

◆ cube

MbCube MbGrid::cube
mutableprotected

Bounding box of object.

Bounding box of object is calculated only at the request. Bounding box of object is undefined after object constructor and after object modifications


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