예제 #1
0
		public ConvexConvexCreateFunc(ISimplexSolverInterface simplexSolver,IConvexPenetrationDepthSolver depthSolver)
		{
			m_numPerturbationIterations = 0;
			m_minimumPointsPerturbationThreshold =3;
			m_simplexSolver = simplexSolver;
			m_pdSolver = depthSolver;
		}
예제 #2
0
 public ConvexConvexCreateFunc(ISimplexSolverInterface simplexSolver, IConvexPenetrationDepthSolver depthSolver)
 {
     m_numPerturbationIterations          = 0;
     m_minimumPointsPerturbationThreshold = 3;
     m_simplexSolver = simplexSolver;
     m_pdSolver      = depthSolver;
 }
 public ContinuousConvexCollision(ConvexShape shapeA, ConvexShape shapeB, ISimplexSolverInterface simplexSolver, IConvexPenetrationDepthSolver penetrationDepthSolver)
 {
     m_convexA                = shapeA;
     m_convexB1               = shapeB;
     m_simplexSolver          = simplexSolver;
     m_penetrationDepthSolver = penetrationDepthSolver;
 }
 public virtual void Initialize(ConvexShape shapeA, ConvexShape shapeB, ISimplexSolverInterface simplexSolver, IConvexPenetrationDepthSolver penetrationDepthSolver)
 {
     m_convexA                = shapeA;
     m_convexB1               = shapeB;
     m_simplexSolver          = simplexSolver;
     m_penetrationDepthSolver = penetrationDepthSolver;
 }
        public DefaultCollisionConfiguration(DefaultCollisionConstructionInfo constructionInfo)
        {
            m_simplexSolver = BulletGlobals.VoronoiSimplexSolverPool.Get();
            //m_pdSolver = new GjkEpaPenetrationDepthSolver();
            m_pdSolver = new MinkowskiPenetrationDepthSolver();
            m_useEpaPenetrationAlgorithm = true;

            //default CreationFunctions, filling the m_doubleDispatch table
            m_convexConvexCreateFunc         = new ConvexConvexCreateFunc(m_simplexSolver, m_pdSolver);
            m_convexConcaveCreateFunc        = new ConvexConcaveCreateFunc();
            m_swappedConvexConcaveCreateFunc = new SwappedConvexConcaveCreateFunc();
            m_compoundCreateFunc             = new CompoundCreateFunc();
            m_swappedCompoundCreateFunc      = new SwappedCompoundCreateFunc();
            m_emptyCreateFunc = new EmptyCreateFunc();

            m_sphereSphereCF = new SphereSphereCreateFunc();
            m_sphereBoxCF    = new SphereBoxCreateFunc();
            m_boxSphereCF    = new SwappedSphereBoxCreateFunc();

            m_convexAlgo2DCF             = new Convex2dConvex2dCreateFunc(m_simplexSolver, m_pdSolver);
            m_sphereTriangleCF           = new SphereTriangleCreateFunc();
            m_triangleSphereCF           = new SphereTriangleCreateFunc();
            m_triangleSphereCF.m_swapped = true;

            m_boxBoxCF = new BoxBoxCreateFunc();

            //convex versus plane
            m_convexPlaneCF           = new ConvexPlaneCreateFunc();
            m_planeConvexCF           = new ConvexPlaneCreateFunc();
            m_planeConvexCF.m_swapped = true;
        }
