Actin®  Version 5.2.0
Software for Robotics Simulation and Control
EcShape Class Referenceabstract

Virtual base class for all shapes. More...

#include <ecShape.h>

Inheritance diagram for EcShape:
EcBaseExpressionTreeElement EcXmlCompoundType EcXmlObject EcBasePhysicalExtent EcBox EcBoxLozenge EcCapsule EcCircularLozenge EcCone EcConicalLozenge EcCylinder EcCylindricalLozenge EcEllipsoid EcExtentExpressionBaseBinary EcExtentExpressionBaseUnary EcHalfSpace EcLozenge EcShapeUnion EcSphere EcTerrain EcTetrahedralLozenge EcTetrahedron EcTriangularLozenge

Public Types

enum  EcShapeValues {
  POINT_POLYGON,
  POLY_PHYSICAL,
  TRI_PHYSICAL,
  GRID,
  SPHERE,
  CAPSULE,
  ELLIPSOID,
  TETRAHEDRON,
  OBB,
  LOZENGE,
  HALFSPACE,
  CYLINDER,
  CONE,
  BOXLOZENGE,
  CIRCULARLOZENGE,
  TRIANGULARLOZENGE,
  CYLINDRICALLOZENGE,
  TETRAHEDRALLOZENGE,
  CONICALLOZENGE,
  TERRAIN,
  TERRAIN_UNION,
  UNION,
  INTERSECTION
}
 enumerations for supported geometry More...
 
enum  EcCollisionQueryOptions {
  ALL,
  DEEPEST
}
 enumerations for collision data accessing
 
- Public Types inherited from EcXmlCompoundType
enum  {
  READONLYCOMPONENT = 0,
  READONLYATTRIBUTE
}
 special-descriptor codes More...
 

Public Member Functions

 EcShape ()
 default constructor
 
virtual ~EcShape ()
 destructor
 
 EcShape (const EcShape &orig)
 copy constructor
 
EcShapeoperator= (const EcShape &orig)
 assignment operator
 
EcBoolean operator== (const EcShape &orig) const
 equality operator
 
virtual void registerComponents () EC_OVERRIDE
 register components with the parent
 
virtual void fitFromShape (const EcShape &shape)=0
 resizes this shape to completely contain the shape passed in
 
virtual EcVector supportPoint (const EcVector &v) const =0
 get support point given a vector
 
virtual void scaleBy (EcReal scaleFactor)
 
virtual void scaleSelfBy (EcReal scaleFactor)=0
 
virtual void transformBy (const EcCoordinateSystemTransformation &xform, const EcBoolean recurseLowerFidelityRepresentations=EcTrue)
 transform the shape by the given coordinate system transformation
 
virtual EcReal distanceToLineSegment (const EcLineSegment &seg) const =0
 get the distance to a line segment
 
virtual EcReal distanceToPoint (const EcVector &vec) const =0
 get the distance to a point
 
virtual EcBoolean checkIntersectWithLineSegment (const EcLineSegment &lineSegment) const =0
 check the intersection with line segment
 
virtual void intersectLineSegment (const EcLineSegment &lineSegment, EcShapePointEvent &pointEvent) const =0
 Intersect a line segment with the shape. More...
 
virtual EcBoolean checkIntersectWithPoint (const EcVector &point) const =0
 check the intersection with a point
 
virtual const EcShapelowerFidelityRepresentation () const
 lower fidelity representation
 
virtual const EcShapelowestFidelityNotToExceed (EcU32 level) const
 lowest fidelity not to exceed the given level
 
virtual const EcShapehigherFidelityRepresentation () const
 higher fidelity representation
 
virtual void setLowerFidelityRepresentationPointer (EcShape *ptr)
 
virtual void setHigherFidelityRepresentationPointer (EcShape *ptr)
 higher fidelity representation
 
virtual void setLowerFidelityRepresentation (const EcShape &shape)
 lower fidelity representation (makes a copy)
 
virtual void addBoundingVolume (const EcShapeValues &bv)
 add a bounding volume to this shape
 
virtual void deleteBoundingVolumes ()
 delete all the bounding volumes in the hierarchy
 
virtual void deletePhysicalExtent ()
 delete the physical extent
 
