Drop b2d_convexdecomp. no longer necessary.

We now use `thirdparty/misc/triangulator.h` for all physics-related
(collision, navigation) triangulation needs.

Follow-up to #34293.
This commit is contained in:
Rémi Verschelde 2019-12-13 23:23:20 +01:00
parent f18cb89681
commit f111d1aaed
13 changed files with 0 additions and 2284 deletions

View file

@ -115,12 +115,6 @@ Comment: Open Asset Import Library (assimp)
Copyright: 2006-2016, assimp team
License: BSD-3-clause
Files: ./thirdparty/b2d_convexdecomp/
Comment: Box2D (ConvexDecomp)
Copyright: 2007, Eric Jordan
2006-2009, Erin Catto
License: Zlib
Files: ./thirdparty/bullet/
Comment: Bullet Continuous Collision Detection and Physics Library
Copyright: 2003-2013, Erwin Coumans

View file

@ -97,8 +97,6 @@ void Geometry::MeshData::optimize_vertices() {
vertices = new_vertices;
}
Vector<Vector<Vector2> > (*Geometry::_decompose_func)(const Vector<Vector2> &p_polygon) = NULL;
struct _FaceClassify {
struct _Link {

View file

@ -853,15 +853,6 @@ public:
return triangles;
}
static Vector<Vector<Vector2> > (*_decompose_func)(const Vector<Vector2> &p_polygon);
static Vector<Vector<Vector2> > decompose_polygon(const Vector<Vector2> &p_polygon) {
if (_decompose_func)
return _decompose_func(p_polygon);
return Vector<Vector<Vector2> >();
}
static bool is_polygon_clockwise(const Vector<Vector2> &p_polygon) {
int c = p_polygon.size();
if (c < 3)

View file

@ -1,17 +0,0 @@
#!/usr/bin/env python
Import('env')
env.add_source_files(env.drivers_sources, "*.cpp")
# Thirdparty dependencies
thirdparty_dir = "#thirdparty/b2d_convexdecomp/"
thirdparty_sources = [
"b2Polygon.cpp",
"b2Triangle.cpp",
]
thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources]
env_thirdparty = env.Clone()
env_thirdparty.disable_warnings()
env_thirdparty.add_source_files(env.drivers_sources, thirdparty_sources)

View file

@ -1,162 +0,0 @@
/*************************************************************************/
/* b2d_decompose.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "b2d_decompose.h"
#include "thirdparty/b2d_convexdecomp/b2Polygon.h"
namespace b2ConvexDecomp {
void add_to_res(Vector<Vector<Vector2> > &res, const b2Polygon &p_poly) {
Vector<Vector2> arr;
for (int i = 0; i < p_poly.nVertices; i++) {
arr.push_back(Vector2(p_poly.x[i], p_poly.y[i]));
}
res.push_back(arr);
}
static Vector<Vector<Vector2> > _b2d_decompose(const Vector<Vector2> &p_polygon) {
Vector<Vector<Vector2> > res;
if (p_polygon.size() < 3)
return res;
b2Vec2 *polys = memnew_arr(b2Vec2, p_polygon.size());
for (int i = 0; i < p_polygon.size(); i++)
polys[i] = b2Vec2(p_polygon[i].x, p_polygon[i].y);
b2Polygon *p = new b2Polygon(polys, p_polygon.size());
b2Polygon *decomposed = new b2Polygon[p->nVertices - 2]; //maximum number of polys
memdelete_arr(polys);
int32 nPolys = DecomposeConvex(p, decomposed, p->nVertices - 2);
//int32 extra = 0;
for (int32 i = 0; i < nPolys; ++i) {
// b2FixtureDef* toAdd = &pdarray[i+extra];
// *toAdd = *prototype;
//Hmm, shouldn't have to do all this...
b2Polygon curr = decomposed[i];
//TODO ewjordan: move this triangle handling to a better place so that
//it happens even if this convenience function is not called.
if (curr.nVertices == 3) {
//Check here for near-parallel edges, since we can't
//handle this in merge routine
for (int j = 0; j < 3; ++j) {
int32 lower = (j == 0) ? (curr.nVertices - 1) : (j - 1);
int32 middle = j;
int32 upper = (j == curr.nVertices - 1) ? (0) : (j + 1);
float32 dx0 = curr.x[middle] - curr.x[lower];
float32 dy0 = curr.y[middle] - curr.y[lower];
float32 dx1 = curr.x[upper] - curr.x[middle];
float32 dy1 = curr.y[upper] - curr.y[middle];
float32 norm0 = sqrtf(dx0 * dx0 + dy0 * dy0);
float32 norm1 = sqrtf(dx1 * dx1 + dy1 * dy1);
if (!(norm0 > 0.0f && norm1 > 0.0f)) {
//Identical points, don't do anything!
goto Skip;
}
dx0 /= norm0;
dy0 /= norm0;
dx1 /= norm1;
dy1 /= norm1;
float32 cross = dx0 * dy1 - dx1 * dy0;
float32 dot = dx0 * dx1 + dy0 * dy1;
if (fabs(cross) < b2_angularSlop && dot > 0) {
//Angle too close, split the triangle across from this point.
//This is guaranteed to result in two triangles that satisfy
//the tolerance (one of the angles is 90 degrees)
float32 dx2 = curr.x[lower] - curr.x[upper];
float32 dy2 = curr.y[lower] - curr.y[upper];
float32 norm2 = sqrtf(dx2 * dx2 + dy2 * dy2);
if (norm2 == 0.0f) {
goto Skip;
}
dx2 /= norm2;
dy2 /= norm2;
float32 thisArea = curr.GetArea();
float32 thisHeight = 2.0f * thisArea / norm2;
float32 buffer2 = dx2;
dx2 = dy2;
dy2 = -buffer2;
//Make two new polygons
//printf("dx2: %f, dy2: %f, thisHeight: %f, middle: %d\n",dx2,dy2,thisHeight,middle);
float32 newX1[3] = { curr.x[middle] + dx2 * thisHeight, curr.x[lower], curr.x[middle] };
float32 newY1[3] = { curr.y[middle] + dy2 * thisHeight, curr.y[lower], curr.y[middle] };
float32 newX2[3] = { newX1[0], curr.x[middle], curr.x[upper] };
float32 newY2[3] = { newY1[0], curr.y[middle], curr.y[upper] };
b2Polygon p1(newX1, newY1, 3);
b2Polygon p2(newX2, newY2, 3);
if (p1.IsUsable()) {
add_to_res(res, p1);
//++extra;
} else if (B2_POLYGON_REPORT_ERRORS) {
printf("Didn't add unusable polygon. Dumping vertices:\n");
p1.print();
}
if (p2.IsUsable()) {
add_to_res(res, p2);
//p2.AddTo(pdarray[i+extra]);
//bd->CreateFixture(toAdd);
} else if (B2_POLYGON_REPORT_ERRORS) {
printf("Didn't add unusable polygon. Dumping vertices:\n");
p2.print();
}
goto Skip;
}
}
}
if (decomposed[i].IsUsable()) {
add_to_res(res, decomposed[i]);
//decomposed[i].AddTo(*toAdd);
//bd->CreateFixture((const b2FixtureDef*)toAdd);
} else if (B2_POLYGON_REPORT_ERRORS) {
printf("Didn't add unusable polygon. Dumping vertices:\n");
decomposed[i].print();
}
Skip:;
}
//delete[] pdarray;
delete[] decomposed;
delete p;
return res; // pdarray; //needs to be deleted after body is created
}
} // namespace b2ConvexDecomp
Vector<Vector<Vector2> > b2d_decompose(const Vector<Vector2> &p_polygon) {
return b2ConvexDecomp::_b2d_decompose(p_polygon);
}

View file

@ -1,39 +0,0 @@
/*************************************************************************/
/* b2d_decompose.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef B2D_DECOMPOSE_H
#define B2D_DECOMPOSE_H
#include "core/math/vector2.h"
#include "core/vector.h"
Vector<Vector<Vector2> > b2d_decompose(const Vector<Vector2> &p_polygon);
#endif // B2D_DECOMPOSE_H

View file

@ -30,18 +30,9 @@
#include "register_driver_types.h"
#include "core/math/geometry.h"
#include "drivers/png/image_loader_png.h"
#include "drivers/png/resource_saver_png.h"
#ifdef TOOLS_ENABLED
#include "drivers/convex_decomp/b2d_decompose.h"
#endif
#ifdef TOOLS_ENABLED
#include "platform/windows/export/export.h"
#endif
static ImageLoaderPNG *image_loader_png;
static Ref<ResourceSaverPNG> resource_saver_png;
@ -64,10 +55,6 @@ void unregister_core_driver_types() {
}
void register_driver_types() {
#ifdef TOOLS_ENABLED
Geometry::_decompose_func = b2d_decompose;
#endif
}
void unregister_driver_types() {

15
thirdparty/README.md vendored
View file

@ -8,21 +8,6 @@
- License: BSD-3-Clause
## b2d_convexdecomp
- Upstream: https://github.com/erincatto/Box2D/tree/master/Contributions/Utilities/ConvexDecomposition
- Version: git (25615e0, 2015) with modifications
- License: zlib
The files were adapted to Godot by removing the dependency on b2Math (replacing
it by b2Glue.h) and commenting out some verbose printf calls.
Upstream code has not changed in 10 years, no need to keep track of changes.
Important: Some files have Godot-made changes.
They are marked with `// -- GODOT start --` and `// -- GODOT end --`
comments.
## bullet
- Upstream: https://github.com/bulletphysics/bullet3

View file

@ -1,174 +0,0 @@
/*
* Copyright (c) 2006-2009 Erin Catto http://www.gphysics.com
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
#ifndef B2GLUE_H
#define B2GLUE_H
#include "core/math/vector2.h"
#include <limits.h>
namespace b2ConvexDecomp {
typedef real_t float32;
typedef int32_t int32;
static inline float32 b2Sqrt(float32 val) { return Math::sqrt(val); }
#define b2_maxFloat FLT_MAX
#define b2_epsilon CMP_EPSILON
#define b2_pi 3.14159265359f
#define b2_maxPolygonVertices 16
#define b2Max MAX
#define b2Min MIN
#define b2Clamp CLAMP
#define b2Abs ABS
/// A small length used as a collision and constraint tolerance. Usually it is
/// chosen to be numerically significant, but visually insignificant.
#define b2_linearSlop 0.005f
/// A small angle used as a collision and constraint tolerance. Usually it is
/// chosen to be numerically significant, but visually insignificant.
#define b2_angularSlop (2.0f / 180.0f * b2_pi)
/// A 2D column vector.
struct b2Vec2
{
/// Default constructor does nothing (for performance).
b2Vec2() {}
/// Construct using coordinates.
b2Vec2(float32 x, float32 y) : x(x), y(y) {}
/// Set this vector to all zeros.
void SetZero() { x = 0.0f; y = 0.0f; }
/// Set this vector to some specified coordinates.
void Set(float32 x_, float32 y_) { x = x_; y = y_; }
/// Negate this vector.
b2Vec2 operator -() const { b2Vec2 v; v.Set(-x, -y); return v; }
/// Read from and indexed element.
float32 operator () (int32 i) const
{
return (&x)[i];
}
/// Write to an indexed element.
float32& operator () (int32 i)
{
return (&x)[i];
}
/// Add a vector to this vector.
void operator += (const b2Vec2& v)
{
x += v.x; y += v.y;
}
/// Subtract a vector from this vector.
void operator -= (const b2Vec2& v)
{
x -= v.x; y -= v.y;
}
/// Multiply this vector by a scalar.
void operator *= (float32 a)
{
x *= a; y *= a;
}
/// Get the length of this vector (the norm).
float32 Length() const
{
return b2Sqrt(x * x + y * y);
}
/// Get the length squared. For performance, use this instead of
/// b2Vec2::Length (if possible).
float32 LengthSquared() const
{
return x * x + y * y;
}
bool operator==(const b2Vec2& p_v) const {
return x==p_v.x && y==p_v.y;
}
b2Vec2 operator+(const b2Vec2& p_v) const {
return b2Vec2(x+p_v.x,y+p_v.y);
}
b2Vec2 operator-(const b2Vec2& p_v) const {
return b2Vec2(x-p_v.x,y-p_v.y);
}
b2Vec2 operator*(float32 f) const {
return b2Vec2(f*x,f*y);
}
/// Convert this vector into a unit vector. Returns the length.
float32 Normalize()
{
float32 length = Length();
if (length < b2_epsilon)
{
return 0.0f;
}
float32 invLength = 1.0f / length;
x *= invLength;
y *= invLength;
return length;
}
/*
/// Does this vector contain finite coordinates?
bool IsValid() const
{
return b2IsValid(x) && b2IsValid(y);
}
*/
float32 x, y;
};
inline b2Vec2 operator*(float32 f,const b2Vec2& p_v) {
return b2Vec2(f*p_v.x,f*p_v.y);
}
/// Perform the dot product on two vectors.
inline float32 b2Dot(const b2Vec2& a, const b2Vec2& b)
{
return a.x * b.x + a.y * b.y;
}
/// Perform the cross product on two vectors. In 2D this produces a scalar.
inline float32 b2Cross(const b2Vec2& a, const b2Vec2& b)
{
return a.x * b.y - a.y * b.x;
}
/// Perform the cross product on a vector and a scalar. In 2D this produces
/// a vector.
inline b2Vec2 b2Cross(const b2Vec2& a, float32 s)
{
return b2Vec2(s * a.y, -s * a.x);
}
}
#endif

