fixed the mouse-over sensor,
[blender-staging.git] / extern / bullet / Bullet / CollisionShapes / CylinderShape.h
1 /*
2  * Copyright (c) 2005 Erwin Coumans http://www.erwincoumans.com
3  *
4  * Permission to use, copy, modify, distribute and sell this software
5  * and its documentation for any purpose is hereby granted without fee,
6  * provided that the above copyright notice appear in all copies.
7  * Erwin Coumans makes no representations about the suitability 
8  * of this software for any purpose.  
9  * It is provided "as is" without express or implied warranty.
10  */
11
12 #ifndef CYLINDER_MINKOWSKI_H
13 #define CYLINDER_MINKOWSKI_H
14
15 #include "BoxShape.h"
16 #include "BroadphaseCollision/BroadphaseProxy.h" // for the types
17 #include "SimdVector3.h"
18
19 /// implements cylinder shape interface
20 class CylinderShape : public BoxShape
21
22 {
23
24 public:
25         CylinderShape (const SimdVector3& halfExtents);
26         
27
28         virtual SimdVector3     LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const;
29
30         virtual SimdVector3     LocalGetSupportingVertex(const SimdVector3& vec) const
31         {
32
33                 SimdVector3 supVertex;
34                 supVertex = LocalGetSupportingVertexWithoutMargin(vec);
35                 
36                 if ( GetMargin()!=0.f )
37                 {
38                         SimdVector3 vecnorm = vec;
39                         if (vecnorm .length2() == 0.f)
40                         {
41                                 vecnorm.setValue(-1.f,-1.f,-1.f);
42                         } 
43                         vecnorm.normalize();
44                         supVertex+= GetMargin() * vecnorm;
45                 }
46                 return supVertex;
47         }
48
49
50         //use box inertia
51         //      virtual void    CalculateLocalInertia(SimdScalar mass,SimdVector3& inertia);
52
53         virtual int     GetShapeType() const
54         {
55                 return CYLINDER_SHAPE_PROXYTYPE;
56         }
57         
58
59
60 };
61
62 class CylinderShapeX : public CylinderShape
63 {
64 public:
65         CylinderShapeX (const SimdVector3& halfExtents);
66
67         virtual SimdVector3     LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const;
68 };
69
70 class CylinderShapeZ : public CylinderShape
71 {
72 public:
73         CylinderShapeZ (const SimdVector3& halfExtents);
74
75         virtual SimdVector3     LocalGetSupportingVertexWithoutMargin(const SimdVector3& vec)const;
76
77 };
78
79
80 #endif //CYLINDER_MINKOWSKI_H