~ubuntu-branches/ubuntu/lucid/blender/lucid

« back to all changes in this revision

Viewing changes to extern/bullet2/src/BulletCollision/CollisionShapes/btBoxShape.h

  • Committer: Bazaar Package Importer
  • Author(s): Chris Coulson
  • Date: 2009-08-06 22:32:19 UTC
  • mfrom: (1.2.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20090806223219-8z4eej1u8levu4pz
Tags: 2.49a+dfsg-0ubuntu1
* Merge from debian unstable, remaining changes:
  - debian/control: Build-depend on python-2.6 rather than python-2.5.
  - debian/misc/*.desktop: Add Spanish translation to .desktop 
    files.
  - debian/pyversions: 2.6.
  - debian/rules: Clean *.o of source/blender/python/api2_2x/
* New upstream release (LP: #382153).
* Refreshed patches:
  - 01_sanitize_sys.patch
  - 02_tmp_in_HOME
  - 10_use_systemwide_ftgl
  - 70_portability_platform_detection
* Removed patches merged upstream:
  - 30_fix_python_syntax_warning
  - 90_ubuntu_ffmpeg_52_changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#include "btPolyhedralConvexShape.h"
20
20
#include "btCollisionMargin.h"
21
21
#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
22
 
#include "LinearMath/btPoint3.h"
 
22
#include "LinearMath/btVector3.h"
23
23
#include "LinearMath/btMinMax.h"
24
24
 
25
25
///The btBoxShape is a box primitive around the origin, its sides axis aligned with length specified by half extents, in local shape coordinates. When used as part of a btCollisionObject or btRigidBody it will be an oriented box in world space.
45
45
        }
46
46
        
47
47
 
48
 
        virtual int     getShapeType() const { return BOX_SHAPE_PROXYTYPE;}
49
 
 
50
48
        virtual btVector3       localGetSupportingVertex(const btVector3& vec) const
51
49
        {
52
50
                btVector3 halfExtents = getHalfExtentsWithoutMargin();
82
80
        }
83
81
 
84
82
 
85
 
        btBoxShape( const btVector3& boxHalfExtents)
 
83
        btBoxShape( const btVector3& boxHalfExtents) 
 
84
                : btPolyhedralConvexShape()
86
85
        {
 
86
                m_shapeType = BOX_SHAPE_PROXYTYPE;
87
87
                btVector3 margin(getMargin(),getMargin(),getMargin());
88
88
                m_implicitShapeDimensions = (boxHalfExtents * m_localScaling) - margin;
89
89
        };
117
117
 
118
118
        virtual void    calculateLocalInertia(btScalar mass,btVector3& inertia) const;
119
119
 
120
 
        virtual void getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const
 
120
        virtual void getPlane(btVector3& planeNormal,btVector3& planeSupport,int i ) const
121
121
        {
122
122
                //this plane might not be aligned...
123
123
                btVector4 plane ;
161
161
                switch (i)
162
162
                {
163
163
                case 0:
164
 
                        plane.setValue(btScalar(1.),btScalar(0.),btScalar(0.));
165
 
                        plane[3] = -halfExtents.x();
 
164
                        plane.setValue(btScalar(1.),btScalar(0.),btScalar(0.),-halfExtents.x());
166
165
                        break;
167
166
                case 1:
168
 
                        plane.setValue(btScalar(-1.),btScalar(0.),btScalar(0.));
169
 
                        plane[3] = -halfExtents.x();
 
167
                        plane.setValue(btScalar(-1.),btScalar(0.),btScalar(0.),-halfExtents.x());
170
168
                        break;
171
169
                case 2:
172
 
                        plane.setValue(btScalar(0.),btScalar(1.),btScalar(0.));
173
 
                        plane[3] = -halfExtents.y();
 
170
                        plane.setValue(btScalar(0.),btScalar(1.),btScalar(0.),-halfExtents.y());
174
171
                        break;
175
172
                case 3:
176
 
                        plane.setValue(btScalar(0.),btScalar(-1.),btScalar(0.));
177
 
                        plane[3] = -halfExtents.y();
 
173
                        plane.setValue(btScalar(0.),btScalar(-1.),btScalar(0.),-halfExtents.y());
178
174
                        break;
179
175
                case 4:
180
 
                        plane.setValue(btScalar(0.),btScalar(0.),btScalar(1.));
181
 
                        plane[3] = -halfExtents.z();
 
176
                        plane.setValue(btScalar(0.),btScalar(0.),btScalar(1.),-halfExtents.z());
182
177
                        break;
183
178
                case 5:
184
 
                        plane.setValue(btScalar(0.),btScalar(0.),btScalar(-1.));
185
 
                        plane[3] = -halfExtents.z();
 
179
                        plane.setValue(btScalar(0.),btScalar(0.),btScalar(-1.),-halfExtents.z());
186
180
                        break;
187
181
                default:
188
 
                        assert(0);
 
182
                        btAssert(0);
189
183
                }
190
184
        }
191
185
 
192
186
        
193
 
        virtual void getEdge(int i,btPoint3& pa,btPoint3& pb) const
 
187
        virtual void getEdge(int i,btVector3& pa,btVector3& pb) const
194
188
        //virtual void getEdge(int i,Edge& edge) const
195
189
        {
196
190
                int edgeVert0 = 0;
261
255
 
262
256
 
263
257
        
264
 
        virtual bool isInside(const btPoint3& pt,btScalar tolerance) const
 
258
        virtual bool isInside(const btVector3& pt,btScalar tolerance) const
265
259
        {
266
260
                btVector3 halfExtents = getHalfExtentsWithoutMargin();
267
261
 
312
306
                        penetrationVector.setValue(btScalar(0.),btScalar(0.),btScalar(-1.));
313
307
                        break;
314
308
                default:
315
 
                        assert(0);
 
309
                        btAssert(0);
316
310
                }
317
311
        }
318
312