File diff suppressed because it is too large Load diff

View file

@ -1,133 +0,0 @@
/*
* Copyright (c) 2007 Eric Jordan
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
#ifndef B2_POLYGON_H
#define B2_POLYGON_H
#include "b2Triangle.h"
#include "stdio.h"
#include <string.h>
#include <limits.h>
namespace b2ConvexDecomp {
static bool B2_POLYGON_REPORT_ERRORS = false;
class b2Polygon;
int32 remainder(int32 x, int32 modulus);
int32 TriangulatePolygon(float32* xv, float32* yv, int32 vNum, b2Triangle* results);
bool IsEar(int32 i, float32* xv, float32* yv, int32 xvLength); //Not for external use
int32 PolygonizeTriangles(b2Triangle* triangulated, int32 triangulatedLength, b2Polygon* polys, int32 polysLength);
int32 DecomposeConvex(b2Polygon* p, b2Polygon* results, int32 maxPolys);
//void DecomposeConvexAndAddTo(b2Polygon* p, b2Body* bd, b2FixtureDef* prototype);
void ReversePolygon(float32* x, float32* y, int n);
b2Polygon TraceEdge(b2Polygon* p); //For use with self-intersecting polygons, finds outline
class b2Polygon {
public:
const static int32 maxVerticesPerPolygon = b2_maxPolygonVertices;
float32* x; //vertex arrays
float32* y;
int32 nVertices;
float32 area;
bool areaIsSet;
b2Polygon(float32* _x, float32* _y, int32 nVert);
b2Polygon(b2Vec2* v, int32 nVert);
b2Polygon();
~b2Polygon();
float32 GetArea();
void MergeParallelEdges(float32 tolerance);
b2Vec2* GetVertexVecs();
b2Polygon(b2Triangle& t);
void Set(const b2Polygon& p);
bool IsConvex();
bool IsCCW();
bool IsUsable(bool printError);
bool IsUsable();
bool IsSimple();
// void AddTo(b2FixtureDef& pd);
b2Polygon* Add(b2Triangle& t);
void print(){
printFormatted();
/*
for (int32 i=0; i<nVertices; ++i){
printf("i: %d, x:%f, y:%f\n",i,x[i],y[i]);
}
*/
}
void printFormatted(){
printf("float xv[] = {");
for (int32 i=0; i<nVertices; ++i){
printf("%ff,",x[i]);
}
printf("};\nfloat yv[] = {");
for (int32 i=0; i<nVertices; ++i){
printf("%ff,",y[i]);
}
printf("};\n");
}
b2Polygon(const b2Polygon& p){
nVertices = p.nVertices;
area = p.area;
areaIsSet = p.areaIsSet;
x = new float32[nVertices];
y = new float32[nVertices];
memcpy(x, p.x, nVertices * sizeof(float32));
memcpy(y, p.y, nVertices * sizeof(float32));
}
};
const int32 MAX_CONNECTED = 32;
const float32 COLLAPSE_DIST_SQR = CMP_EPSILON*CMP_EPSILON;//0.1f;//1000*CMP_EPSILON*1000*CMP_EPSILON;
class b2PolyNode{
public:
b2Vec2 position;
b2PolyNode* connected[MAX_CONNECTED];
int32 nConnected;
bool visited;
b2PolyNode(b2Vec2& pos);
b2PolyNode();
void AddConnection(b2PolyNode& toMe);
void RemoveConnection(b2PolyNode& fromMe);
void RemoveConnectionByIndex(int32 index);
bool IsConnectedTo(b2PolyNode& me);
b2PolyNode* GetRightestConnection(b2PolyNode* incoming);
b2PolyNode* GetRightestConnection(b2Vec2& incomingDir);
};
b2Polygon ConvexHull(b2Vec2* v, int nVert);
b2Polygon ConvexHull(float32* cloudX, float32* cloudY, int32 nVert);
}
#endif