예제 #6
0
 public virtual void Initialize(ConvexShape shapeA, ConvexShape shapeB, ISimplexSolverInterface simplexSolver, IConvexPenetrationDepthSolver penetrationDepthSolver)
 {
     m_convexA = shapeA;
     m_convexB1 = shapeB;
     m_simplexSolver = simplexSolver;
     m_penetrationDepthSolver = penetrationDepthSolver;
 }
	public DefaultCollisionConfiguration(DefaultCollisionConstructionInfo constructionInfo)
    {
        m_simplexSolver = BulletGlobals.VoronoiSimplexSolverPool.Get();
        //m_pdSolver = new GjkEpaPenetrationDepthSolver();
        m_pdSolver = new MinkowskiPenetrationDepthSolver();
        m_useEpaPenetrationAlgorithm = true;

	    //default CreationFunctions, filling the m_doubleDispatch table
	    m_convexConvexCreateFunc = new ConvexConvexCreateFunc(m_simplexSolver,m_pdSolver);
	    m_convexConcaveCreateFunc = new ConvexConcaveCreateFunc();
	    m_swappedConvexConcaveCreateFunc = new SwappedConvexConcaveCreateFunc();
	    m_compoundCreateFunc = new CompoundCreateFunc();
	    m_swappedCompoundCreateFunc = new SwappedCompoundCreateFunc();
	    m_emptyCreateFunc = new EmptyCreateFunc();
	
    	m_sphereSphereCF = new SphereSphereCreateFunc();
        m_sphereBoxCF = new SphereBoxCreateFunc();
        m_boxSphereCF = new SwappedSphereBoxCreateFunc();

        m_convexAlgo2DCF = new Convex2dConvex2dCreateFunc(m_simplexSolver, m_pdSolver);
	    m_sphereTriangleCF = new SphereTriangleCreateFunc();
	    m_triangleSphereCF = new SphereTriangleCreateFunc();
	    m_triangleSphereCF.m_swapped = true;
    	
	    m_boxBoxCF = new BoxBoxCreateFunc();

	    //convex versus plane
	    m_convexPlaneCF = new ConvexPlaneCreateFunc();
	    m_planeConvexCF = new ConvexPlaneCreateFunc();
	    m_planeConvexCF.m_swapped = true;
    	
    }
 public ContinuousConvexCollision(ConvexShape convexA, ConvexShape convexB,
                                  ISimplexSolver simplexSolver, IConvexPenetrationDepthSolver penetrationDepthSolver)
 {
     _simplexSolver          = simplexSolver;
     _penetrationDepthSolver = penetrationDepthSolver;
     _convexA = convexA;
     _convexB = convexB;
 }
예제 #9
0
 public ConvexConvexAlgorithm(PersistentManifold manifold, CollisionAlgorithmConstructionInfo collisionAlgorithmConstructionInfo, CollisionObject bodyA, CollisionObject bodyB, ISimplexSolver simplexSolver, IConvexPenetrationDepthSolver penetrationDepthSolver)
     : base(collisionAlgorithmConstructionInfo)
 {
     _gjkPairDetector = new GjkPairDetector(null, null, simplexSolver, penetrationDepthSolver);
     _ownManifold = false;
     _manifold = manifold;
     _lowLevelOfDetail = false;
 }
예제 #10
0
        public ContinuousConvexCollision(ConvexShape shapeA, ConvexShape shapeB, ISimplexSolverInterface simplexSolver, IConvexPenetrationDepthSolver penetrationDepthSolver)
        {
            m_convexA = shapeA;
            m_convexB = shapeB;
            m_simplexSolver = simplexSolver;
            m_penetrationDepthSolver = penetrationDepthSolver;

        }
예제 #11
0
		public ContinuousConvexCollision(ConvexShape convexA, ConvexShape convexB,
			ISimplexSolver simplexSolver, IConvexPenetrationDepthSolver penetrationDepthSolver)
		{
			_simplexSolver = simplexSolver;
			_penetrationDepthSolver = penetrationDepthSolver;
			_convexA = convexA;
			_convexB = convexB;
		}
예제 #12
0
 static CollisionAlgorithm AllocFromPool(PersistentManifold mf, CollisionAlgorithmConstructionInfo ci, CollisionObject body0, CollisionObject body1, ISimplexSolver simplexSolver, IConvexPenetrationDepthSolver pdSolver, int numPerturbationIterations, int minimumPointsPerturbationThreshold)
 {
     ConvexConvexAlgorithm result;
     if (ObjPool.Count > 0)
         result = ObjPool.Dequeue();
     else
         result = new ConvexConvexAlgorithm();
     result.Constructor(mf, ci, body0, body1, simplexSolver, pdSolver, numPerturbationIterations, minimumPointsPerturbationThreshold);
     return result;
 }
예제 #13
0
	    public Convex2dConvex2dAlgorithm(PersistentManifold mf,CollisionAlgorithmConstructionInfo ci,CollisionObject body0,CollisionObject body1, ISimplexSolverInterface simplexSolver, IConvexPenetrationDepthSolver pdSolver, int numPerturbationIterations, int minimumPointsPerturbationThreshold) : base(ci,body0,body1)
        {
            m_simplexSolver = simplexSolver;
            m_pdSolver = pdSolver;
            m_ownManifold = false;
            m_manifoldPtr = mf;
            m_lowLevelOfDetail = false;
            m_numPerturbationIterations = numPerturbationIterations;
            m_minimumPointsPerturbationThreshold = minimumPointsPerturbationThreshold;
        }