virtual EcBoolean normalOfIntersection (const EcLineSegment &seg, const EcCoordinateSystemTransformation &xform, EcVector &normalVector) const
 
virtual void fitToPoints (const EcXmlVectorVector &points)=0
 expand this shape to fit this collection of points
 
virtual void physicalExtent (EcBasePhysicalExtentPtrVector &physExtent) const =0
 get a physical extent for this shape
 
virtual EcBasePhysicalExtentphysicalExtent () const =0
 
virtual EcBoolean readValueFromSpecialToken (const EcToken &token, EcXmlReader &stream) EC_OVERRIDE
 read value from unregistered token
 
virtual EcBoolean write (EcXmlWriter &stream) const EC_OVERRIDE
 write this object to an XML stream
 
virtual EcBoolean writeSchema (EcXmlSchema &stream) const EC_OVERRIDE
 write this object to an XML schema
 
virtual const EcStringsurfaceProperty () const
 return the surface property of this shape
 
virtual void setSurfaceProperty (const EcString &surfaceProp)
 sets the surface property of this shape
 
virtual EcBoolean isConvex () const =0
 method to determine if the shape is convex or not
 
virtual EcU32 type () const =0
 
virtual EcU32 detailLevel () const
 get function for detail level
 
virtual void setDetailLevel (const EcU32 detLev)
 set function for detail level
 
virtual void setIndexAndBackPointer (EcU32 &index, const EcManipulatorLink *link, EcShapeConstPointerMap &shapePointerMap, EcShapePointerVector &shapePointerVec)
 set the proximity database index for this shape, and the link pointer
 
virtual EcU32 proximityDatabaseIndex () const
 get the proximity database index for this shape
 
virtual void setProximityDatabaseIndex (const EcU32 &index)
 set the proximity database index for this shape
 
virtual void mapBVHLevel (EcU32 &bvhLevel)
 
virtual const EcStringidentifier () const
 get the shape identifier
 
virtual void setIdentifier (const EcString &identifier)
 set the shape identifier
 
virtual void setBVHLevel (const EcU32 &level)
 set the level of this shape in the bounding volume hierarchy
 
virtual const EcU32bvhLevel () const
 get the level of this shape in the bounding volume hierarchy
 
virtual void capsuleBoundingVolumeVectorInPrimary (EcXmlVectorType< EcCapsule > &capsuleVec, EcU32Vector &shapeIDVec) const
 
virtual void subdivide (EcXmlVectorVector &points, EcPolygonWithKeyVector &polys, const EcU32 triIds[3], const EcInt32 level) const
 Subdivide a triangle into 4. More...
 
virtual void icosahedron (EcBasePhysicalExtent &physExtent, const EcReal radius, const EcVector center, const EcU32 detailLevel) const
 Create polygon/mesh of a sphere. More...
 
virtual const EcStringDataMapMapsurfaces () const
 gets surface property collection
 
virtual EcStringDataMapMapsurfaces ()
 gets surface property collection non-const
 
virtual const EcStringimpactedSurface (const EcU32 &pointIndex, const EcVector &point) const
 get the impacted surface given the index and point of intersection passed in
 
virtual EcBoolean lookup (const EcString &key, const EcDataMap *&surfProp) const
 lookup a surface property for this shape using an EcString
 
virtual EcBoolean lookup (const EcXmlString &xmlKey, const EcDataMap *&surfProp) const
 lookup a surface property for this shape using an EcXmlString (preferred method)
 
virtual void setSurfaces (const EcStringDataMapMap &surfaces)
 set the surface properties collection for this shape
 
virtual EcShapelowerFidelityRepresentation ()
 lower fidelity representation (Non-Const)
 
virtual EcShapehigherFidelityRepresentation ()
 higher fidelity representation (Non-Const)
 
virtual EcU32 supportPointID () const
 get support point ID (last calculated)
 
virtual void setSupportPointID (const EcU32 supportPointID)
 set support point ID
 
virtual const EcBooleanbypassDynamics () const
 get the bypass dynamics flag
 
virtual void setBypassDynamics (const EcBoolean &flag)
 set the bypass dynamics flag
 
virtual EcU32 numberOfShapes () const
 
virtual void addExplicitBoundingVolume (const EcShape &shape)
 add the shape passed in as a new bounding volume
 
