Permalink
Browse files

DEL obsolete box2d

  • Loading branch information...
1 parent 24cb4f1 commit cfdda16c136c500146d3f433aaadc011a21b8956 unknown committed Dec 6, 2009
Showing with 2,049 additions and 1,816 deletions.
  1. +0 −65 application/lib/box2d/Box2D.h
  2. +0 −168 application/lib/box2d/Collision/b2CollideCircle.cpp
  3. +0 −140 application/lib/box2d/Collision/b2Collision.cpp
  4. +0 −172 application/lib/box2d/Dynamics/Contacts/b2PolyAndCircleContact.cpp
  5. +0 −174 application/lib/box2d/Dynamics/Contacts/b2PolyAndEdgeContact.cpp
  6. +0 −172 application/lib/box2d/Dynamics/Contacts/b2PolyContact.cpp
  7. +67 −0 application/lib/box2d/Include/Box2D.h
  8. +1 −2 application/lib/box2d/{ → Source}/Collision/Shapes/b2CircleShape.cpp
  9. 0 application/lib/box2d/{ → Source}/Collision/Shapes/b2CircleShape.h
  10. +1 −1 application/lib/box2d/{ → Source}/Collision/Shapes/b2EdgeShape.cpp
  11. 0 application/lib/box2d/{ → Source}/Collision/Shapes/b2EdgeShape.h
  12. +11 −0 application/lib/box2d/{ → Source}/Collision/Shapes/b2PolygonShape.cpp
  13. +3 −0 application/lib/box2d/{ → Source}/Collision/Shapes/b2PolygonShape.h
  14. 0 application/lib/box2d/{ → Source}/Collision/Shapes/b2Shape.cpp
  15. 0 application/lib/box2d/{ → Source}/Collision/Shapes/b2Shape.h
  16. 0 application/lib/box2d/{ → Source}/Collision/b2BroadPhase.cpp
  17. 0 application/lib/box2d/{ → Source}/Collision/b2BroadPhase.h
  18. +153 −0 application/lib/box2d/Source/Collision/b2CollideCircle.cpp
  19. +95 −109 application/lib/box2d/{ → Source}/Collision/b2CollideEdge.cpp
  20. +19 −53 application/lib/box2d/{ → Source}/Collision/b2CollidePoly.cpp
  21. +287 −0 application/lib/box2d/Source/Collision/b2Collision.cpp
  22. +78 −11 application/lib/box2d/{ → Source}/Collision/b2Collision.h
  23. 0 application/lib/box2d/{ → Source}/Collision/b2Distance.cpp
  24. 0 application/lib/box2d/{ → Source}/Collision/b2Distance.h
  25. 0 application/lib/box2d/{ → Source}/Collision/b2DynamicTree.cpp
  26. 0 application/lib/box2d/{ → Source}/Collision/b2DynamicTree.h
  27. 0 application/lib/box2d/{ → Source}/Collision/b2PairManager.cpp
  28. 0 application/lib/box2d/{ → Source}/Collision/b2PairManager.h
  29. +8 −6 application/lib/box2d/{ → Source}/Collision/b2TimeOfImpact.cpp
  30. +4 −0 application/lib/box2d/{ → Source}/Collision/b2TimeOfImpact.h
  31. +1 −1 application/lib/box2d/{ → Source}/Common/Fixed.h
  32. 0 application/lib/box2d/{ → Source}/Common/b2BlockAllocator.cpp
  33. 0 application/lib/box2d/{ → Source}/Common/b2BlockAllocator.h
  34. 0 application/lib/box2d/{ → Source}/Common/b2Math.cpp
  35. 0 application/lib/box2d/{ → Source}/Common/b2Math.h
  36. 0 application/lib/box2d/{ → Source}/Common/b2Settings.cpp
  37. +24 −21 application/lib/box2d/{ → Source}/Common/b2Settings.h
  38. 0 application/lib/box2d/{ → Source}/Common/b2StackAllocator.cpp
  39. 0 application/lib/box2d/{ → Source}/Common/b2StackAllocator.h
  40. 0 application/lib/box2d/{ → Source}/Common/jtypes.h
  41. +1 −71 application/lib/box2d/{ → Source}/Dynamics/Contacts/b2CircleContact.cpp
  42. +1 −7 application/lib/box2d/{ → Source}/Dynamics/Contacts/b2CircleContact.h
  43. +8 −41 application/lib/box2d/{ → Source}/Dynamics/Contacts/b2Contact.cpp
  44. +98 −40 application/lib/box2d/{ → Source}/Dynamics/Contacts/b2Contact.h
  45. +270 −292 application/lib/box2d/{ → Source}/Dynamics/Contacts/b2ContactSolver.cpp
  46. +6 −4 application/lib/box2d/{ → Source}/Dynamics/Contacts/b2ContactSolver.h
  47. +4 −71 application/lib/box2d/{ → Source}/Dynamics/Contacts/b2EdgeAndCircleContact.cpp
  48. +1 −8 application/lib/box2d/{ → Source}/Dynamics/Contacts/b2EdgeAndCircleContact.h
  49. +1 −2 application/lib/box2d/{ → Source}/Dynamics/Contacts/b2NullContact.h
  50. +68 −0 application/lib/box2d/Source/Dynamics/Contacts/b2PolyAndCircleContact.cpp
  51. +1 −7 application/lib/box2d/{ → Source}/Dynamics/Contacts/b2PolyAndCircleContact.h
  52. +70 −0 application/lib/box2d/Source/Dynamics/Contacts/b2PolyAndEdgeContact.cpp
  53. +1 −8 application/lib/box2d/{ → Source}/Dynamics/Contacts/b2PolyAndEdgeContact.h
  54. +68 −0 application/lib/box2d/Source/Dynamics/Contacts/b2PolyContact.cpp
  55. +1 −7 application/lib/box2d/{ → Source}/Dynamics/Contacts/b2PolyContact.h
  56. +2 −2 application/lib/box2d/{ → Source}/Dynamics/Controllers/b2BuoyancyController.cpp
  57. +1 −1 application/lib/box2d/{ → Source}/Dynamics/Controllers/b2BuoyancyController.h
  58. +2 −2 application/lib/box2d/{ → Source}/Dynamics/Controllers/b2ConstantAccelController.cpp
  59. +1 −1 application/lib/box2d/{ → Source}/Dynamics/Controllers/b2ConstantAccelController.h
  60. +2 −2 application/lib/box2d/{ → Source}/Dynamics/Controllers/b2ConstantForceController.cpp
  61. +1 −1 application/lib/box2d/{ → Source}/Dynamics/Controllers/b2ConstantForceController.h
  62. 0 application/lib/box2d/{ → Source}/Dynamics/Controllers/b2Controller.cpp
  63. +19 −1 application/lib/box2d/{ → Source}/Dynamics/Controllers/b2Controller.h
  64. +2 −2 application/lib/box2d/{ → Source}/Dynamics/Controllers/b2GravityController.cpp
  65. +1 −1 application/lib/box2d/{ → Source}/Dynamics/Controllers/b2GravityController.h
  66. +2 −2 application/lib/box2d/{ → Source}/Dynamics/Controllers/b2TensorDampingController.cpp
  67. +1 −1 application/lib/box2d/{ → Source}/Dynamics/Controllers/b2TensorDampingController.h
  68. 0 application/lib/box2d/{ → Source}/Dynamics/Joints/b2DistanceJoint.cpp
  69. 0 application/lib/box2d/{ → Source}/Dynamics/Joints/b2DistanceJoint.h
  70. +149 −0 application/lib/box2d/Source/Dynamics/Joints/b2FixedJoint.cpp
  71. +57 −0 application/lib/box2d/Source/Dynamics/Joints/b2FixedJoint.h
  72. 0 application/lib/box2d/{ → Source}/Dynamics/Joints/b2GearJoint.cpp
  73. 0 application/lib/box2d/{ → Source}/Dynamics/Joints/b2GearJoint.h
  74. +12 −0 application/lib/box2d/{ → Source}/Dynamics/Joints/b2Joint.cpp
  75. +4 −3 application/lib/box2d/{ → Source}/Dynamics/Joints/b2Joint.h
  76. 0 application/lib/box2d/{ → Source}/Dynamics/Joints/b2LineJoint.cpp
  77. 0 application/lib/box2d/{ → Source}/Dynamics/Joints/b2LineJoint.h
  78. 0 application/lib/box2d/{ → Source}/Dynamics/Joints/b2MouseJoint.cpp
  79. 0 application/lib/box2d/{ → Source}/Dynamics/Joints/b2MouseJoint.h
  80. 0 application/lib/box2d/{ → Source}/Dynamics/Joints/b2PrismaticJoint.cpp
  81. 0 application/lib/box2d/{ → Source}/Dynamics/Joints/b2PrismaticJoint.h
  82. 0 application/lib/box2d/{ → Source}/Dynamics/Joints/b2PulleyJoint.cpp
  83. 0 application/lib/box2d/{ → Source}/Dynamics/Joints/b2PulleyJoint.h
  84. 0 application/lib/box2d/{ → Source}/Dynamics/Joints/b2RevoluteJoint.cpp
  85. 0 application/lib/box2d/{ → Source}/Dynamics/Joints/b2RevoluteJoint.h
  86. +0 −33 application/lib/box2d/{ → Source}/Dynamics/b2Body.cpp
  87. +29 −2 application/lib/box2d/{ → Source}/Dynamics/b2Body.h
  88. +126 −31 application/lib/box2d/{ → Source}/Dynamics/b2ContactManager.cpp
  89. +14 −1 application/lib/box2d/{ → Source}/Dynamics/b2ContactManager.h
  90. 0 application/lib/box2d/{ → Source}/Dynamics/b2EdgeChain.cpp
  91. 0 application/lib/box2d/{ → Source}/Dynamics/b2EdgeChain.h
  92. 0 application/lib/box2d/{ → Source}/Dynamics/b2Fixture.cpp
  93. 0 application/lib/box2d/{ → Source}/Dynamics/b2Fixture.h
  94. +35 −28 application/lib/box2d/{ → Source}/Dynamics/b2Island.cpp
  95. +1 −1 application/lib/box2d/{ → Source}/Dynamics/b2Island.h
  96. +38 −27 application/lib/box2d/{ → Source}/Dynamics/b2World.cpp
  97. +12 −1 application/lib/box2d/{ → Source}/Dynamics/b2World.h
  98. +0 −2 application/lib/box2d/{ → Source}/Dynamics/b2WorldCallbacks.cpp
  99. +43 −18 application/lib/box2d/{ → Source}/Dynamics/b2WorldCallbacks.h
  100. +144 −0 application/lib/box2d/Source/Makefile