예제 #14
0
 public Convex2dConvex2dAlgorithm(PersistentManifold mf, CollisionAlgorithmConstructionInfo ci, CollisionObject body0, CollisionObject body1, ISimplexSolverInterface simplexSolver, IConvexPenetrationDepthSolver pdSolver, int numPerturbationIterations, int minimumPointsPerturbationThreshold)
     : base(ci, body0, body1)
 {
     m_simplexSolver                      = simplexSolver;
     m_pdSolver                           = pdSolver;
     m_ownManifold                        = false;
     m_manifoldPtr                        = mf;
     m_lowLevelOfDetail                   = false;
     m_numPerturbationIterations          = numPerturbationIterations;
     m_minimumPointsPerturbationThreshold = minimumPointsPerturbationThreshold;
 }
예제 #15
0
        public GjkPairDetector(ConvexShape objectA, ConvexShape objectB,
                               ISimplexSolver simplexSolver,
                               IConvexPenetrationDepthSolver penetrationDepthSolver)
        {
            _cachedSeparatingAxis = new Vector3(0, 0, 1);

            _penetrationDepthSolver = penetrationDepthSolver;
            _simplexSolver          = simplexSolver;
            _minkowskiA             = objectA;
            _minkowskiB             = objectB;
            _ignoreMargin           = false;
            _lastUsedMethod         = -1;
            _catchDegeneracies      = 1;
        }
예제 #16
0
		public GjkPairDetector(ConvexShape objectA, ConvexShape objectB,
							   ISimplexSolver simplexSolver,
							   IConvexPenetrationDepthSolver penetrationDepthSolver)
		{
			_cachedSeparatingAxis = new Vector3(0, 0, 1);

			_penetrationDepthSolver = penetrationDepthSolver;
			_simplexSolver = simplexSolver;
			_minkowskiA = objectA;
			_minkowskiB = objectB;
			_ignoreMargin = false;
			_lastUsedMethod = -1;
			_catchDegeneracies = 1;
		}
예제 #17
0
    	public ConvexConvexAlgorithm(PersistentManifold mf,CollisionAlgorithmConstructionInfo ci,CollisionObject body0,CollisionObject body1, ISimplexSolverInterface simplexSolver, IConvexPenetrationDepthSolver pdSolver, int numPerturbationIterations, int minimumPointsPerturbationThreshold) : base(ci,body0,body1)
        {
            m_simplexSolver = simplexSolver;
            m_pdSolver = pdSolver;
            m_ownManifold = false;
            m_manifoldPtr = mf;
            m_lowLevelOfDetail = false;
            #if USE_SEPDISTANCE_UTIL2
            m_sepDistance ((static_cast<btConvexShape*>(body0.getCollisionShape())).getAngularMotionDisc(),
			  (static_cast<btConvexShape*>(body1.getCollisionShape())).getAngularMotionDisc()),
            #endif
            m_numPerturbationIterations = numPerturbationIterations;
            m_minimumPointsPerturbationThreshold = minimumPointsPerturbationThreshold;
        }
예제 #18
0
        public void Initialize(PersistentManifold mf, CollisionAlgorithmConstructionInfo ci, CollisionObject body0, CollisionObject body1, ISimplexSolverInterface simplexSolver, IConvexPenetrationDepthSolver pdSolver, int numPerturbationIterations, int minimumPointsPerturbationThreshold)
        {
            base.Initialize(ci, body0, body1);
            m_simplexSolver    = simplexSolver;
            m_pdSolver         = pdSolver;
            m_ownManifold      = false;
            m_manifoldPtr      = mf;
            m_lowLevelOfDetail = false;
#if USE_SEPDISTANCE_UTIL2
            m_sepDistance((static_cast <btConvexShape *>(body0.getCollisionShape())).getAngularMotionDisc(),
                          (static_cast <btConvexShape *>(body1.getCollisionShape())).getAngularMotionDisc()),
#endif
            m_numPerturbationIterations          = numPerturbationIterations;
            m_minimumPointsPerturbationThreshold = minimumPointsPerturbationThreshold;
        }