virtual EcBoolean setSurfaceProperties (const EcString &key, const EcDataMap &properties)
 set the properties of the surface identified by key. More...
 
virtual void boundingVolumes (EcShapeConstPointerVector &boundingVolumes, const EcU32 bvhLevel=1) const
 
virtual const EcCapsulecapsuleBoundingVolume () const
 gets capsule bounding volume
 
virtual void setCapsuleBoundingVolume (const EcCapsule &capsuleBoundingVolume)
 sets capsule bounding volume
 
virtual EcShapecreateBoundingShape (const EcShapeValues &bv) const
 create a bounding shape for this shape
 
virtual void getAabb (EcAxisAlignedBoundingBox &aabb) const =0
 get aabb for shape (abstract)
 
virtual EcBoolean isUnion () const
 returns true if the shape is a union of shapes
 
virtual EcAxisAlignedBoundingBoxutilityAabb () const
 returns a utility aabb used in EcShapeCollisionTool
 
virtual EcBoolean copyGeometricProperties (const EcShape &another)=0
 
- Public Member Functions inherited from EcBaseExpressionTreeElement
 EcBaseExpressionTreeElement ()
 default constructor
 
 EcBaseExpressionTreeElement (const EcXmlBaseVariableCompoundType *containerPointer)
 constructor given container pointer
 
virtual ~EcBaseExpressionTreeElement ()
 destructor
 
 EcBaseExpressionTreeElement (const EcBaseExpressionTreeElement &orig)
 copy constructor
 
EcBaseExpressionTreeElementoperator= (const EcBaseExpressionTreeElement &orig)
 assignment operator
 
EcBoolean operator== (const EcBaseExpressionTreeElement &orig) const
 equality operator
 
virtual const EcXmlBaseVariableCompoundTypecontainer () const
 gets the container
 
virtual void setContainer (const EcXmlBaseVariableCompoundType *container)
 sets the container
 
- Public Member Functions inherited from EcXmlCompoundType
 ECDECLARE_BIGFOUR (EcXmlCompoundType)
 
virtual EcBoolean xmlInit () EC_OVERRIDE
 xmlInitialize
 
virtual EcBoolean read (EcXmlReader &stream) EC_OVERRIDE
 read object from an XML stream
 
virtual EcBoolean readAttributes (EcXmlReader &stream)
 read object attributes from an XML stream
 
virtual EcBoolean readElements (EcXmlReader &stream)
 read object elements from an XML stream
 
virtual EcBoolean writeAttributes (EcXmlWriter &stream) const
 write object attributes to an XML stream
 
virtual EcBoolean writeElements (EcXmlWriter &stream) const
 write object elements to an XML stream
 
virtual EcBoolean writeSchemaAttributes (EcXmlSchema &stream) const
 write schema attributes
 
virtual EcBoolean writeSchemaElements (EcXmlSchema &stream) const
 write schema elements
 
virtual void registerComponent (const EcToken &token, EcXmlObject *obj)
 register a single component More...
 
virtual void registerComponent (EcXmlObject *obj)
 register a single component More...
 
virtual void registerComponentReadOnly (const EcToken &token, EcXmlObject *obj)
 register a single component as read-only More...
 
virtual const EcXmlComponentMapcomponentMap () const
 get a reference to the component map
 
virtual void registerAttributeComponent (const EcToken &AttribToken, EcXmlObject *Obj)
 register a single attribute component More...
 
virtual void registerAttributeComponentReadOnly (const EcToken &AttribToken, EcXmlObject *Obj)
 register a single attribute component read-only More...
 
virtual const EcXmlComponentMapattributeComponentMap ()
 get a reference to the component attribute map
 
virtual const EcXmlSpecialDescriptorMapspecialDescriptorMap ()
 get a reference to the special-descriptor map
 
virtual void registerComponentDescriptor (const EcToken &xmlToken, const EcToken &descriptorToken, const EcString &descriptorString)
 register an XML token-string descriptor More...
 
virtual const EcXmlTokenStringDescriptorMapMaptokenStringDescriptorMap ()
 get a reference to the XML token-string descriptor map
 
virtual EcBoolean hasChildren () const
 return EcTrue if there are children components or EcFalse if an empty element.
 