@@ -1,65 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Erin Catto http://www.gphysics.com
-*
-* This software is provided 'as-is', without any express or implied
-* warranty. In no event will the authors be held liable for any damages
-* arising from the use of this software.
-* Permission is granted to anyone to use this software for any purpose,
-* including commercial applications, and to alter it and redistribute it
-* freely, subject to the following restrictions:
-* 1. The origin of this software must not be misrepresented; you must not
-* claim that you wrote the original software. If you use this software
-* in a product, an acknowledgment in the product documentation would be
-* appreciated but is not required.
-* 2. Altered source versions must be plainly marked as such, and must not be
-* misrepresented as being the original software.
-* 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#ifndef BOX2D_H
-#define BOX2D_H
-
-/**
-\mainpage Box2D API Documentation
-
-\section intro_sec Getting Started
-
-For tutorials please see http://www.box2d.org/manual.html
-
-For discussion please visit http://www.box2d.org/forum
-*/
-
-// These include files constitute the main Box2D API
-
-#include "Common/b2Settings.h"
-
-#include "Collision/Shapes/b2CircleShape.h"
-#include "Collision/Shapes/b2PolygonShape.h"
-#include "Collision/Shapes/b2EdgeShape.h"
-#include "Collision/b2BroadPhase.h"
-#include "Collision/b2Distance.h"
-#include "Collision/b2DynamicTree.h"
-#include "Collision/b2TimeOfImpact.h"
-#include "Dynamics/b2Body.h"
-#include "Dynamics/b2EdgeChain.h"
-#include "Dynamics/b2Fixture.h"
-#include "Dynamics/b2WorldCallbacks.h"
-#include "Dynamics/b2World.h"
-
-#include "Dynamics/Contacts/b2Contact.h"
-
-#include "Dynamics/Joints/b2DistanceJoint.h"
-#include "Dynamics/Joints/b2GearJoint.h"
-#include "Dynamics/Joints/b2LineJoint.h"
-#include "Dynamics/Joints/b2MouseJoint.h"
-#include "Dynamics/Joints/b2PrismaticJoint.h"
-#include "Dynamics/Joints/b2PulleyJoint.h"
-#include "Dynamics/Joints/b2RevoluteJoint.h"
-
-#include "Dynamics/Controllers/b2BuoyancyController.h"
-#include "Dynamics/Controllers/b2ConstantForceController.h"
-#include "Dynamics/Controllers/b2ConstantAccelController.h"
-#include "Dynamics/Controllers/b2GravityController.h"
-#include "Dynamics/Controllers/b2TensorDampingController.h"
-
-#endif
@@ -1,168 +0,0 @@
-/*
-* Copyright (c) 2007-2009 Erin Catto http://www.gphysics.com
-*
-* This software is provided 'as-is', without any express or implied
-* warranty. In no event will the authors be held liable for any damages
-* arising from the use of this software.
-* Permission is granted to anyone to use this software for any purpose,
-* including commercial applications, and to alter it and redistribute it
-* freely, subject to the following restrictions:
-* 1. The origin of this software must not be misrepresented; you must not
-* claim that you wrote the original software. If you use this software
-* in a product, an acknowledgment in the product documentation would be
-* appreciated but is not required.
-* 2. Altered source versions must be plainly marked as such, and must not be
-* misrepresented as being the original software.
-* 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#include "b2Collision.h"
-#include "Shapes/b2CircleShape.h"
-#include "Shapes/b2PolygonShape.h"
-
-void b2CollideCircles(
- b2Manifold* manifold,
- const b2CircleShape* circle1, const b2XForm& xf1,
- const b2CircleShape* circle2, const b2XForm& xf2)
-{
- manifold->pointCount = 0;
-
- b2Vec2 p1 = b2Mul(xf1, circle1->m_p);
- b2Vec2 p2 = b2Mul(xf2, circle2->m_p);
-
- b2Vec2 d = p2 - p1;
- float32 distSqr = b2Dot(d, d);
- float32 r1 = circle1->m_radius;
- float32 r2 = circle2->m_radius;
- float32 radiusSum = r1 + r2;
- if (distSqr > radiusSum * radiusSum)
- {
- return;
- }
-
- float32 separation;
- if (distSqr < B2_FLT_EPSILON)
- {
- separation = -radiusSum;
- manifold->normal.Set(0.0f, 1.0f);
- }
- else
- {
- float32 dist = b2Sqrt(distSqr);
- separation = dist - radiusSum;
- float32 a = 1.0f / dist;
- manifold->normal.x = a * d.x;
- manifold->normal.y = a * d.y;
- }
-
- manifold->pointCount = 1;
- manifold->points[0].id.key = 0;
- manifold->points[0].separation = separation;
-
- p1 += r1 * manifold->normal;
- p2 -= r2 * manifold->normal;
-
- b2Vec2 p = 0.5f * (p1 + p2);
-
- manifold->points[0].localPointA = b2MulT(xf1, p);
- manifold->points[0].localPointB = b2MulT(xf2, p);
-}
-
-void b2CollidePolygonAndCircle(
- b2Manifold* manifold,
- const b2PolygonShape* polygon, const b2XForm& xf1,
- const b2CircleShape* circle, const b2XForm& xf2)
-{
- manifold->pointCount = 0;
-
- // Compute circle position in the frame of the polygon.
- b2Vec2 c = b2Mul(xf2, circle->m_p);
- b2Vec2 cLocal = b2MulT(xf1, c);
-
- // Find the min separating edge.
- int32 normalIndex = 0;
- float32 separation = -B2_FLT_MAX;
- float32 radius = polygon->m_radius + circle->m_radius;
- int32 vertexCount = polygon->m_vertexCount;
- const b2Vec2* vertices = polygon->m_vertices;
- const b2Vec2* normals = polygon->m_normals;
-
- for (int32 i = 0; i < vertexCount; ++i)
- {
- float32 s = b2Dot(normals[i], cLocal - vertices[i]);
-
- if (s > radius)
- {
- // Early out.
- return;
- }
-
- if (s > separation)
- {
- separation = s;
- normalIndex = i;
- }
- }
-
- // If the center is inside the polygon ...
- if (separation < B2_FLT_EPSILON)
- {
- manifold->pointCount = 1;
- manifold->normal = b2Mul(xf1.R, normals[normalIndex]);
- manifold->points[0].id.features.incidentEdge = (uint8)normalIndex;
- manifold->points[0].id.features.incidentVertex = b2_nullFeature;
- manifold->points[0].id.features.referenceEdge = 0;
- manifold->points[0].id.features.flip = 0;
- b2Vec2 position = c - radius * manifold->normal;
- manifold->points[0].localPointA = b2MulT(xf1, position);
- manifold->points[0].localPointB = b2MulT(xf2, position);
- manifold->points[0].separation = separation - radius;
- return;
- }
-
- // Project the circle center onto the edge segment.
- int32 vertIndex1 = normalIndex;
- int32 vertIndex2 = vertIndex1 + 1 < vertexCount ? vertIndex1 + 1 : 0;
- b2Vec2 e = vertices[vertIndex2] - vertices[vertIndex1];
-
- float32 length = e.Normalize();
- b2Assert(length > B2_FLT_EPSILON);
-
- // Project the center onto the edge.
- float32 u = b2Dot(cLocal - vertices[vertIndex1], e);
- b2Vec2 p;
- if (u <= 0.0f)
- {
- p = vertices[vertIndex1];
- manifold->points[0].id.features.incidentEdge = b2_nullFeature;
- manifold->points[0].id.features.incidentVertex = (uint8)vertIndex1;
- }
- else if (u >= length)
- {
- p = vertices[vertIndex2];
- manifold->points[0].id.features.incidentEdge = b2_nullFeature;
- manifold->points[0].id.features.incidentVertex = (uint8)vertIndex2;
- }
- else
- {
- p = vertices[vertIndex1] + u * e;
- manifold->points[0].id.features.incidentEdge = (uint8)normalIndex;
- manifold->points[0].id.features.incidentVertex = b2_nullFeature;
- }
-
- b2Vec2 d = cLocal - p;
- float32 dist = d.Normalize();
- if (dist > radius)
- {
- return;
- }
-
- manifold->pointCount = 1;
- manifold->normal = b2Mul(xf1.R, d);
- b2Vec2 position = c - radius * manifold->normal;
- manifold->points[0].localPointA = b2MulT(xf1, position);
- manifold->points[0].localPointB = b2MulT(xf2, position);
- manifold->points[0].separation = dist - radius;
- manifold->points[0].id.features.referenceEdge = 0;
- manifold->points[0].id.features.flip = 0;
-}
@@ -1,140 +0,0 @@
-/*
-* Copyright (c) 2007-2009 Erin Catto http://www.gphysics.com
-*
-* This software is provided 'as-is', without any express or implied
-* warranty. In no event will the authors be held liable for any damages
-* arising from the use of this software.
-* Permission is granted to anyone to use this software for any purpose,
-* including commercial applications, and to alter it and redistribute it
-* freely, subject to the following restrictions:
-* 1. The origin of this software must not be misrepresented; you must not
-* claim that you wrote the original software. If you use this software
-* in a product, an acknowledgment in the product documentation would be
-* appreciated but is not required.
-* 2. Altered source versions must be plainly marked as such, and must not be
-* misrepresented as being the original software.
-* 3. This notice may not be removed or altered from any source distribution.
-*/
-
-#include "b2Collision.h"
-
-// Collision Detection in Interactive 3D Environments by Gino van den Bergen
-// From Section 3.4.1
-// x = mu1 * p1 + mu2 * p2
-// mu1 + mu2 = 1 && mu1 >= 0 && mu2 >= 0
-// mu1 = 1 - mu2;
-// x = (1 - mu2) * p1 + mu2 * p2
-// = p1 + mu2 * (p2 - p1)
-// x = s + a * r (s := start, r := end - start)
-// s + a * r = p1 + mu2 * d (d := p2 - p1)
-// -a * r + mu2 * d = b (b := s - p1)
-// [-r d] * [a; mu2] = b
-// Cramer's rule:
-// denom = det[-r d]
-// a = det[b d] / denom
-// mu2 = det[-r b] / denom
-bool b2Segment::TestSegment(float32* lambda, b2Vec2* normal, const b2Segment& segment, float32 maxLambda) const
-{
- b2Vec2 s = segment.p1;
- b2Vec2 r = segment.p2 - s;
- b2Vec2 d = p2 - p1;
- b2Vec2 n = b2Cross(d, 1.0f);
-
- const float32 k_slop = 100.0f * B2_FLT_EPSILON;
- float32 denom = -b2Dot(r, n);
-
- // Cull back facing collision and ignore parallel segments.
- if (denom > k_slop)
- {
- // Does the segment intersect the infinite line associated with this segment?
- b2Vec2 b = s - p1;
- float32 a = b2Dot(b, n);
-
- if (0.0f <= a && a <= maxLambda * denom)
- {
- float32 mu2 = -r.x * b.y + r.y * b.x;
-
- // Does the segment intersect this segment?
- if (-k_slop * denom <= mu2 && mu2 <= denom * (1.0f + k_slop))
- {
- a /= denom;
- n.Normalize();
- *lambda = a;
- *normal = n;
- return true;
- }
- }
- }
-
- return false;
-}
-
-// From Real-time Collision Detection, p179.
-void b2AABB::RayCast(b2RayCastOutput* output, const b2RayCastInput& input)
-{
- float32 tmin = -B2_FLT_MAX;
- float32 tmax = B2_FLT_MAX;
-
- output->hit = false;
-
- b2Vec2 p = input.p1;
- b2Vec2 d = input.p2 - input.p1;
- b2Vec2 absD = b2Abs(d);
-
- b2Vec2 normal;
-
- for (int32 i = 0; i < 2; ++i)
- {
- if (absD(i) < B2_FLT_EPSILON)
- {
- // Parallel.
- if (p(i) < lowerBound(i) || upperBound(i) < p(i))
- {
- return;
- }
- }
- else
- {
- float32 inv_d = 1.0f / d(i);
- float32 t1 = (lowerBound(i) - p(i)) * inv_d;
- float32 t2 = (upperBound(i) - p(i)) * inv_d;
-
- // Sign of the normal vector.
- float32 s = -1.0f;
-
- if (t1 > t2)
- {
- b2Swap(t1, t2);
- s = 1.0f;
- }
-
- // Push the min up
- if (t1 > tmin)
- {
- normal.SetZero();
- normal(i) = s;
- tmin = t1;
- }
-
- // Pull the max down
- tmax = b2Min(tmax, t2);
-
- if (tmin > tmax)
- {
- return;
- }
- }
- }
-
- // Does the ray start inside the box?
- // Does the ray intersect beyond the max fraction?
- if (tmin < 0.0f || input.maxFraction < tmin)
- {
- return;
- }
-
- // Intersection.
- output->fraction = tmin;
- output->normal = normal;
- output->hit = true;
-}
Oops, something went wrong.

0 comments on commit cfdda16

Please sign in to comment.