예제 #19
0
        public GjkPairDetector(ConvexShape objectA, ConvexShape objectB, BroadphaseNativeTypes shapeTypeA, BroadphaseNativeTypes shapeTypeB, float marginA, float marginB, ISimplexSolverInterface simplexSolver, IConvexPenetrationDepthSolver penetrationDepthSolver)
        {
            m_minkowskiA = objectA;
            m_minkowskiB = objectB;
            m_shapeTypeA = shapeTypeA;
            m_shapeTypeB = shapeTypeB;
            m_marginA = marginA;
            m_marginB = marginB;

            m_cachedSeparatingAxis = new Vector3(0, 1, 0);

            m_simplexSolver = simplexSolver;
            m_penetrationDepthSolver = penetrationDepthSolver;
            m_ignoreMargin = false;
            m_lastUsedMethod = -1;
            m_catchDegeneracies = true;

        }
예제 #20
0
        public GjkPairDetector(ConvexShape objectA, ConvexShape objectB, ISimplexSolver simplexSolver, IConvexPenetrationDepthSolver penetrationDepthSolver)
        {
            m_cachedSeparatingAxis = new btVector3(0f, 1f, 0f);
            m_penetrationDepthSolver = penetrationDepthSolver;
            m_simplexSolver = simplexSolver;
            m_minkowskiA = objectA;
            m_minkowskiB = objectB;
            m_shapeTypeA = objectA.ShapeType;
            m_shapeTypeB = objectB.ShapeType;
            m_marginA = objectA.Margin;
            m_marginB = objectB.Margin;
            m_ignoreMargin = false;
            m_lastUsedMethod = -1;
            m_catchDegeneracies = 1;

            m_cachedSeparatingDistance = 0f;
            m_curIter = -1;
            m_degenerateSimplex = -1;
        }
예제 #21
0
        public void Initialize(ConvexShape objectA, ConvexShape objectB, BroadphaseNativeTypes shapeTypeA, BroadphaseNativeTypes shapeTypeB, float marginA, float marginB, ISimplexSolverInterface simplexSolver, IConvexPenetrationDepthSolver penetrationDepthSolver)
        {
            m_minkowskiA = objectA;
            m_minkowskiB = objectB;
            m_shapeTypeA = shapeTypeA;
            m_shapeTypeB = shapeTypeB;
            m_marginA    = marginA;
            m_marginB    = marginB;

            m_cachedSeparatingAxis = new IndexedVector3(0, 1, 0);

            m_simplexSolver          = simplexSolver;
            m_penetrationDepthSolver = penetrationDepthSolver;
            m_ignoreMargin           = false;
            m_lastUsedMethod         = -1;
            m_catchDegeneracies      = true;
            if (BulletGlobals.g_streamWriter != null && BulletGlobals.debugGJKDetector)
            {
                BulletGlobals.g_streamWriter.WriteLine(String.Format("GjkPairDetector-alt [{0}] [{1}]", objectA.GetName(), objectB.GetName()));
            }
        }
        public void Initialize(ConvexShape objectA, ConvexShape objectB, BroadphaseNativeTypes shapeTypeA, BroadphaseNativeTypes shapeTypeB, float marginA, float marginB, ISimplexSolverInterface simplexSolver, IConvexPenetrationDepthSolver penetrationDepthSolver)
        {
            m_minkowskiA = objectA;
            m_minkowskiB = objectB;
            m_shapeTypeA = shapeTypeA;
            m_shapeTypeB = shapeTypeB;
            m_marginA = marginA;
            m_marginB = marginB;

            m_cachedSeparatingAxis = new IndexedVector3(0, 1, 0);

            m_simplexSolver = simplexSolver;
            m_penetrationDepthSolver = penetrationDepthSolver;
            m_ignoreMargin = false;
            m_lastUsedMethod = -1;
            m_catchDegeneracies = true;
            if (BulletGlobals.g_streamWriter != null && BulletGlobals.debugGJKDetector)
            {
                BulletGlobals.g_streamWriter.WriteLine(String.Format("GjkPairDetector-alt [{0}] [{1}]", objectA.GetName(), objectB.GetName()));
            }

        }
예제 #23
0
 public CreateFunc(ISimplexSolver simplexSolver, IConvexPenetrationDepthSolver penetrationDepthSolver)
 {
     //_ownsSolvers = false;
     _simplexSolver = simplexSolver;
     _penetrationDepthSolver = penetrationDepthSolver;
 }
예제 #24
0
 //private bool _ownsSolvers;
 public CreateFunc()
 {
     //_ownsSolvers = true;
     _simplexSolver = new VoronoiSimplexSolver();
     _penetrationDepthSolver = new GjkEpaPenetrationDepthSolver();
 }
