Conscience Core
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
CscWorldElement Class Reference

#include <CscWorldElement.h>

Inheritance diagram for CscWorldElement:
conscience_core::core_objects::CscWorldLine CscWorldAnimal CscWorldEntity CscWorldHuman CscWorldObject CscWorldPlace

Public Member Functions

 CscWorldElement (const CscWorldElementId &id, const string &name, CscPoint3d *positionIn, CscPoint3d *rotationEulerIn, CscPhysicsType physicsType=CscPhysicsType::BOUNDING_BOX, float mass=5.0, vector< CscWorldElementPart * > *parts=nullptr, vector< CscPoint3d * > *positions=nullptr, vector< CscPoint3d * > *normals=nullptr, vector< CscPolygon * > *polygons=nullptr, vector< const CscLocationTag * > *locationTags=nullptr, float minX=0, float minY=0, float minZ=0, float depth=0, float height=0, float width=0)
 
virtual ~CscWorldElement ()
 
virtual CscPoint3d getMinPositionInWorldCoordinates () const
 
const CscPoint3dgetPosition () const
 
void setPosition (float x, float y, float z)
 
const CscPoint3dgetRotationEulerAsPoint () const
 
void setRotationEuler (double x, double y, double z)
 
void setRotationQuaternion (double w, double x, double y, double z)
 
bool isIn3DArea (const CscArea3d *area) const
 
const string & getName () const
 
virtual CscWorldElementId getId () const
 
float getMass ()
 
virtual CscSize3d getDimensions () const
 
float * getVerticesArray () const
 
float * getPolygonsArray () const
 
int getVerticesCount () const
 
int getPolygonsCount () const
 
void repositionateToZeroOriginPositions ()
 
void repositionateToZeroOriginPolygons ()
 
vector< CscPoint3d * > * getPositions () const
 
vector< CscPolygon * > * getPolygons () const
 
vector< CscPolygon * > getPolygonsInWorldCoordinates () const
 
vector< CscPoint3d * > getYPlanSlicePoints (double sliceY, double precisionCm=5.0) const
 
vector< CscPoint3d * > * getNormals () const
 
const vector< CscWorldElementPart * > * getParts () const
 
vector< CscPoint3d * > * getReconstructedVerticesFromPolygons (const int stepInCm=10) const
 
CscPhysicsType getPhysicsType () const
 
const CscLocationTaggetLocationTagByName (const string &name) const
 
void forcePolygons (const vector< CscPolygon * > &newPolygons)
 
void addTag (const string &tag)
 
void removeTag (const string &tag)
 
bool hasTag (const string &tag) const
 
const double *const getRotationQuaternionArray () const
 
CscQuaternion getRotationQuaternion () const
 
CscRotation3dEuler getRotationEuler () const
 

Static Public Member Functions

static CscWorldElementId nextId ()
 

Public Attributes

float depth = 0
 
float height = 0
 
float width = 0
 
float minX
 
float minY
 
float minZ
 
float mass = 1.0
 
float restitution = 0.3
 
float dampingLinear = 0.3
 
float dampingAngular = 0.3
 
float friction = 1.0
 
bool collideWithOthers = true
 
float certitude = 0.0
 

Protected Member Functions

virtual const CscPoint3dgetBaseRotation () const
 

Protected Attributes

const CscWorldElementId id
 
vector< const CscLocationTag * > * locationTags
 

Constructor & Destructor Documentation

◆ CscWorldElement()

CscWorldElement::CscWorldElement ( const CscWorldElementId id,
const string &  name,
CscPoint3d positionIn,
CscPoint3d rotationEulerIn,
CscPhysicsType  physicsType = CscPhysicsType::BOUNDING_BOX,
float  mass = 5.0,
vector< CscWorldElementPart * > *  parts = nullptr,
vector< CscPoint3d * > *  positions = nullptr,
vector< CscPoint3d * > *  normals = nullptr,
vector< CscPolygon * > *  polygons = nullptr,
vector< const CscLocationTag * > *  locationTags = nullptr,
float  minX = 0,
float  minY = 0,
float  minZ = 0,
float  depth = 0,
float  height = 0,
float  width = 0 
)

◆ ~CscWorldElement()

CscWorldElement::~CscWorldElement ( )
virtual

Member Function Documentation

◆ addTag()

void CscWorldElement::addTag ( const string &  tag)

◆ forcePolygons()

void CscWorldElement::forcePolygons ( const vector< CscPolygon * > &  newPolygons)

backward compatibility method which breaks encapsulation - PLEASE DO NOT USE NOTE: given vector will be copied

◆ getBaseRotation()

const CscPoint3d & CscWorldElement::getBaseRotation ( ) const
protectedvirtual
Returns
base rotation for this element type. Some element types have a base rotation (for instance places => CscWorldPlace::placeDaeToCscEulerXYZ)

Reimplemented in CscWorldPlace, and CscWorldEntity.

◆ getDimensions()

CscSize3d CscWorldElement::getDimensions ( ) const
virtual

Return this element's size in Conscience reference frame. This is the safe way to get element's initial dimensions. Before applying any rotation.

For instance for places: CSC depth => place.width => CSC X axis - size.x CSC width => place.height => CSC Z axis - size.z CSC height => place.depth => CSC Y axis - size.y

Reimplemented in CscWorldObject.

◆ getId()

CscWorldElementId CscWorldElement::getId ( ) const
virtual

◆ getLocationTagByName()

const CscLocationTag * CscWorldElement::getLocationTagByName ( const string &  name) const

searches for a location tag with given name and return it if exists, or nullptr if not

◆ getMass()

float CscWorldElement::getMass ( )