View file

@ -1,82 +0,0 @@
/*
* Copyright (c) 2007 Eric Jordan
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
#include "b2Triangle.h"
namespace b2ConvexDecomp {
//Constructor automatically fixes orientation to ccw
b2Triangle::b2Triangle(float32 x1, float32 y1, float32 x2, float32 y2, float32 x3, float32 y3){
x = new float32[3];
y = new float32[3];
float32 dx1 = x2-x1;
float32 dx2 = x3-x1;
float32 dy1 = y2-y1;
float32 dy2 = y3-y1;
float32 cross = dx1*dy2-dx2*dy1;
bool ccw = (cross>0);
if (ccw){
x[0] = x1; x[1] = x2; x[2] = x3;
y[0] = y1; y[1] = y2; y[2] = y3;
} else{
x[0] = x1; x[1] = x3; x[2] = x2;
y[0] = y1; y[1] = y3; y[2] = y2;
}
}
b2Triangle::b2Triangle(){
x = new float32[3];
y = new float32[3];
}
b2Triangle::~b2Triangle(){
delete[] x;
delete[] y;
}
void b2Triangle::Set(const b2Triangle& toMe) {
for (int32 i=0; i<3; ++i) {
x[i] = toMe.x[i];
y[i] = toMe.y[i];
}
}
bool b2Triangle::IsInside(float32 _x, float32 _y){
if (_x < x[0] && _x < x[1] && _x < x[2]) return false;
if (_x > x[0] && _x > x[1] && _x > x[2]) return false;
if (_y < y[0] && _y < y[1] && _y < y[2]) return false;
if (_y > y[0] && _y > y[1] && _y > y[2]) return false;
float32 vx2 = _x-x[0]; float32 vy2 = _y-y[0];
float32 vx1 = x[1]-x[0]; float32 vy1 = y[1]-y[0];
float32 vx0 = x[2]-x[0]; float32 vy0 = y[2]-y[0];
float32 dot00 = vx0*vx0+vy0*vy0;
float32 dot01 = vx0*vx1+vy0*vy1;
float32 dot02 = vx0*vx2+vy0*vy2;
float32 dot11 = vx1*vx1+vy1*vy1;
float32 dot12 = vx1*vx2+vy1*vy2;
float32 invDenom = 1.0f / (dot00*dot11 - dot01*dot01);
float32 u = (dot11*dot02 - dot01*dot12)*invDenom;
float32 v = (dot00*dot12 - dot01*dot02)*invDenom;
return ((u>=0)&&(v>=0)&&(u+v<=1));
}
}

View file

@ -1,41 +0,0 @@
/*
* Copyright (c) 2007 Eric Jordan
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
#ifndef B2_TRIANGLE_H
#define B2_TRIANGLE_H
#include "b2Glue.h"
namespace b2ConvexDecomp {
class b2Triangle{
public:
float* x;
float* y;
b2Triangle();
b2Triangle(float32 x1, float32 y1, float32 x2, float32 y2, float32 x3, float32 y3);
~b2Triangle();
bool IsInside(float32 _x, float32 _y);
void Set(const b2Triangle& toMe);
};
}
#endif