virtual EcBoolean hasAttributes () const
 return EcTrue if there are attributes in the element.
 
- Public Member Functions inherited from EcXmlObject
 ECDECLARE_BIGFOUR (EcXmlObject)
 
virtual EcXmlObjectclone () const =0
 clone
 
virtual EcBoolean readAttribute (EcXmlReader &stream)
 read this attribute from an XML stream
 
virtual EcBoolean createSchema (const EcString &filename, const EcToken &objectName=EcXml::EcDefaultToken) const
 create schema
 
virtual EcBoolean xmlInitialized () const
 get XML initialized flag. This bit is set on initialization.
 
virtual void setXmlInitialized (EcBoolean val=EcTrue)
 set XML initialized flag. This bit is set on initialization.
 
virtual EcBoolean specified () const
 get specified flag. This bit is set upon reading from an XML file.
 
virtual void setSpecified (EcBoolean val=EcTrue)
 set specified flag. This bit is set upon reading from an XML file.
 
virtual EcBoolean isBasicType () const
 Return true/false for basic type.
 
virtual EcBoolean equalsDefault () const
 tests equality of XML object with default
 
virtual EcBoolean equality (const EcXmlObject *other) const =0
 equality - a virtual equality to an EcXmlObject pointer
 
virtual EcXmlObjectnewObject () const =0
 creates new object - a virtual new to an EcXmlObject pointer
 
virtual const EcTokentoken () const =0
 gets the xml token used for writing out.
 

Protected Attributes

EcXmlU32 m_DetailLevel
 detail value for some of the shapes
 
EcStringDataMapMap m_Surfaces
 a map of surface properties by string key
 
EcXmlString m_SurfaceProperty
 contains the surface property of this shape (assumes homogeneous)
 
EcXmlString m_ShapeIdentifier
 optional identifier for this shape
 
EcXmlBoolean m_BypassDynamics
 flag indicating whether to bypass collision dynamics for this shape
 
boost::scoped_ptr< EcShapem_pLowerFidelityRepresentation
 a pointer to a low-fidelity representation of this shape
 
EcBasePhysicalExtentm_pPhysicalExtent
 a pointer to a physical extent representing this shape
 
EcShapem_pHigherFidelityRepresentation
 a higher-fidelity representation of this shape
 
EcU32 m_BVHLevel
 indicates the level of this shape in the Bounding Volume Hierarchy
 
EcU32 m_ProximityDatabaseIndex
 the index of this shape into the proximity database
 
EcU32 m_SupportPointID
 the support point ID
 
EcCapsulem_pCapsuleBoundingVolume
 a default capsule bounding volume
 
EcXmlString m_UtilityXmlString
 utility string
 
EcAxisAlignedBoundingBox m_UtilityAabb
 utility aabb
 
- Protected Attributes inherited from EcBaseExpressionTreeElement
const EcXmlBaseVariableCompoundTypem_pContainer
 a pointer to the container
 
- Protected Attributes inherited from EcXmlCompoundType
EcXmlComponentMapm_pComponentMap
 
EcXmlComponentMapm_pAttributeComponentMap
 
EcXmlSpecialDescriptorMapm_pSpecialDescriptorMap
 
EcXmlTokenStringDescriptorMapMapm_pComponentMapTokenStringDescriptor
 
- Protected Attributes inherited from EcXmlObject
EcU8 m_State
 the state of the object - eight boolean flags
 

Additional Inherited Members

- Protected Member Functions inherited from EcXmlCompoundType
virtual EcBoolean readValueFromToken (const EcToken &token, EcXmlReader &stream)
 
virtual EcBoolean readAttributeFromToken (const EcToken &token, EcXmlReader &stream)
 
virtual EcXmlComponentMapnewComponentMap () const
 allocate a new componentMap
 
virtual EcXmlSpecialDescriptorMapnewSpecialDescriptorMap ()
 allocate a new specialDescriptorsMap
 
virtual EcXmlTokenStringDescriptorMapMapnewTokenStringDescriptorMap ()
 allocate a new tokenStringDescriptorsMap
 
virtual void createComponentMap () const
 create component map
 
virtual void createAttributeComponentMap ()
 create attribute component map
 
