Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Simplex1to4Shape.h « CollisionShapes « Bullet « bullet « extern - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7c61cb661d7753c25bfa229c454bd04328aa3435 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
 * Copyright (c) 2005 Erwin Coumans http://continuousphysics.com/Bullet/
 *
 * Permission to use, copy, modify, distribute and sell this software
 * and its documentation for any purpose is hereby granted without fee,
 * provided that the above copyright notice appear in all copies.
 * Erwin Coumans makes no representations about the suitability 
 * of this software for any purpose.  
 * It is provided "as is" without express or implied warranty.
*/
#ifndef BU_SIMPLEX_1TO4_SHAPE
#define BU_SIMPLEX_1TO4_SHAPE


#include <CollisionShapes/PolyhedralConvexShape.h>
#include "BroadphaseCollision/BroadphaseProxy.h"


///BU_Simplex1to4 implements feature based and implicit simplex of up to 4 vertices (tetrahedron, triangle, line, vertex).
class BU_Simplex1to4 : public PolyhedralConvexShape
{
protected:

	int	m_numVertices;
	SimdPoint3	m_vertices[4];

public:
	BU_Simplex1to4();

	BU_Simplex1to4(const SimdPoint3& pt0);
	BU_Simplex1to4(const SimdPoint3& pt0,const SimdPoint3& pt1);
	BU_Simplex1to4(const SimdPoint3& pt0,const SimdPoint3& pt1,const SimdPoint3& pt2);
	BU_Simplex1to4(const SimdPoint3& pt0,const SimdPoint3& pt1,const SimdPoint3& pt2,const SimdPoint3& pt3);

    
	void	Reset()
	{
		m_numVertices = 0;
	}
	

	virtual int	GetShapeType() const{ return TETRAHEDRAL_SHAPE_PROXYTYPE; }

	void AddVertex(const SimdPoint3& pt);

	//PolyhedralConvexShape interface

	virtual int	GetNumVertices() const;

	virtual int GetNumEdges() const;

	virtual void GetEdge(int i,SimdPoint3& pa,SimdPoint3& pb) const;
	
	virtual void GetVertex(int i,SimdPoint3& vtx) const;

	virtual int	GetNumPlanes() const;

	virtual void GetPlane(SimdVector3& planeNormal,SimdPoint3& planeSupport,int i) const;

	virtual int GetIndex(int i) const;

	virtual	bool IsInside(const SimdPoint3& pt,SimdScalar tolerance) const;


	///GetName is for debugging
	virtual  char*	GetName()const { return "BU_Simplex1to4";}

};

#endif //BU_SIMPLEX_1TO4_SHAPE