6 #include <reactphysics3d/collision/PolygonVertexArray.h>
7 #include <reactphysics3d/collision/PolyhedronMesh.h>
18 using std::unique_ptr;
49 vector<reactphysics3d::PolygonVertexArray::PolygonFace>
faces;
70 for (
const auto& triangleVertex: triangle.
getVertices()) {
80 auto v1Dotv2v3Cross = Vector3::computeDotProduct(v1, Vector3::computeCrossProduct(v2, v3).normalize());
81 return Math::abs(v1Dotv2v3Cross) < 0.001;
91 auto equalVertices = 0;
92 for (
const auto& triangle1Vertex: triangle1.
getVertices()) {
93 for (
const auto& triangle2Vertex: triangle2.
getVertices()) {
97 return equalVertices > 0;
Dynamic physics world class.
Bounding volume interface.
Convex mesh physics primitive.
~ConvexMesh()
Public destructor.
vector< int > facesVerticesCount
unique_ptr< reactphysics3d::PolygonVertexArray > polygonVertexArray
static constexpr float VERTEX_COMPARE_EPSILON
reactphysics3d::PolyhedronMesh * polyhedronMesh
bool isVertexOnTrianglePlane(const Triangle &triangle, const Vector3 &vertex)
Checks if vertex lives on triangle plane.
void createConvexMesh(const vector< Vector3 > &vertices, const vector< int > &facesVerticesCount, const vector< int > &indices, const Vector3 &scale)
Create convex mesh Note: it also translates center into origin.
void destroyCollisionShape() override
Destroy collision shape.
void setScale(const Vector3 &scale) override
Set local scale.
ConvexMesh()
Public constructor.
const vector< Vector3 > & getVertices()
vector< Vector3 > vertices
void createCollisionShape(World *world) override
Create collision shap.
BoundingVolume * clone() const override
Clones this bounding volume.
unique_ptr< ByteBuffer > verticesByteBuffer
vector< reactphysics3d::PolygonVertexArray::PolygonFace > faces
unique_ptr< ByteBuffer > indicesByteBuffer
bool areTrianglesAdjacent(const Triangle &triangle1, const Triangle &triangle2)
Checks if 2 triangles are adjacent.
Triangle entity, this is not directly connectable with physics engine.
const vector< Vector3 > & getVertices() const
Vector3 class representing vector3 mathematical structure and operations with x, y,...
Vector3 & sub(float scalar)
Subtracts a scalar.
Vector3 & set(float x, float y, float z)
Sets this vector3 by its components.
Vector3 & normalize()
Normalizes this vector3.
#define FORBID_CLASS_COPY(CLASS)