Skip to content

Commit ddc6bd1

Browse files
committed
[upstream] Removed unnecessary tolerance test (erincatto/box2d#1000)
Should fix (erincatto/box2d#990), but I don't have a test case to verify.
1 parent 24c3505 commit ddc6bd1

2 files changed

Lines changed: 37 additions & 39 deletions

File tree

src/Box2D.NET.Samples/Samples/Collisions/ShapeDistance.cs

Lines changed: 36 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -22,45 +22,43 @@ public class ShapeDistance : Sample
2222

2323
public const int m_simplexCapacity = 20;
2424

25-
B2Polygon m_box;
26-
B2Polygon m_triangle;
27-
B2Vec2 m_point;
28-
B2Segment m_segment;
29-
30-
ShapeType m_typeA;
31-
ShapeType m_typeB;
32-
float m_radiusA;
33-
float m_radiusB;
34-
B2ShapeProxy m_proxyA;
35-
B2ShapeProxy m_proxyB;
36-
37-
B2SimplexCache m_cache;
38-
B2Simplex[] m_simplexes = new B2Simplex[m_simplexCapacity];
39-
int m_simplexCount;
40-
int m_simplexIndex;
41-
42-
43-
B2Transform m_transform;
44-
float m_angle;
45-
46-
B2Vec2 m_basePosition;
47-
B2Vec2 m_startPoint;
48-
float m_baseAngle;
49-
50-
bool m_dragging;
51-
bool m_rotating;
52-
bool m_showIndices;
53-
bool m_useCache;
54-
bool m_drawSimplex;
55-
25+
private B2Polygon m_box;
26+
private B2Polygon m_triangle;
27+
private B2Vec2 m_point;
28+
private B2Segment m_segment;
29+
30+
private ShapeType m_typeA;
31+
private ShapeType m_typeB;
32+
private float m_radiusA;
33+
private float m_radiusB;
34+
private B2ShapeProxy m_proxyA;
35+
private B2ShapeProxy m_proxyB;
36+
37+
private B2SimplexCache m_cache;
38+
private B2Simplex[] m_simplexes = new B2Simplex[m_simplexCapacity];
39+
private int m_simplexCount;
40+
private int m_simplexIndex;
41+
42+
private B2Transform m_transform;
43+
private float m_angle;
44+
45+
private B2Vec2 m_basePosition;
46+
private B2Vec2 m_startPoint;
47+
private float m_baseAngle;
48+
49+
private bool m_dragging;
50+
private bool m_rotating;
51+
private bool m_showIndices;
52+
private bool m_useCache;
53+
private bool m_drawSimplex;
5654

5755
//
58-
public B2Vec2 _outputPointA;
59-
public B2Vec2 _outputPointB;
60-
public B2Vec2 _outputNormal;
56+
private B2Vec2 _outputPointA;
57+
private B2Vec2 _outputPointB;
58+
private B2Vec2 _outputNormal;
6159

62-
public float _outputDistance;
63-
public int _outputIterations;
60+
private float _outputDistance;
61+
private int _outputIterations;
6462

6563

6664
private static Sample Create(SampleContext context)
@@ -218,9 +216,9 @@ public override void UpdateGui()
218216
base.UpdateGui();
219217

220218
float fontSize = ImGui.GetFontSize();
221-
float height = 310.0f;
219+
float height = 21.0f * fontSize;
222220
ImGui.SetNextWindowPos(new Vector2(0.5f * fontSize, m_camera.height - height - 2.0f * fontSize), ImGuiCond.Once);
223-
ImGui.SetNextWindowSize(new Vector2(240.0f, height));
221+
ImGui.SetNextWindowSize(new Vector2(19.0f * fontSize, height));
224222

225223
ImGui.Begin("Shape Distance", ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize);
226224

src/Box2D.NET/B2Distances.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ public static B2DistanceOutput b2ShapeDistance(ref B2DistanceInput input, ref B2
644644
b2MakeSimplexCache(ref cache, ref simplex);
645645

646646
// Apply radii if requested
647-
if (input.useRadii && output.distance > 0.1f * B2_LINEAR_SLOP)
647+
if (input.useRadii)
648648
{
649649
float radiusA = input.proxyA.radius;
650650
float radiusB = input.proxyB.radius;

0 commit comments

Comments
 (0)