From 824a16d3de1a7b952d6c3cf2757202a368b47499 Mon Sep 17 00:00:00 2001 From: "chappuis.daniel" Date: Mon, 6 Jul 2009 19:42:50 +0000 Subject: [PATCH] git-svn-id: https://reactphysics3d.googlecode.com/svn/trunk@165 92aac97c-a6ce-11dd-a772-7fcde58d38e6 --- .../constraint/EdgeEdgeContact.cpp | 35 ++++++++++++ .../constraint/EdgeEdgeContact.h | 55 +++++++++++++++++++ .../constraint/EdgeVertexContact.cpp | 35 ++++++++++++ .../constraint/EdgeVertexContact.h | 54 ++++++++++++++++++ .../constraint/FaceEdgeContact.cpp | 37 +++++++++++++ .../constraint/FaceEdgeContact.h | 54 ++++++++++++++++++ .../constraint/FaceFaceContact.cpp | 35 ++++++++++++ .../constraint/FaceFaceContact.h | 54 ++++++++++++++++++ .../constraint/FaceVertexContact.cpp | 35 ++++++++++++ .../constraint/FaceVertexContact.h | 54 ++++++++++++++++++ .../constraint/VertexVertexContact.cpp | 35 ++++++++++++ .../constraint/VertexVertexContact.h | 55 +++++++++++++++++++ 12 files changed, 538 insertions(+) create mode 100644 sources/reactphysics3d/constraint/EdgeEdgeContact.cpp create mode 100644 sources/reactphysics3d/constraint/EdgeEdgeContact.h create mode 100644 sources/reactphysics3d/constraint/EdgeVertexContact.cpp create mode 100644 sources/reactphysics3d/constraint/EdgeVertexContact.h create mode 100644 sources/reactphysics3d/constraint/FaceEdgeContact.cpp create mode 100644 sources/reactphysics3d/constraint/FaceEdgeContact.h create mode 100644 sources/reactphysics3d/constraint/FaceFaceContact.cpp create mode 100644 sources/reactphysics3d/constraint/FaceFaceContact.h create mode 100644 sources/reactphysics3d/constraint/FaceVertexContact.cpp create mode 100644 sources/reactphysics3d/constraint/FaceVertexContact.h create mode 100644 sources/reactphysics3d/constraint/VertexVertexContact.cpp create mode 100644 sources/reactphysics3d/constraint/VertexVertexContact.h diff --git a/sources/reactphysics3d/constraint/EdgeEdgeContact.cpp b/sources/reactphysics3d/constraint/EdgeEdgeContact.cpp new file mode 100644 index 00000000..e29e58c6 --- /dev/null +++ b/sources/reactphysics3d/constraint/EdgeEdgeContact.cpp @@ -0,0 +1,35 @@ +/*************************************************************************** +* Copyright (C) 2009 Daniel Chappuis * +**************************************************************************** +* This file is part of ReactPhysics3D. * +* * +* ReactPhysics3D is free software: you can redistribute it and/or modify * +* it under the terms of the GNU Lesser General Public License as published * +* by the Free Software Foundation, either version 3 of the License, or * +* (at your option) any later version. * +* * +* ReactPhysics3D is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU Lesser General Public License for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with ReactPhysics3D. If not, see . * +***************************************************************************/ + +// Libraries +#include "EdgeEdgeContact.h" + +// We want to use the ReactPhysics3D namespace +using namespace reactphysics3d; + +// Constructor +EdgeEdgeContact::EdgeEdgeContact(Body& body1, Body& body2, const Vector3D normalVector, const Segment3D& contactSegment) + :Contact(body1, body2, normalVector), contactSegment(contactSegment) { + +} + +// Destructor +EdgeEdgeContact::~EdgeEdgeContact() { + +} diff --git a/sources/reactphysics3d/constraint/EdgeEdgeContact.h b/sources/reactphysics3d/constraint/EdgeEdgeContact.h new file mode 100644 index 00000000..2309fb23 --- /dev/null +++ b/sources/reactphysics3d/constraint/EdgeEdgeContact.h @@ -0,0 +1,55 @@ +/*************************************************************************** +* Copyright (C) 2009 Daniel Chappuis * +**************************************************************************** +* This file is part of ReactPhysics3D. * +* * +* ReactPhysics3D is free software: you can redistribute it and/or modify * +* it under the terms of the GNU Lesser General Public License as published * +* by the Free Software Foundation, either version 3 of the License, or * +* (at your option) any later version. * +* * +* ReactPhysics3D is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU Lesser General Public License for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with ReactPhysics3D. If not, see . * +***************************************************************************/ + +#ifndef EDGEEDGECONTACT_H +#define EDGEEDGECONTACT_H + +// Libraries +#include "Contact.h" +#include "../mathematics/mathematics.h" + +// ReactPhysics3D namespace +namespace reactphysics3d { + +/* ------------------------------------------------------------------- + Class EdgeEdgeContact : + This class represents a edge-edge collision contact between two + bodies in the physics engine. + ------------------------------------------------------------------- +*/ +class EdgeEdgeContact : public Contact { + private : + Segment3D contactSegment; // Contact segment + + public : + EdgeEdgeContact(Body& body1, Body& body2, const Vector3D normalVector, const Segment3D& contactSegment); // Constructor + virtual ~EdgeEdgeContact(); // Destructor + + Segment3D getContactSegment() const; // Return the contact segment +}; + +// Return the contact segment +inline Segment3D EdgeEdgeContact::getContactSegment() const { + return contactSegment; +} + +} // End of the ReactPhysics3D namespace + +#endif + diff --git a/sources/reactphysics3d/constraint/EdgeVertexContact.cpp b/sources/reactphysics3d/constraint/EdgeVertexContact.cpp new file mode 100644 index 00000000..b0ccd742 --- /dev/null +++ b/sources/reactphysics3d/constraint/EdgeVertexContact.cpp @@ -0,0 +1,35 @@ +/*************************************************************************** +* Copyright (C) 2009 Daniel Chappuis * +**************************************************************************** +* This file is part of ReactPhysics3D. * +* * +* ReactPhysics3D is free software: you can redistribute it and/or modify * +* it under the terms of the GNU Lesser General Public License as published * +* by the Free Software Foundation, either version 3 of the License, or * +* (at your option) any later version. * +* * +* ReactPhysics3D is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU Lesser General Public License for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with ReactPhysics3D. If not, see . * +***************************************************************************/ + +// Libraries +#include "EdgeVertexContact.h" + +// We want to use the ReactPhysics3D namespace +using namespace reactphysics3d; + +// Constructor +EdgeVertexContact::EdgeVertexContact(Body& body1, Body& body2, const Vector3D& normalVector, const Vector3D& contactVertex) + :Contact(body1, body2, normalVector), contactVertex(contactVertex) { + +} + +// Destructor +EdgeVertexContact::~EdgeVertexContact() { + +} diff --git a/sources/reactphysics3d/constraint/EdgeVertexContact.h b/sources/reactphysics3d/constraint/EdgeVertexContact.h new file mode 100644 index 00000000..c79614d8 --- /dev/null +++ b/sources/reactphysics3d/constraint/EdgeVertexContact.h @@ -0,0 +1,54 @@ +/*************************************************************************** +* Copyright (C) 2009 Daniel Chappuis * +**************************************************************************** +* This file is part of ReactPhysics3D. * +* * +* ReactPhysics3D is free software: you can redistribute it and/or modify * +* it under the terms of the GNU Lesser General Public License as published * +* by the Free Software Foundation, either version 3 of the License, or * +* (at your option) any later version. * +* * +* ReactPhysics3D is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU Lesser General Public License for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with ReactPhysics3D. If not, see . * +***************************************************************************/ + +#ifndef EDGEVERTEXCONTACT_H +#define EDGEVERTEXCONTACT_H + +// Libraries +#include "Contact.h" +#include "../mathematics/mathematics.h" + +// ReactPhysics3D namespace +namespace reactphysics3d { + + +/* ------------------------------------------------------------------- + Class EdgeVertexContact : + This class represents a edge-vertex collision contact between two + bodies in the physics engine. + ------------------------------------------------------------------- +*/ +class EdgeVertexContact : public Contact { + private : + Vector3D contactVertex; // Contact vertex + + public : + EdgeVertexContact(Body& body1, Body& body2, const Vector3D& normalVector, const Vector3D& contactVertex); // Constructor + virtual ~EdgeVertexContact(); // Destructor + + Vector3D getContactVertex() const; // Return the contact vertex +}; + +// Return the contact vertex +inline Vector3D EdgeVertexContact::getContactVertex() const { + return contactVertex; +} + +} // End of the ReactPhysics3D namespace +#endif diff --git a/sources/reactphysics3d/constraint/FaceEdgeContact.cpp b/sources/reactphysics3d/constraint/FaceEdgeContact.cpp new file mode 100644 index 00000000..38eb9c28 --- /dev/null +++ b/sources/reactphysics3d/constraint/FaceEdgeContact.cpp @@ -0,0 +1,37 @@ +/*************************************************************************** +* Copyright (C) 2009 Daniel Chappuis * +**************************************************************************** +* This file is part of ReactPhysics3D. * +* * +* ReactPhysics3D is free software: you can redistribute it and/or modify * +* it under the terms of the GNU Lesser General Public License as published * +* by the Free Software Foundation, either version 3 of the License, or * +* (at your option) any later version. * +* * +* ReactPhysics3D is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU Lesser General Public License for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with ReactPhysics3D. If not, see . * +***************************************************************************/ + +// Libraries +#include "FaceEdgeContact.h" + +// We want to use the ReactPhysics3D namespace +using namespace reactphysics3d; + +// Constructor +FaceEdgeContact::FaceEdgeContact(Body& body1, Body& body2, const Vector3D& normalVector, Segment3D& contactSegment) + :Contact(body1, body2, normalVector), contactSegment(contactSegment) { + +} + +// Destructor +FaceEdgeContact::~FaceEdgeContact() { + +} + + diff --git a/sources/reactphysics3d/constraint/FaceEdgeContact.h b/sources/reactphysics3d/constraint/FaceEdgeContact.h new file mode 100644 index 00000000..c613f0ae --- /dev/null +++ b/sources/reactphysics3d/constraint/FaceEdgeContact.h @@ -0,0 +1,54 @@ +/**************************************************************************** +* Copyright (C) 2009 Daniel Chappuis * +**************************************************************************** +* This file is part of ReactPhysics3D. * +* * +* ReactPhysics3D is free software: you can redistribute it and/or modify * +* it under the terms of the GNU Lesser General Public License as published * +* by the Free Software Foundation, either version 3 of the License, or * +* (at your option) any later version. * +* * +* ReactPhysics3D is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU Lesser General Public License for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with ReactPhysics3D. If not, see . * +***************************************************************************/ + +#ifndef FACEEDGECONTACT_H +#define FACEEDGECONTACT_H + +// Libraries +#include "Contact.h" +#include "../mathematics/mathematics.h" + +// ReactPhysics3D namespace +namespace reactphysics3d { + +/* ------------------------------------------------------------------- + Class FaceEdgeContact : + This class represents a face-edge collision contact between two + bodies in the physics engine. + ------------------------------------------------------------------- +*/ +class FaceEdgeContact : public contact { + private : + Segment3D contactSegment; + + public : + FaceEdgeContact(Body& body1, Body& body2, const Vector3D& normalVector, Segment3D& contactSegment); // Constructor + virtual ~FaceEdgeContact(); // Destructor + + Segment3D getContactSegment() const; // Return the contact segment +}; + +// Return the contact segment +inline Segment3D FaceEdgeContact::getContactSegment() const { + return contactSegment; +} + +} // End of the ReactPhysics3D namespace + +#endif diff --git a/sources/reactphysics3d/constraint/FaceFaceContact.cpp b/sources/reactphysics3d/constraint/FaceFaceContact.cpp new file mode 100644 index 00000000..dfe71f70 --- /dev/null +++ b/sources/reactphysics3d/constraint/FaceFaceContact.cpp @@ -0,0 +1,35 @@ +/**************************************************************************** +* Copyright (C) 2009 Daniel Chappuis * +**************************************************************************** +* This file is part of ReactPhysics3D. * +* * +* ReactPhysics3D is free software: you can redistribute it and/or modify * +* it under the terms of the GNU Lesser General Public License as published * +* by the Free Software Foundation, either version 3 of the License, or * +* (at your option) any later version. * +* * +* ReactPhysics3D is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU Lesser General Public License for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with ReactPhysics3D. If not, see . * +***************************************************************************/ + +// Libraries +#include "FaceFaceContact.h" + +// We want to use the ReactPhysics3D namespace +using namespace reactphysics3d; + +// Constructor +FaceFaceContact::FaceFaceContact(Body& body1, Body& body2, const Vector3D& normalVector, const Polygon3D& contactPolygon) + :Contact(body1, body2, normalVector), contactPolygon(contactPolygon) { + +} + +// Destructor +FaceFaceContact::~FaceFaceContact() { + +} diff --git a/sources/reactphysics3d/constraint/FaceFaceContact.h b/sources/reactphysics3d/constraint/FaceFaceContact.h new file mode 100644 index 00000000..2a038c4c --- /dev/null +++ b/sources/reactphysics3d/constraint/FaceFaceContact.h @@ -0,0 +1,54 @@ +/**************************************************************************** +* Copyright (C) 2009 Daniel Chappuis * +**************************************************************************** +* This file is part of ReactPhysics3D. * +* * +* ReactPhysics3D is free software: you can redistribute it and/or modify * +* it under the terms of the GNU Lesser General Public License as published * +* by the Free Software Foundation, either version 3 of the License, or * +* (at your option) any later version. * +* * +* ReactPhysics3D is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU Lesser General Public License for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with ReactPhysics3D. If not, see . * +***************************************************************************/ + +#ifndef FACEFACECONTACT_H +#define FACEFACECONTACT_H + +// Libraries +#include "Contact.h" +#include "../mathematics/mathematics.h" + +// ReactPhysics3D namespace +namespace reactphysics3d { + +/* ------------------------------------------------------------------- + Class FaceFaceContact : + This class represents a face-face collision contact between two + bodies in the physics engine. + ------------------------------------------------------------------- +*/ +class FaceFaceContact : public Contact { + private : + Polygon3D contactPolygon; + + public : + FaceFaceContact(Body& body1, Body& body2, const Vector3D& normalVector, const Polygon3D& contactPolygon); // Constructor + virtual ~FaceFaceContact(); // Destructor + + Polygon3D getContactPolygon() const; // Return the contact polygon + +}; + +// Return the contact polygon +inline Polygon3D FaceFaceContact::getContactPolygon() const { + return contactPolygon; +} + +} // End of the ReactPhysics3D namespace +#endif diff --git a/sources/reactphysics3d/constraint/FaceVertexContact.cpp b/sources/reactphysics3d/constraint/FaceVertexContact.cpp new file mode 100644 index 00000000..af69723a --- /dev/null +++ b/sources/reactphysics3d/constraint/FaceVertexContact.cpp @@ -0,0 +1,35 @@ +/**************************************************************************** +* Copyright (C) 2009 Daniel Chappuis * +**************************************************************************** +* This file is part of ReactPhysics3D. * +* * +* ReactPhysics3D is free software: you can redistribute it and/or modify * +* it under the terms of the GNU Lesser General Public License as published * +* by the Free Software Foundation, either version 3 of the License, or * +* (at your option) any later version. * +* * +* ReactPhysics3D is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU Lesser General Public License for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with ReactPhysics3D. If not, see . * +***************************************************************************/ + +// Libraries +#include "FaceVertexContact.h" + +// We want to use the ReactPhysics3D namespace +using namespace reactphysics3d; + +// Constructor +FaceVertexContact::FaceVertexContact(Body& body1, Body& body2, const Vector3D& normalVector, const Vector3D& contactVertex) + :Contact(body1, body2, normalVector), contactVertex(contactVertex) { + +} + +// Destructor +FaceVertexContact::~FaceVertexContact() { + +} diff --git a/sources/reactphysics3d/constraint/FaceVertexContact.h b/sources/reactphysics3d/constraint/FaceVertexContact.h new file mode 100644 index 00000000..15617346 --- /dev/null +++ b/sources/reactphysics3d/constraint/FaceVertexContact.h @@ -0,0 +1,54 @@ +/**************************************************************************** +* Copyright (C) 2009 Daniel Chappuis * +**************************************************************************** +* This file is part of ReactPhysics3D. * +* * +* ReactPhysics3D is free software: you can redistribute it and/or modify * +* it under the terms of the GNU Lesser General Public License as published * +* by the Free Software Foundation, either version 3 of the License, or * +* (at your option) any later version. * +* * +* ReactPhysics3D is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU Lesser General Public License for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with ReactPhysics3D. If not, see . * +***************************************************************************/ + +#ifndef FACEVERTEXCONTACT_H +#define FACEVERTEXCONTACT_H + +// Libraries +#include "Contact.h" +#include "../mathematics/mathematics.h" + +// ReactPhysics3D namespace +namespace reactphysics3d { + +/* ------------------------------------------------------------------- + Class FaceVertexContact : + This class represents a face-vertex collision contact between two + bodies in the physics engine. + ------------------------------------------------------------------- +*/ +class FaceVertexContact : public Contact { + private : + Vector3D contactVertex; // Contact vertex + + public : + FaceVertexContact(Body& body1, Body& body2, const Vector3D& normalVector, const Vector3D& contactVertex); // Constructor + virtual ~FaceVertexContact(); // Destructor + + Vector3D getContactVertex() const; // Return the contact vertex +}; + +// Return the contact vertex +inline Vector3D FaceVertexContact::getContactVertex() const { + return contactVertex; +} + +} // End of the ReactPhysics3D namespace + +#endif diff --git a/sources/reactphysics3d/constraint/VertexVertexContact.cpp b/sources/reactphysics3d/constraint/VertexVertexContact.cpp new file mode 100644 index 00000000..5ed6b790 --- /dev/null +++ b/sources/reactphysics3d/constraint/VertexVertexContact.cpp @@ -0,0 +1,35 @@ +/**************************************************************************** +* Copyright (C) 2009 Daniel Chappuis * +**************************************************************************** +* This file is part of ReactPhysics3D. * +* * +* ReactPhysics3D is free software: you can redistribute it and/or modify * +* it under the terms of the GNU Lesser General Public License as published * +* by the Free Software Foundation, either version 3 of the License, or * +* (at your option) any later version. * +* * +* ReactPhysics3D is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU Lesser General Public License for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with ReactPhysics3D. If not, see . * +***************************************************************************/ + +// Libraries +#include "VertexVertexContact.h" + +// We want to use the ReactPhysics3D namespace +using namespace reactphysics3d; + +// Constructor +VertexVertexContact::VertexVertexContact(Body& body1, Body& body2, const Vector3D& normalVector, const Vector3D& contactVertex) + :Contact(body1, body2, normalVector), contactVertex(contactVertex) { + +} + +// Destructor +VertexVertexContact::~VertexVertexContact() { + +} diff --git a/sources/reactphysics3d/constraint/VertexVertexContact.h b/sources/reactphysics3d/constraint/VertexVertexContact.h new file mode 100644 index 00000000..6344b065 --- /dev/null +++ b/sources/reactphysics3d/constraint/VertexVertexContact.h @@ -0,0 +1,55 @@ +/**************************************************************************** +* Copyright (C) 2009 Daniel Chappuis * +**************************************************************************** +* This file is part of ReactPhysics3D. * +* * +* ReactPhysics3D is free software: you can redistribute it and/or modify * +* it under the terms of the GNU Lesser General Public License as published * +* by the Free Software Foundation, either version 3 of the License, or * +* (at your option) any later version. * +* * +* ReactPhysics3D is distributed in the hope that it will be useful, * +* but WITHOUT ANY WARRANTY; without even the implied warranty of * +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +* GNU Lesser General Public License for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with ReactPhysics3D. If not, see . * +***************************************************************************/ + +#ifndef VERTEXVERTEXCONTACT_H +#define VERTEXVERTEXCONTACT_H + +// Libraries +#include "Contact.h" +#include "../mathematics/mathematics.h" + +// ReactPhysics3D namespace +namespace reactphysics3d { + +/* ------------------------------------------------------------------- + Class VertexVertexContact : + This class represents a vertex-vertex collision contact between two + bodies in the physics engine. + ------------------------------------------------------------------- +*/ +class VertexVertexContact : public Contact { + private : + Vector3D contactVertex; // Contact vertex + + public : + VertexVertexContact(Body& body1, Body& body2, const Vector3D& normalVector, const Vector3D& contactVertex); // Constructor + virtual ~VertexVertexContact(); // Destructor + + Vector3D getContactVertex() const; // Return the contact vertex + +}; + +// Return the contact vertex +inline Vector3D VertexVertexContact::getContactVertex() const { + return contactVertex; +} + + +} // End of the ReactPhysics3D namespace +#endif