예제 #25
0
        /// <summary>
        /// cast a convex against another convex object
        /// </summary>
        /// <param name="fromA"></param>
        /// <param name="toA"></param>
        /// <param name="fromB"></param>
        /// <param name="toB"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool CalcTimeOfImpact(Matrix fromA, Matrix toA, Matrix fromB, Matrix toB, CastResult result)
        {
            MinkowskiSumShape combined = new MinkowskiSumShape(_convexA, _convexB);

            Matrix rayFromLocalA = MathHelper.InvertMatrix(fromA) * fromB;
            Matrix rayToLocalA   = MathHelper.InvertMatrix(toA) * toB;

            Matrix transformA = fromA;
            Matrix transformB = fromB;

            transformA.Translation = new Vector3(0, 0, 0);
            transformB.Translation = new Vector3(0, 0, 0);

            combined.TransformA = transformA;
            combined.TransformB = transformB;

            float radius = 0.01f;
            float lambda = 0;

            Vector3 s = rayFromLocalA.Translation;
            Vector3 r = rayToLocalA.Translation - rayFromLocalA.Translation;
            Vector3 x = s;
            Vector3 n = new Vector3();
            Vector3 c = new Vector3();

            bool  hasResult  = false;
            float lastLambda = lambda;

            IConvexPenetrationDepthSolver penSolver = null;
            Matrix identityTransform = Matrix.Identity;

            SphereShape raySphere = new SphereShape(0.0f);

            raySphere.Margin = 0.0f;

            Matrix sphereTransform = Matrix.Identity;

            sphereTransform.Translation = rayFromLocalA.Translation;

            result.DrawCoordSystem(sphereTransform);

            {
                PointCollector  pointCollector = new PointCollector();
                GjkPairDetector gjk            = new GjkPairDetector(raySphere, combined, _simplexSolver, penSolver);

                GjkPairDetector.ClosestPointInput input = new DiscreteCollisionDetectorInterface.ClosestPointInput();
                input.TransformA = sphereTransform;
                input.TransformB = identityTransform;

                gjk.GetClosestPoints(input, pointCollector, null);

                hasResult = pointCollector.HasResult;

                c = pointCollector.PointInWorld;
                n = pointCollector.NormalOnBInWorld;
            }

            if (hasResult)
            {
                float dist = (c - x).Length();

                if (dist < radius)
                {
                    lastLambda = 1.0f;
                }

                while (dist > radius)
                {
                    n = x - c;
                    float dot = Vector3.Dot(n, r);

                    if (dot >= -(MathHelper.Epsilon * MathHelper.Epsilon))
                    {
                        return(false);
                    }

                    lambda = lambda - Vector3.Distance(n, n) / dot;
                    if (lambda <= lastLambda)
                    {
                        break;
                    }

                    lastLambda = lambda;

                    x = s + lambda * r;

                    sphereTransform.Translation = x;
                    result.DrawCoordSystem(sphereTransform);
                    PointCollector pointCollector = new PointCollector();

                    GjkPairDetector gjk = new GjkPairDetector(raySphere, combined, _simplexSolver, penSolver);
                    GjkPairDetector.ClosestPointInput input = new DiscreteCollisionDetectorInterface.ClosestPointInput();
                    input.TransformA = sphereTransform;
                    input.TransformB = identityTransform;

                    gjk.GetClosestPoints(input, pointCollector, null);

                    if (pointCollector.HasResult)
                    {
                        if (pointCollector.Distance < 0.0f)
                        {
                            result.Fraction = lastLambda;
                            result.Normal   = n;
                            return(true);
                        }

                        c    = pointCollector.PointInWorld;
                        dist = (c - x).Length();
                    }
                    else
                    {
                        return(false);
                    }
                }

                if (lastLambda < 1.0f)
                {
                    result.Fraction = lastLambda;
                    result.Normal   = n;
                    return(true);
                }
            }

            return(false);
        }
	public DefaultCollisionConfiguration(DefaultCollisionConstructionInfo constructionInfo)
    {
    	m_simplexSolver = new VoronoiSimplexSolver();
        m_pdSolver = new GjkEpaPenetrationDepthSolver();
        //m_pdSolver = new MinkowskiPenetrationDepthSolver();
        m_useEpaPenetrationAlgorithm = true;
//#define USE_EPA 1
//#ifdef USE_EPA
//    mem = btAlignedAlloc(sizeof(btGjkEpaPenetrationDepthSolver),16);
//    m_pdSolver = new (mem)btGjkEpaPenetrationDepthSolver;
//#else
//    mem = btAlignedAlloc(sizeof(btMinkowskiPenetrationDepthSolver),16);
//    m_pdSolver = new (mem)btMinkowskiPenetrationDepthSolver;
//#endif//USE_EPA	
	

	    //default CreationFunctions, filling the m_doubleDispatch table
	    m_convexConvexCreateFunc = new ConvexConvexCreateFunc(m_simplexSolver,m_pdSolver);
	    m_convexConcaveCreateFunc = new ConvexConcaveCreateFunc();
	    m_swappedConvexConcaveCreateFunc = new SwappedConvexConcaveCreateFunc();
	    m_compoundCreateFunc = new CompoundCreateFunc();
	    m_swappedCompoundCreateFunc = new SwappedCompoundCreateFunc();
	    m_emptyCreateFunc = new EmptyCreateFunc();
	
    	m_sphereSphereCF = new SphereSphereCreateFunc();
//#ifdef USE_BUGGY_SPHERE_BOX_ALGORITHM
//    mem = btAlignedAlloc(sizeof(btSphereBoxCollisionAlgorithm::CreateFunc),16);
//    m_sphereBoxCF = new(mem) btSphereBoxCollisionAlgorithm::CreateFunc;
//    mem = btAlignedAlloc(sizeof(btSphereBoxCollisionAlgorithm::CreateFunc),16);
//    m_boxSphereCF = new (mem)btSphereBoxCollisionAlgorithm::CreateFunc;
//    m_boxSphereCF->m_swapped = true;
//#endif //USE_BUGGY_SPHERE_BOX_ALGORITHM

	    m_sphereTriangleCF = new SphereTriangleCreateFunc();
	    m_triangleSphereCF = new SphereTriangleCreateFunc();
	    m_triangleSphereCF.m_swapped = true;
    	
	    m_boxBoxCF = new BoxBoxCreateFunc();

	    //convex versus plane
	    m_convexPlaneCF = new ConvexPlaneCreateFunc();
	    m_planeConvexCF = new ConvexPlaneCreateFunc();
	    m_planeConvexCF.m_swapped = true;
    	
	    ///calculate maximum element size, big enough to fit any collision algorithm in the memory pool
        //int maxSize = sizeof(btConvexConvexAlgorithm);
        //int maxSize2 = sizeof(btConvexConcaveCollisionAlgorithm);
        //int maxSize3 = sizeof(btCompoundCollisionAlgorithm);
        //int sl = sizeof(btConvexSeparatingDistanceUtil);
        //sl = sizeof(btGjkPairDetector);
        //int	collisionAlgorithmMaxElementSize = btMax(maxSize,maxSize2);
        //collisionAlgorithmMaxElementSize = btMax(collisionAlgorithmMaxElementSize,maxSize3);

        //if (constructionInfo.m_stackAlloc)
        //{
        //    m_ownsStackAllocator = false;
        //    this->m_stackAlloc = constructionInfo.m_stackAlloc;
        //} else
        //{
        //    m_ownsStackAllocator = true;
        //    void* mem = btAlignedAlloc(sizeof(btStackAlloc),16);
        //    m_stackAlloc = new(mem)btStackAlloc(constructionInfo.m_defaultStackAllocatorSize);
        //}
    		
        //if (constructionInfo.m_persistentManifoldPool)
        //{
        //    m_ownsPersistentManifoldPool = false;
        //    m_persistentManifoldPool = constructionInfo.m_persistentManifoldPool;
        //} else
        //{
        //    m_ownsPersistentManifoldPool = true;
        //    void* mem = btAlignedAlloc(sizeof(btPoolAllocator),16);
        //    m_persistentManifoldPool = new (mem) btPoolAllocator(sizeof(btPersistentManifold),constructionInfo.m_defaultMaxPersistentManifoldPoolSize);
        //}
    	
        //if (constructionInfo.m_collisionAlgorithmPool)
        //{
        //    m_ownsCollisionAlgorithmPool = false;
        //    m_collisionAlgorithmPool = constructionInfo.m_collisionAlgorithmPool;
        //} else
        //{
        //    m_ownsCollisionAlgorithmPool = true;
        //    void* mem = btAlignedAlloc(sizeof(btPoolAllocator),16);
        //    m_collisionAlgorithmPool = new(mem) btPoolAllocator(collisionAlgorithmMaxElementSize,constructionInfo.m_defaultMaxCollisionAlgorithmPoolSize);
        //}
    }
