MCPcopy Create free account
hub / github.com/DanielChappuis/reactphysics3d / getVertex

Method getVertex

src/collision/PolygonVertexArray.cpp:108–129  ·  view source on GitHub ↗

Return the coordinates of a given vertex

Source from the content-addressed store, hash-verified

106
107// Return the coordinates of a given vertex
108Vector3 PolygonVertexArray::getVertex(uint32 vertexIndex) const {
109
110 Vector3 vertex;
111
112 if (mVertexDataType == PolygonVertexArray::VertexDataType::VERTEX_FLOAT_TYPE) {
113 const float* vertices = (float*)(mVerticesStart + vertexIndex * mVerticesStride);
114 vertex.x = decimal(vertices[0]);
115 vertex.y = decimal(vertices[1]);
116 vertex.z = decimal(vertices[2]);
117 }
118 else if (mVertexDataType == PolygonVertexArray::VertexDataType::VERTEX_DOUBLE_TYPE) {
119 const double* vertices = (double*)(mVerticesStart + vertexIndex * mVerticesStride);
120 vertex.x = decimal(vertices[0]);
121 vertex.y = decimal(vertices[1]);
122 vertex.z = decimal(vertices[2]);
123 }
124 else {
125 assert(false);
126 }
127
128 return vertex;
129}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected