aboutsummaryrefslogtreecommitdiff
path: root/Client/Source/Phy2DLite/Collide.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-12-02 12:46:50 +0800
committerchai <chaifix@163.com>2021-12-02 12:46:50 +0800
commitb1d4e9866de19c70174553e543e81ef4473dee6c (patch)
treefa1518ce5e6580886d8f8b4d9772474cd6f67184 /Client/Source/Phy2DLite/Collide.cpp
parent83fedef41f6dcea4dde010abb025b7ed647d0501 (diff)
*number -> fixed
Diffstat (limited to 'Client/Source/Phy2DLite/Collide.cpp')
-rw-r--r--Client/Source/Phy2DLite/Collide.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/Client/Source/Phy2DLite/Collide.cpp b/Client/Source/Phy2DLite/Collide.cpp
index 116a72e..271dc7a 100644
--- a/Client/Source/Phy2DLite/Collide.cpp
+++ b/Client/Source/Phy2DLite/Collide.cpp
@@ -49,14 +49,14 @@ void Flip(FeaturePair& fp)
}
int ClipSegmentToLine(ClipVertex vOut[2], ClipVertex vIn[2],
- const Vec2& normal, number offset, char clipEdge)
+ const Vec2& normal, fixed offset, char clipEdge)
{
// Start with no output points
int numOut = 0;
// Calculate the distance of end points to the line
- number distance0 = Dot(normal, vIn[0].v) - offset;
- number distance1 = Dot(normal, vIn[1].v) - offset;
+ fixed distance0 = Dot(normal, vIn[0].v) - offset;
+ fixed distance1 = Dot(normal, vIn[1].v) - offset;
// If the points are behind the plane
if (distance0 <= _0) vOut[numOut++] = vIn[0];
@@ -66,7 +66,7 @@ int ClipSegmentToLine(ClipVertex vOut[2], ClipVertex vIn[2],
if (distance0 * distance1 < _0)
{
// Find intersection point of edge and plane
- number interp = distance0 / (distance0 - distance1);
+ fixed interp = distance0 / (distance0 - distance1);
vOut[numOut].v = vIn[0].v + interp * (vIn[1].v - vIn[0].v);
if (distance0 > _0)
{
@@ -184,7 +184,7 @@ namespace Phy2D
// Find best axis
Axis axis;
- number separation;
+ fixed separation;
Vec2 normal;
// Box A faces
@@ -192,8 +192,8 @@ namespace Phy2D
separation = faceA.x;
normal = dA.x > _0 ? RotA.col1 : -RotA.col1;
- const number relativeTol = _0_95;
- const number absoluteTol = _0_01;
+ const fixed relativeTol = _0_95;
+ const fixed absoluteTol = _0_01;
if (faceA.y > relativeTol * separation + absoluteTol * hA.y)
{
@@ -220,7 +220,7 @@ namespace Phy2D
// Setup clipping plane data based on the separating axis
Vec2 frontNormal, sideNormal;
ClipVertex incidentEdge[2];
- number front, negSide, posSide;
+ fixed front, negSide, posSide;
char negEdge, posEdge;
// Compute the clipping lines and the line segment to be clipped.
@@ -231,7 +231,7 @@ namespace Phy2D
frontNormal = normal;
front = Dot(posA, frontNormal) + hA.x;
sideNormal = RotA.col2;
- number side = Dot(posA, sideNormal);
+ fixed side = Dot(posA, sideNormal);
negSide = -side + hA.y;
posSide = side + hA.y;
negEdge = EDGE3;
@@ -245,7 +245,7 @@ namespace Phy2D
frontNormal = normal;
front = Dot(posA, frontNormal) + hA.y;
sideNormal = RotA.col1;
- number side = Dot(posA, sideNormal);
+ fixed side = Dot(posA, sideNormal);
negSide = -side + hA.x;
posSide = side + hA.x;
negEdge = EDGE2;
@@ -259,7 +259,7 @@ namespace Phy2D
frontNormal = -normal;
front = Dot(posB, frontNormal) + hB.x;
sideNormal = RotB.col2;
- number side = Dot(posB, sideNormal);
+ fixed side = Dot(posB, sideNormal);
negSide = -side + hB.y;
posSide = side + hB.y;
negEdge = EDGE3;
@@ -273,7 +273,7 @@ namespace Phy2D
frontNormal = -normal;
front = Dot(posB, frontNormal) + hB.y;
sideNormal = RotB.col1;
- number side = Dot(posB, sideNormal);
+ fixed side = Dot(posB, sideNormal);
negSide = -side + hB.x;
posSide = side + hB.x;
negEdge = EDGE2;
@@ -307,7 +307,7 @@ namespace Phy2D
int numContacts = 0;
for (int i = 0; i < 2; ++i)
{
- number separation = Dot(frontNormal, clipPoints2[i].v) - front;
+ fixed separation = Dot(frontNormal, clipPoints2[i].v) - front;
if (separation <= 0)
{