예제 #27
0
		public void setPenetrationDepthSolver(IConvexPenetrationDepthSolver penetrationDepthSolver)
		{
			this._penetrationDepthSolver = penetrationDepthSolver;
		}
예제 #28
0
 public GjkPairDetector(ConvexShape objectA, ConvexShape objectB, BroadphaseNativeTypes shapeTypeA, BroadphaseNativeTypes shapeTypeB, float marginA, float marginB, ISimplexSolverInterface simplexSolver, IConvexPenetrationDepthSolver penetrationDepthSolver)
 {
     Initialize(objectA, objectB, shapeTypeA, shapeTypeB, marginA, marginB, simplexSolver, penetrationDepthSolver);
 }
예제 #29
0
 public void SetPenetrationDepthSolver(IConvexPenetrationDepthSolver penetrationDepthSolver)
 {
     m_penetrationDepthSolver = penetrationDepthSolver;
 }
예제 #30
0
        }                            // for pool

        public GjkPairDetector(ConvexShape objectA, ConvexShape objectB, ISimplexSolverInterface simplexSolver, IConvexPenetrationDepthSolver penetrationDepthSolver)
        {
            Initialize(objectA, objectB, simplexSolver, penetrationDepthSolver);
        }
예제 #31
0
        public GjkPairDetector() { } // for pool

        public GjkPairDetector(ConvexShape objectA, ConvexShape objectB, ISimplexSolverInterface simplexSolver, IConvexPenetrationDepthSolver penetrationDepthSolver)
        {
            Initialize(objectA, objectB, simplexSolver, penetrationDepthSolver);
        }