◆ getMinPositionInWorldCoordinates()

CscPoint3d CscWorldElement::getMinPositionInWorldCoordinates ( ) const
virtual
Returns
min position of this element in Conscience world's coordinates

Reimplemented in CscWorldPlace.

◆ getName()

const string & CscWorldElement::getName ( ) const

◆ getNormals()

vector< CscPoint3d * > * CscWorldElement::getNormals ( ) const
Returns
a pointer to a field. DO NOT DELETE

◆ getParts()

const vector< CscWorldElementPart * > * CscWorldElement::getParts ( ) const
Returns
a pointer to a field. DO NOT DELETE

◆ getPhysicsType()

CscPhysicsType CscWorldElement::getPhysicsType ( ) const

◆ getPolygons()

vector< CscPolygon * > * CscWorldElement::getPolygons ( ) const
Returns
a pointer to a field. DO NOT DELETE

◆ getPolygonsArray()

float * CscWorldElement::getPolygonsArray ( ) const

◆ getPolygonsCount()

int CscWorldElement::getPolygonsCount ( ) const

◆ getPolygonsInWorldCoordinates()

vector< CscPolygon * > CscWorldElement::getPolygonsInWorldCoordinates ( ) const

Converts polygon based on element's rotation and translate with position. This is the safe way to get current polygons for this element.

Returns
vector of NEW pointers. Should be DELETED.

◆ getPosition()

const CscPoint3d * CscWorldElement::getPosition ( ) const

get position of the center of this entity (x,y,z in centimeters)

Warning
for a place -> will be x-most / y-least / z-least
See also
getMinPositionInWorldCoordinates()

◆ getPositions()

vector< CscPoint3d * > * CscWorldElement::getPositions ( ) const
Returns
a pointer to a field. DO NOT DELETE

◆ getReconstructedVerticesFromPolygons()

vector< CscPoint3d * > * CscWorldElement::getReconstructedVerticesFromPolygons ( const int  stepInCm = 10) const

Generates vertices for this element based on polygons. Those points are not rotated and not shifted by element's position. It needs to be done manually

Parameters
stepInCmwich resolution is required to build additionnal vertices in cm (defaulty 10cm)
Returns
a NEW vector of NEW points. You HAVE TO DELETE points and vector after use

◆ getRotationEuler()

CscRotation3dEuler CscWorldElement::getRotationEuler ( ) const

◆ getRotationEulerAsPoint()

const CscPoint3d * CscWorldElement::getRotationEulerAsPoint ( ) const

This is only there for backward compatibility purpose. Please use getRotationEuler(). Warning: pointXYZ = PYR (rotation on Z, Y and X axis respectively)

See also
CscRotation3dEuler getRotationEuler()
getRotationQuaternion()

◆ getRotationQuaternion()

CscQuaternion CscWorldElement::getRotationQuaternion ( ) const

◆ getRotationQuaternionArray()

const double *const CscWorldElement::getRotationQuaternionArray ( ) const
Returns
4 elements array: w,x,y,z

◆ getVerticesArray()

float * CscWorldElement::getVerticesArray ( ) const

◆ getVerticesCount()

int CscWorldElement::getVerticesCount ( ) const

◆ getYPlanSlicePoints()

vector< CscPoint3d * > CscWorldElement::getYPlanSlicePoints ( double  sliceY,
double  precisionCm = 5.0 
) const

Gets all points in world coordinates (i.e. with place rotation / position taken in account) computed using intersection with polygons at given Y height.

Parameters
sliceYplan's Y in centimeters
Returns
new points to be DELETED

◆ hasTag()

bool CscWorldElement::hasTag ( const string &  tag) const

◆ isIn3DArea()

bool CscWorldElement::isIn3DArea ( const CscArea3d area) const

◆ nextId()

static CscWorldElementId CscWorldElement::nextId ( )
inlinestatic

generates an automatic unique ID based on a numeric value

◆ removeTag()

void CscWorldElement::removeTag ( const string &  tag)

◆ repositionateToZeroOriginPolygons()

void CscWorldElement::repositionateToZeroOriginPolygons ( )

◆ repositionateToZeroOriginPositions()

void CscWorldElement::repositionateToZeroOriginPositions ( )

◆ setPosition()

void CscWorldElement::setPosition ( float  x,
float  y,
float  z 
)

x,y,z expected in centimeters

◆ setRotationEuler()

void CscWorldElement::setRotationEuler ( double  x,
double  y,
double  z 
)

warning: not in sync with setRotationQuaternion

◆ setRotationQuaternion()

void CscWorldElement::setRotationQuaternion ( double  w,
double  x,
double  y,
double  z 
)

warning: not in sync with setRotationEuler

Member Data Documentation

◆ certitude

float CscWorldElement::certitude = 0.0

◆ collideWithOthers

bool CscWorldElement::collideWithOthers = true

◆ dampingAngular

float CscWorldElement::dampingAngular = 0.3

◆ dampingLinear

float CscWorldElement::dampingLinear = 0.3

◆ depth

float CscWorldElement::depth = 0

◆ friction

float CscWorldElement::friction = 1.0

◆ height

float CscWorldElement::height = 0

◆ id

const CscWorldElementId CscWorldElement::id
protected

◆ locationTags

vector<const CscLocationTag*>* CscWorldElement::locationTags
protected

◆ mass

float CscWorldElement::mass = 1.0

◆ minX

float CscWorldElement::minX

◆ minY

float CscWorldElement::minY

◆ minZ

float CscWorldElement::minZ

◆ restitution

float CscWorldElement::restitution = 0.3

◆ width

float CscWorldElement::width = 0

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