Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 27, 2011, 7:43:24 AM (14 years ago)
Author:
rgrieder
Message:

Updated Bullet Physics Engine from v2.74 to v2.77

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/kicklib/src/external/bullet/BulletCollision/CollisionShapes/btShapeHull.cpp

    r5781 r7983  
    11/*
    2 btbtShapeHull implemented by John McCutchan.
    3 
    42Bullet Continuous Collision Detection and Physics Library
    5 Copyright (c) 2003-2008 Erwin Coumans  http://bulletphysics.com
     3Copyright (c) 2003-2009 Erwin Coumans  http://bulletphysics.org
    64
    75This software is provided 'as-is', without any express or implied warranty.
    86In 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,
     7Permission is granted to anyone to use this software for any purpose, 
     8including commercial applications, and to alter it and redistribute it freely, 
    119subject to the following restrictions:
    1210
     
    1614*/
    1715
     16//btShapeHull was implemented by John McCutchan.
     17
     18
    1819#include "btShapeHull.h"
    1920#include "LinearMath/btConvexHull.h"
    2021
    2122#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 };
    6823
    6924btShapeHull::btShapeHull (const btConvexShape* shape)
     
    9348                                btVector3 norm;
    9449                                m_shape->getPreferredPenetrationDirection(i,norm);
    95                                 btUnitSpherePoints[numSampleDirections] = norm;
     50                                getUnitSpherePoints()[numSampleDirections] = norm;
    9651                                numSampleDirections++;
    9752                        }
     
    10358        for (i = 0; i < numSampleDirections; i++)
    10459        {
    105                 supportPoints[i] = m_shape->localGetSupportingVertex(btUnitSpherePoints[i]);
     60                supportPoints[i] = m_shape->localGetSupportingVertex(getUnitSpherePoints()[i]);
    10661        }
    10762
     
    163118}
    164119
     120
     121btVector3* 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.