예제 #32
0
 public void setPenetrationDepthSolver(IConvexPenetrationDepthSolver penetrationDepthSolver)
 {
     this._penetrationDepthSolver = penetrationDepthSolver;
 }
예제 #33
0
        /// <summary>
        /// 初期化関数
        /// </summary>
        /// <param name="constructionInfo">初期化用構造体</param>
        private void Constructor(DefaultCollisionConstructionInfo constructionInfo)
        {

            m_simplexSolver = new VoronoiSimplexSolver();

            if (constructionInfo.m_useEpaPenetrationAlgorithm)
            {
                m_pdSolver = new GjkEpaPenetrationDepthSolver();
            }
            else
            {
                m_pdSolver = new MinkowskiPenetrationDepthSolver();
            }

            //default CreationFunctions, filling the m_doubleDispatch table
            m_convexConvexCreateFunc = new ConvexConvexAlgorithm.CreateFunc(m_simplexSolver, m_pdSolver);
            m_convexConcaveCreateFunc = new ConvexConcaveCollisionAlgorithm.CreateFunc();
            m_swappedConvexConcaveCreateFunc = new ConvexConcaveCollisionAlgorithm.SwappedCreateFunc();
            m_compoundCreateFunc = new CompoundCollisionAlgorithm.CreateFunc();
            m_swappedCompoundCreateFunc = new CompoundCollisionAlgorithm.SwappedCreateFunc();
            m_emptyCreateFunc = new EmptyAlgorithm.CreateFunc();

            m_sphereSphereCF = new SphereSphereCollisionAlgorithm.CreateFunc();
#if USE_BUGGY_SPHERE_BOX_ALGORITHM
            //この中は移植作業を行ってない。
	        m_sphereBoxCF = new SphereBoxCollisionAlgorithm.CreateFunc();
	        m_boxSphereCF = new SphereBoxCollisionAlgorithm.CreateFunc();
	        m_boxSphereCF.m_swapped = true;
#endif //USE_BUGGY_SPHERE_BOX_ALGORITHM

            m_sphereTriangleCF = new SphereTriangleCollisionAlgorithm.CreateFunc();
            m_triangleSphereCF = new SphereTriangleCollisionAlgorithm.CreateFunc();
            m_triangleSphereCF.m_swapped = true;

            m_boxBoxCF = new BoxBoxCollisionAlgorithm.CreateFunc();

            //convex versus plane
            m_convexPlaneCF = new ConvexPlaneCollisionAlgorithm.CreateFunc();
            m_planeConvexCF = new ConvexPlaneCollisionAlgorithm.CreateFunc();
            m_planeConvexCF.m_swapped = true;
#if false//未使用らしきメンバ変数の初期化作業
	        ///calculate maximum element size, big enough to fit any collision algorithm in the memory pool
	        int maxSize = sizeof(btConvexConvexAlgorithm);
	        int maxSize2 = sizeof(btConvexConcaveCollisionAlgorithm);
	        int maxSize3 = sizeof(btCompoundCollisionAlgorithm);
	        int sl = sizeof(btConvexSeparatingDistanceUtil);
	        sl = sizeof(btGjkPairDetector);
	        int	collisionAlgorithmMaxElementSize = btMax(maxSize,constructionInfo.m_customCollisionAlgorithmMaxElementSize);
	        collisionAlgorithmMaxElementSize = btMax(collisionAlgorithmMaxElementSize,maxSize2);
	        collisionAlgorithmMaxElementSize = btMax(collisionAlgorithmMaxElementSize,maxSize3);

	        if (constructionInfo.m_stackAlloc)
	        {
		        m_ownsStackAllocator = false;
		        this->m_stackAlloc = constructionInfo.m_stackAlloc;
	        } else
	        {
		        m_ownsStackAllocator = true;
		        void* mem = btAlignedAlloc(sizeof(btStackAlloc),16);
		        m_stackAlloc = new(mem)btStackAlloc(constructionInfo.m_defaultStackAllocatorSize);
	        }
        		
	        if (constructionInfo.m_persistentManifoldPool)
	        {
		        m_ownsPersistentManifoldPool = false;
		        m_persistentManifoldPool = constructionInfo.m_persistentManifoldPool;
	        } else
	        {
		        m_ownsPersistentManifoldPool = true;
		        void* mem = btAlignedAlloc(sizeof(btPoolAllocator),16);
		        m_persistentManifoldPool = new (mem) btPoolAllocator(sizeof(btPersistentManifold),constructionInfo.m_defaultMaxPersistentManifoldPoolSize);
	        }
        	
	        if (constructionInfo.m_collisionAlgorithmPool)
	        {
		        m_ownsCollisionAlgorithmPool = false;
		        m_collisionAlgorithmPool = constructionInfo.m_collisionAlgorithmPool;
	        } else
	        {
		        m_ownsCollisionAlgorithmPool = true;
		        void* mem = btAlignedAlloc(sizeof(btPoolAllocator),16);
		        m_collisionAlgorithmPool = new(mem) btPoolAllocator(collisionAlgorithmMaxElementSize,constructionInfo.m_defaultMaxCollisionAlgorithmPoolSize);
	        }
#endif
        }
