9 #ifndef CscWorldElement_h
10 #define CscWorldElement_h
18 using std::stringstream, std::istringstream, std::endl, std::ios, std::numeric_limits;
33 vector<CscWorldElementPart *> * parts =
nullptr,
34 vector<CscPoint3d *> * positions =
nullptr,
35 vector<CscPoint3d *> * normals =
nullptr,
36 vector<CscPolygon *> * polygons =
nullptr,
37 vector<const CscLocationTag *> * locationTags =
nullptr,
50 virtual CscPoint3d getMinPositionInWorldCoordinates()
const;
62 void setPosition(
float x,
float y,
float z);
71 const CscPoint3d * getRotationEulerAsPoint()
const;
76 void setRotationEuler(
double x,
double y,
double z);
81 void setRotationQuaternion(
double w,
double x,
double y,
double z);
83 bool isIn3DArea(
const CscArea3d *area)
const;
85 const string & getName()
const;
107 float restitution = 0.3;
108 float dampingLinear = 0.3;
109 float dampingAngular = 0.3;
110 float friction = 1.0;
111 bool collideWithOthers =
true;
113 float certitude = 0.0;
115 float * getVerticesArray()
const;
116 float * getPolygonsArray()
const;
117 int getVerticesCount()
const;
118 int getPolygonsCount()
const;
120 void repositionateToZeroOriginPositions();
121 void repositionateToZeroOriginPolygons();
126 vector<CscPoint3d *> * getPositions()
const;
131 vector<CscPolygon *> * getPolygons()
const;
137 vector<CscPolygon *> getPolygonsInWorldCoordinates()
const;
144 vector<CscPoint3d *> getYPlanSlicePoints(
double sliceY,
double precisionCm = 5.0)
const;
149 vector<CscPoint3d *> * getNormals()
const;
154 const vector<CscWorldElementPart *> * getParts()
const;
162 vector<CscPoint3d *> * getReconstructedVerticesFromPolygons(
const int stepInCm = 10)
const;
168 unsigned long long numericId;
169 if (lastNumericId >= MAX_NUMERIC_ID - 2) {
170 LOG_WARN(
"Csc objects counter reached max and starts over at min value");
171 numericId = MIN_NUMERIC_ID;
173 numericId = ++lastNumericId;
184 const CscLocationTag* getLocationTagByName(
const string & name)
const;
190 void forcePolygons(
const vector<CscPolygon *> & newPolygons);
192 void addTag(
const string &tag);
193 void removeTag(
const string &tag);
194 bool hasTag(
const string &tag)
const;
199 const double *
const getRotationQuaternionArray()
const;
205 inline static const unsigned long long MIN_NUMERIC_ID = numeric_limits<unsigned long long>::min();
206 inline static const unsigned long long MAX_NUMERIC_ID = numeric_limits<unsigned long long>::max();
207 inline static unsigned long long lastNumericId = CscWorldElement::MIN_NUMERIC_ID;
216 double rotationQuaternion[4];
218 vector<CscPoint3d *> * positions;
221 vector<CscPoint3d *> * normals;
222 vector<CscPolygon *> * polygons;
224 vector<CscWorldElementPart *> * parts;
235 virtual const CscPoint3d &getBaseRotation()
const;