virtual void createSpecialDescriptorMap ()
 create special-descriptors map
 
virtual void createTokenStringDescriptorMap ()
 create token-string descriptor map
 
virtual EcBoolean isReadOnlyComponent (const EcToken token) const
 check to see if the token corresponds to a read-only component
 
virtual EcBoolean isReadOnlyAttribute (const EcToken token) const
 check to see if the token corresponds to a read-only attribute
 
virtual EcXmlObjectlibraryAttribute ()
 
- Static Protected Attributes inherited from EcXmlObject
static const EcU8 m_theXmlInitializedBit
 the bit used to describe xml initialization
 
static const EcU8 m_theSpecifiedBit
 the bit used to describe specification
 

Detailed Description

Virtual base class for all shapes.

Holds a class to describe a 3D shape

Definition at line 43 of file ecShape.h.

Member Enumeration Documentation

enumerations for supported geometry

Enumerator
POLY_PHYSICAL 

A point polygon representation (consisting of a co-planar collection of points)

TRI_PHYSICAL 

A point physical extent.

GRID 

A triangular physical extent.

SPHERE 

A grid shape made up of bricks.

CAPSULE 

A sphere defined by a radius and center.

ELLIPSOID 

A capsule defined by a line segment and a radius.

TETRAHEDRON 

An ellipsoid defined by x^2/a^2 + y^2/b^2 + z^2/c^2 = 1.

OBB 

A tetrahedron defined by a base point and three edges.

LOZENGE 

An oriented bounding box defined by a center, three axes and three extents

HALFSPACE 

A lozenge defined by a 3D rectangle and a radius.

CYLINDER 

A half-space defined by a plane, the normal points out of the half-space

CONE 

A Cylinder defined by a line segment and a radius.

BOXLOZENGE 

A Cone defined by a line segment and 2 radii.

CIRCULARLOZENGE 

All points within a specified distance from a box.

TRIANGULARLOZENGE 

All points within a specified distance from a 3D circular disk.

CYLINDRICALLOZENGE 

All points within a specified distance from a 3D filled triangle.

TETRAHEDRALLOZENGE 

All points within a specified distance from a cylinder.

CONICALLOZENGE 

All points within a specified distance from a tetrahedron.

TERRAIN 

All points within a specified distance from a cylinder.

TERRAIN_UNION 

A terrain shape.

UNION 

A union of terrain shapes for georeferenced terrain databases.

INTERSECTION 

A composite shape that is the union of other shapes.

Definition at line 47 of file ecShape.h.

Member Function Documentation

virtual void EcShape::boundingVolumes ( EcShapeConstPointerVector boundingVolumes,
const EcU32  bvhLevel = 1 
) const
virtual

get the collection of bounding volumes at level bvhLevel representing this shape

Reimplemented in EcExtentUnion.

virtual void EcShape::capsuleBoundingVolumeVectorInPrimary ( EcXmlVectorType< EcCapsule > &  capsuleVec,
EcU32Vector shapeIDVec 
) const
virtual

get capsule vector in primary frame of shape. NOTE: unions will have more than one

Reimplemented in EcShapeUnion, and EcExtentUnion.

virtual EcBoolean EcShape::copyGeometricProperties ( const EcShape another)
pure virtual

copy geometric properties from another shape of the same type. Geometric properties of a given shape mostly concerns its size and location. For example, the geometric properties of sphere are radius and center. The implementation of this method in the derived classes must not reallocate any memory. Note that the only case in which memory allocation is allowed is if the physical extent of this shape has been created (most likely for rendering). In this case, the physical extent could be deleted (which affects memory allocation).

Parameters
anotherThe shape of the same type from which geometric properties will be copied.
Returns
False if another is not of the same type as this shape, if the geometric properties can't be copied without reallocating memory (for example, physical extents), or if this method is not supported for a specific shape. True otherwise.

Implemented in EcTerrain, EcBasePhysicalExtent, EcBox, EcTetrahedron, EcCone, EcCylinder, EcTetrahedralLozenge, EcShapeUnion, EcBoxLozenge, EcEllipsoid, EcConicalLozenge, EcCylindricalLozenge, EcHalfSpace, EcTriangularLozenge, EcCircularLozenge, EcSphere, EcCapsule, EcLozenge, EcTerrainUnion, and EcExtentExpressionBaseBinary.