예제 #34
0
 public GjkPairDetector(ConvexShape objectA, ConvexShape objectB, BroadphaseNativeTypes shapeTypeA, BroadphaseNativeTypes shapeTypeB, float marginA, float marginB, ISimplexSolverInterface simplexSolver, IConvexPenetrationDepthSolver penetrationDepthSolver)
 {
     Initialize(objectA, objectB, shapeTypeA, shapeTypeB, marginA, marginB, simplexSolver,penetrationDepthSolver);
 }
예제 #35
0
 public CreateFunc(ISimplexSolver simplexSolver, IConvexPenetrationDepthSolver penetrationDepthSolver)
 {
     //_ownsSolvers = false;
     _simplexSolver          = simplexSolver;
     _penetrationDepthSolver = penetrationDepthSolver;
 }
예제 #36
0
 public ConvexConvexAlgorithm(PersistentManifold manifold, CollisionAlgorithmConstructionInfo collisionAlgorithmConstructionInfo, CollisionObject bodyA, CollisionObject bodyB, ISimplexSolver simplexSolver, IConvexPenetrationDepthSolver penetrationDepthSolver)
     : base(collisionAlgorithmConstructionInfo)
 {
     _gjkPairDetector  = new GjkPairDetector(null, null, simplexSolver, penetrationDepthSolver);
     _ownManifold      = false;
     _manifold         = manifold;
     _lowLevelOfDetail = false;
 }
예제 #37
0
 public void SetPenetrationDepthSolver(IConvexPenetrationDepthSolver penetrationDepthSolver)
 {
     m_penetrationDepthSolver = penetrationDepthSolver;
 }
예제 #38
0
            //private bool _ownsSolvers;

            public CreateFunc()
            {
                //_ownsSolvers = true;
                _simplexSolver          = new VoronoiSimplexSolver();
                _penetrationDepthSolver = new GjkEpaPenetrationDepthSolver();
            }