Changeset 7983 for code/branches/kicklib/src/external/bullet/BulletCollision/CollisionShapes/btShapeHull.cpp
- Timestamp:
- Feb 27, 2011, 7:43:24 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/kicklib/src/external/bullet/BulletCollision/CollisionShapes/btShapeHull.cpp
r5781 r7983 1 1 /* 2 btbtShapeHull implemented by John McCutchan.3 4 2 Bullet Continuous Collision Detection and Physics Library 5 Copyright (c) 2003-200 8 Erwin Coumans http://bulletphysics.com3 Copyright (c) 2003-2009 Erwin Coumans http://bulletphysics.org 6 4 7 5 This software is provided 'as-is', without any express or implied warranty. 8 6 In no event will the authors be held liable for any damages arising from the use of this software. 9 Permission is granted to anyone to use this software for any purpose, 10 including commercial applications, and to alter it and redistribute it freely, 7 Permission is granted to anyone to use this software for any purpose, 8 including commercial applications, and to alter it and redistribute it freely, 11 9 subject to the following restrictions: 12 10 … … 16 14 */ 17 15 16 //btShapeHull was implemented by John McCutchan. 17 18 18 19 #include "btShapeHull.h" 19 20 #include "LinearMath/btConvexHull.h" 20 21 21 22 #define NUM_UNITSPHERE_POINTS 42 22 23 static btVector3 btUnitSpherePoints[NUM_UNITSPHERE_POINTS+MAX_PREFERRED_PENETRATION_DIRECTIONS*2] =24 {25 btVector3(btScalar(0.000000) , btScalar(-0.000000),btScalar(-1.000000)),26 btVector3(btScalar(0.723608) , btScalar(-0.525725),btScalar(-0.447219)),27 btVector3(btScalar(-0.276388) , btScalar(-0.850649),btScalar(-0.447219)),28 btVector3(btScalar(-0.894426) , btScalar(-0.000000),btScalar(-0.447216)),29 btVector3(btScalar(-0.276388) , btScalar(0.850649),btScalar(-0.447220)),30 btVector3(btScalar(0.723608) , btScalar(0.525725),btScalar(-0.447219)),31 btVector3(btScalar(0.276388) , btScalar(-0.850649),btScalar(0.447220)),32 btVector3(btScalar(-0.723608) , btScalar(-0.525725),btScalar(0.447219)),33 btVector3(btScalar(-0.723608) , btScalar(0.525725),btScalar(0.447219)),34 btVector3(btScalar(0.276388) , btScalar(0.850649),btScalar(0.447219)),35 btVector3(btScalar(0.894426) , btScalar(0.000000),btScalar(0.447216)),36 btVector3(btScalar(-0.000000) , btScalar(0.000000),btScalar(1.000000)),37 btVector3(btScalar(0.425323) , btScalar(-0.309011),btScalar(-0.850654)),38 btVector3(btScalar(-0.162456) , btScalar(-0.499995),btScalar(-0.850654)),39 btVector3(btScalar(0.262869) , btScalar(-0.809012),btScalar(-0.525738)),40 btVector3(btScalar(0.425323) , btScalar(0.309011),btScalar(-0.850654)),41 btVector3(btScalar(0.850648) , btScalar(-0.000000),btScalar(-0.525736)),42 btVector3(btScalar(-0.525730) , btScalar(-0.000000),btScalar(-0.850652)),43 btVector3(btScalar(-0.688190) , btScalar(-0.499997),btScalar(-0.525736)),44 btVector3(btScalar(-0.162456) , btScalar(0.499995),btScalar(-0.850654)),45 btVector3(btScalar(-0.688190) , btScalar(0.499997),btScalar(-0.525736)),46 btVector3(btScalar(0.262869) , btScalar(0.809012),btScalar(-0.525738)),47 btVector3(btScalar(0.951058) , btScalar(0.309013),btScalar(0.000000)),48 btVector3(btScalar(0.951058) , btScalar(-0.309013),btScalar(0.000000)),49 btVector3(btScalar(0.587786) , btScalar(-0.809017),btScalar(0.000000)),50 btVector3(btScalar(0.000000) , btScalar(-1.000000),btScalar(0.000000)),51 btVector3(btScalar(-0.587786) , btScalar(-0.809017),btScalar(0.000000)),52 btVector3(btScalar(-0.951058) , btScalar(-0.309013),btScalar(-0.000000)),53 btVector3(btScalar(-0.951058) , btScalar(0.309013),btScalar(-0.000000)),54 btVector3(btScalar(-0.587786) , btScalar(0.809017),btScalar(-0.000000)),55 btVector3(btScalar(-0.000000) , btScalar(1.000000),btScalar(-0.000000)),56 btVector3(btScalar(0.587786) , btScalar(0.809017),btScalar(-0.000000)),57 btVector3(btScalar(0.688190) , btScalar(-0.499997),btScalar(0.525736)),58 btVector3(btScalar(-0.262869) , btScalar(-0.809012),btScalar(0.525738)),59 btVector3(btScalar(-0.850648) , btScalar(0.000000),btScalar(0.525736)),60 btVector3(btScalar(-0.262869) , btScalar(0.809012),btScalar(0.525738)),61 btVector3(btScalar(0.688190) , btScalar(0.499997),btScalar(0.525736)),62 btVector3(btScalar(0.525730) , btScalar(0.000000),btScalar(0.850652)),63 btVector3(btScalar(0.162456) , btScalar(-0.499995),btScalar(0.850654)),64 btVector3(btScalar(-0.425323) , btScalar(-0.309011),btScalar(0.850654)),65 btVector3(btScalar(-0.425323) , btScalar(0.309011),btScalar(0.850654)),66 btVector3(btScalar(0.162456) , btScalar(0.499995),btScalar(0.850654))67 };68 23 69 24 btShapeHull::btShapeHull (const btConvexShape* shape) … … 93 48 btVector3 norm; 94 49 m_shape->getPreferredPenetrationDirection(i,norm); 95 btUnitSpherePoints[numSampleDirections] = norm;50 getUnitSpherePoints()[numSampleDirections] = norm; 96 51 numSampleDirections++; 97 52 } … … 103 58 for (i = 0; i < numSampleDirections; i++) 104 59 { 105 supportPoints[i] = m_shape->localGetSupportingVertex( btUnitSpherePoints[i]);60 supportPoints[i] = m_shape->localGetSupportingVertex(getUnitSpherePoints()[i]); 106 61 } 107 62 … … 163 118 } 164 119 120 121 btVector3* btShapeHull::getUnitSpherePoints() 122 { 123 static btVector3 sUnitSpherePoints[NUM_UNITSPHERE_POINTS+MAX_PREFERRED_PENETRATION_DIRECTIONS*2] = 124 { 125 btVector3(btScalar(0.000000) , btScalar(-0.000000),btScalar(-1.000000)), 126 btVector3(btScalar(0.723608) , btScalar(-0.525725),btScalar(-0.447219)), 127 btVector3(btScalar(-0.276388) , btScalar(-0.850649),btScalar(-0.447219)), 128 btVector3(btScalar(-0.894426) , btScalar(-0.000000),btScalar(-0.447216)), 129 btVector3(btScalar(-0.276388) , btScalar(0.850649),btScalar(-0.447220)), 130 btVector3(btScalar(0.723608) , btScalar(0.525725),btScalar(-0.447219)), 131 btVector3(btScalar(0.276388) , btScalar(-0.850649),btScalar(0.447220)), 132 btVector3(btScalar(-0.723608) , btScalar(-0.525725),btScalar(0.447219)), 133 btVector3(btScalar(-0.723608) , btScalar(0.525725),btScalar(0.447219)), 134 btVector3(btScalar(0.276388) , btScalar(0.850649),btScalar(0.447219)), 135 btVector3(btScalar(0.894426) , btScalar(0.000000),btScalar(0.447216)), 136 btVector3(btScalar(-0.000000) , btScalar(0.000000),btScalar(1.000000)), 137 btVector3(btScalar(0.425323) , btScalar(-0.309011),btScalar(-0.850654)), 138 btVector3(btScalar(-0.162456) , btScalar(-0.499995),btScalar(-0.850654)), 139 btVector3(btScalar(0.262869) , btScalar(-0.809012),btScalar(-0.525738)), 140 btVector3(btScalar(0.425323) , btScalar(0.309011),btScalar(-0.850654)), 141 btVector3(btScalar(0.850648) , btScalar(-0.000000),btScalar(-0.525736)), 142 btVector3(btScalar(-0.525730) , btScalar(-0.000000),btScalar(-0.850652)), 143 btVector3(btScalar(-0.688190) , btScalar(-0.499997),btScalar(-0.525736)), 144 btVector3(btScalar(-0.162456) , btScalar(0.499995),btScalar(-0.850654)), 145 btVector3(btScalar(-0.688190) , btScalar(0.499997),btScalar(-0.525736)), 146 btVector3(btScalar(0.262869) , btScalar(0.809012),btScalar(-0.525738)), 147 btVector3(btScalar(0.951058) , btScalar(0.309013),btScalar(0.000000)), 148 btVector3(btScalar(0.951058) , btScalar(-0.309013),btScalar(0.000000)), 149 btVector3(btScalar(0.587786) , btScalar(-0.809017),btScalar(0.000000)), 150 btVector3(btScalar(0.000000) , btScalar(-1.000000),btScalar(0.000000)), 151 btVector3(btScalar(-0.587786) , btScalar(-0.809017),btScalar(0.000000)), 152 btVector3(btScalar(-0.951058) , btScalar(-0.309013),btScalar(-0.000000)), 153 btVector3(btScalar(-0.951058) , btScalar(0.309013),btScalar(-0.000000)), 154 btVector3(btScalar(-0.587786) , btScalar(0.809017),btScalar(-0.000000)), 155 btVector3(btScalar(-0.000000) , btScalar(1.000000),btScalar(-0.000000)), 156 btVector3(btScalar(0.587786) , btScalar(0.809017),btScalar(-0.000000)), 157 btVector3(btScalar(0.688190) , btScalar(-0.499997),btScalar(0.525736)), 158 btVector3(btScalar(-0.262869) , btScalar(-0.809012),btScalar(0.525738)), 159 btVector3(btScalar(-0.850648) , btScalar(0.000000),btScalar(0.525736)), 160 btVector3(btScalar(-0.262869) , btScalar(0.809012),btScalar(0.525738)), 161 btVector3(btScalar(0.688190) , btScalar(0.499997),btScalar(0.525736)), 162 btVector3(btScalar(0.525730) , btScalar(0.000000),btScalar(0.850652)), 163 btVector3(btScalar(0.162456) , btScalar(-0.499995),btScalar(0.850654)), 164 btVector3(btScalar(-0.425323) , btScalar(-0.309011),btScalar(0.850654)), 165 btVector3(btScalar(-0.425323) , btScalar(0.309011),btScalar(0.850654)), 166 btVector3(btScalar(0.162456) , btScalar(0.499995),btScalar(0.850654)) 167 }; 168 return sUnitSpherePoints; 169 } 170
Note: See TracChangeset
for help on using the changeset viewer.