virtual void EcShape::icosahedron ( EcBasePhysicalExtent physExtent,
const EcReal  radius,
const EcVector  center,
const EcU32  detailLevel 
) const
virtual

Create polygon/mesh of a sphere.

Parameters
[out]physExtentpolygon and indices
[in]radiusradius
[in]centercenter
[in]detailLeveldetail level
Returns
void
virtual void EcShape::intersectLineSegment ( const EcLineSegment lineSegment,
EcShapePointEvent pointEvent 
) const
pure virtual

Intersect a line segment with the shape.

If the initial isImpacted in pointEvent is false and the line segment intersects with the shape, isImpacted in pointEvent will be set to true and the distance in pointEvent will be set to the distance from the first endpoint along the line segment to the point of intersection of the shape. If the first endpoint of the line segment lies inside or on the surface of the shape (regardless of whether the other endpoint lies inside the shape), then the distance is set to 0 and isImpacted is set to true. If the line segment does not intersect with the shape, then nothing happens. If the initial isImpacted in pointEvent is true and the line segment intersects with the shape, the initial distance in pointEvent will be compared to the distance from the first endpoint along the line segment to the point of intersection. If the new distance is less than the initial distance, the distance in pointEvent will be set to the new distance. Otherwise, the distance in pointEvent will remain unchanged.

Implemented in EcTerrain, EcBox, EcTetrahedron, EcTetrahedralLozenge, EcCone, EcCylinder, EcBoxLozenge, EcPolyPhysicalExtent, EcEllipsoid, EcTriPhysicalExtent, EcGridPhysicalExtent, EcConicalLozenge, EcCylindricalLozenge, EcHalfSpace, EcCircularLozenge, EcTriangularLozenge, EcCapsule, EcShapeUnion, EcSphere, EcLozenge, and EcExtentUnion.

virtual void EcShape::mapBVHLevel ( EcU32 bvhLevel)
virtual

set the BVH level IDs for this shape and all shapes above this in the BVH hierarchy

virtual EcBoolean EcShape::normalOfIntersection ( const EcLineSegment seg,
const EcCoordinateSystemTransformation xform,
EcVector normalVector 
) const
virtual

returns the normal vector of the polygon intersected by the line segment passed in. If the line segment intersects more than one polygon, the first polygon intersected is returned

virtual EcU32 EcShape::numberOfShapes ( ) const
virtual

get the number of shapes that comprise this shape, this is always one for non-composite shapes

Reimplemented in EcExtentExpressionBaseBinary, and EcShapeUnion.

virtual EcBasePhysicalExtent* EcShape::physicalExtent ( ) const
pure virtual
virtual void EcShape::scaleBy ( EcReal  scaleFactor)
virtual

scale the shape and the lower-fidelity reprentation shape by the specified value (scaleFactor=1.0 does not change the shape)

virtual void EcShape::scaleSelfBy ( EcReal  scaleFactor)
pure virtual
virtual void EcShape::setLowerFidelityRepresentationPointer ( EcShape ptr)
virtual

lower fidelity representation sets and deletes pointer

virtual EcBoolean EcShape::setSurfaceProperties ( const EcString key,
const EcDataMap properties 
)
virtual

set the properties of the surface identified by key.

Parameters
[in]keyA string to identify the surface material.
[in]propertiesThe surface properties to be set.
Returns
True if key is found and the operation is successful or false otherwise.

Reimplemented in EcShapeUnion, EcExtentUnion, and EcTerrainUnion.

virtual void EcShape::subdivide ( EcXmlVectorVector points,
EcPolygonWithKeyVector polys,
const EcU32  triIds[3],
const EcInt32  level 
) const
virtual

Subdivide a triangle into 4.

Parameters
[out]pointsvertices
[out]polysstore indices for each triangles
[in]triIdsthe indices of triangle that will be subdivided
[in]levelstop when level ==0
Returns
void
virtual EcU32 EcShape::type ( ) const
pure virtual

The documentation for this class was generated from the following file:
Created by Energid Technologies www.energid.com
Copyright © 2016 Energid. All trademarks mentioned in this document are property of their respective owners.