Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Box2D.NET.Samples/Samples/Collisions/TimeOfImpact.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public override void Step()
_input.sweepB = _sweepB;
_input.maxFraction = 1.0f;

_output = b2TimeOfImpact(ref _input);
_output = b2TimeOfImpact(_input);
}

public override void Draw()
Expand Down
14 changes: 7 additions & 7 deletions src/Box2D.NET/B2Distances.cs
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@
B2Simplex simplex = b2MakeSimplexFromCache(ref cache, ref proxyA, ref localProxyB);

int simplexIndex = 0;
if (simplexes != null && simplexIndex < simplexCapacity)

Check warning on line 497 in src/Box2D.NET/B2Distances.cs

View workflow job for this annotation

GitHub Actions / test-ubuntu-latest-9

Comparing a span to 'null' might be redundant, the 'null' literal will be implicitly converted to a 'Span<T>.Empty' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2265)

Check warning on line 497 in src/Box2D.NET/B2Distances.cs

View workflow job for this annotation

GitHub Actions / test-macos-latest-9

Comparing a span to 'null' might be redundant, the 'null' literal will be implicitly converted to a 'Span<T>.Empty' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2265)

Check warning on line 497 in src/Box2D.NET/B2Distances.cs

View workflow job for this annotation

GitHub Actions / test-macos-latest-10

Comparing a span to 'null' might be redundant, the 'null' literal will be implicitly converted to a 'Span<T>.Empty' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2265)

Check warning on line 497 in src/Box2D.NET/B2Distances.cs

View workflow job for this annotation

GitHub Actions / test-ubuntu-latest-10

Comparing a span to 'null' might be redundant, the 'null' literal will be implicitly converted to a 'Span<T>.Empty' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2265)

Check warning on line 497 in src/Box2D.NET/B2Distances.cs

View workflow job for this annotation

GitHub Actions / test-windows-latest-9

Comparing a span to 'null' might be redundant, the 'null' literal will be implicitly converted to a 'Span<T>.Empty' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2265)

Check warning on line 497 in src/Box2D.NET/B2Distances.cs

View workflow job for this annotation

GitHub Actions / test-windows-latest-10

Comparing a span to 'null' might be redundant, the 'null' literal will be implicitly converted to a 'Span<T>.Empty' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2265)
{
simplexes[simplexIndex] = simplex;
simplexIndex += 1;
Expand Down Expand Up @@ -967,7 +967,7 @@
}
#endif

public static B2SeparationFunction b2MakeSeparationFunction(ref B2SimplexCache cache, ref B2ShapeProxy proxyA, ref B2Sweep sweepA, ref B2ShapeProxy proxyB, ref B2Sweep sweepB, float t1)
public static B2SeparationFunction b2MakeSeparationFunction(ref B2SimplexCache cache, in B2ShapeProxy proxyA, in B2Sweep sweepA, in B2ShapeProxy proxyB, in B2Sweep sweepB, float t1)
{
B2SeparationFunction f = new B2SeparationFunction();

Expand Down Expand Up @@ -1170,7 +1170,7 @@
/// again.
// CCD via the local separating axis method. This seeks progression
// by computing the largest time at which separation is maintained.
public static B2TOIOutput b2TimeOfImpact(ref B2TOIInput input)
public static B2TOIOutput b2TimeOfImpact(in B2TOIInput input)
{
#if B2_SNOOP_TOI_COUNTERS
ulong ticks = b2GetTicks();
Expand All @@ -1181,17 +1181,17 @@
output.state = B2TOIState.b2_toiStateUnknown;
output.fraction = input.maxFraction;

B2Sweep sweepA = input.sweepA;
B2Sweep sweepB = input.sweepB;
ref readonly B2Sweep sweepA = ref input.sweepA;
ref readonly B2Sweep sweepB = ref input.sweepB;
B2_ASSERT(b2IsNormalizedRot(sweepA.q1) && b2IsNormalizedRot(sweepA.q2));
B2_ASSERT(b2IsNormalizedRot(sweepB.q1) && b2IsNormalizedRot(sweepB.q2));

// todo_erin
// c1 can be at the origin yet the points are far away
// B2Vec2 origin = b2Add(sweepA.c1, input.proxyA.points[0]);

ref B2ShapeProxy proxyA = ref input.proxyA;
ref B2ShapeProxy proxyB = ref input.proxyB;
ref readonly B2ShapeProxy proxyA = ref input.proxyA;
ref readonly B2ShapeProxy proxyB = ref input.proxyB;

float tMax = input.maxFraction;

Expand Down Expand Up @@ -1273,7 +1273,7 @@
}

// Initialize the separating axis.
B2SeparationFunction fcn = b2MakeSeparationFunction(ref cache, ref proxyA, ref sweepA, ref proxyB, ref sweepB, t1);
B2SeparationFunction fcn = b2MakeSeparationFunction(ref cache, proxyA, sweepA, proxyB, sweepB, t1);
#if FALSE
// Dump the curve seen by the root finder
{
Expand Down
4 changes: 2 additions & 2 deletions src/Box2D.NET/B2Solvers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
{
if (8 == B2_SIMD_WIDTH)
{
return 3;

Check warning on line 52 in src/Box2D.NET/B2Solvers.cs

View workflow job for this annotation

GitHub Actions / test-ubuntu-latest-9

Unreachable code detected

Check warning on line 52 in src/Box2D.NET/B2Solvers.cs

View workflow job for this annotation

GitHub Actions / test-macos-latest-9

Unreachable code detected

Check warning on line 52 in src/Box2D.NET/B2Solvers.cs

View workflow job for this annotation

GitHub Actions / test-macos-latest-8

Unreachable code detected

Check warning on line 52 in src/Box2D.NET/B2Solvers.cs

View workflow job for this annotation

GitHub Actions / test-macos-latest-10

Unreachable code detected

Check warning on line 52 in src/Box2D.NET/B2Solvers.cs

View workflow job for this annotation

GitHub Actions / test-ubuntu-latest-10

Unreachable code detected

Check warning on line 52 in src/Box2D.NET/B2Solvers.cs

View workflow job for this annotation

GitHub Actions / test-ubuntu-latest-8

Unreachable code detected

Check warning on line 52 in src/Box2D.NET/B2Solvers.cs

View workflow job for this annotation

GitHub Actions / test-windows-latest-9

Unreachable code detected

Check warning on line 52 in src/Box2D.NET/B2Solvers.cs

View workflow job for this annotation

GitHub Actions / test-windows-latest-10

Unreachable code detected

Check warning on line 52 in src/Box2D.NET/B2Solvers.cs

View workflow job for this annotation

GitHub Actions / test-windows-latest-8

Unreachable code detected
}
else if (4 == B2_SIMD_WIDTH)
{
Expand All @@ -57,7 +57,7 @@
}
else
{
return 0;

Check warning on line 60 in src/Box2D.NET/B2Solvers.cs

View workflow job for this annotation

GitHub Actions / test-ubuntu-latest-9

Unreachable code detected

Check warning on line 60 in src/Box2D.NET/B2Solvers.cs

View workflow job for this annotation

GitHub Actions / test-macos-latest-9

Unreachable code detected

Check warning on line 60 in src/Box2D.NET/B2Solvers.cs

View workflow job for this annotation

GitHub Actions / test-macos-latest-8

Unreachable code detected

Check warning on line 60 in src/Box2D.NET/B2Solvers.cs

View workflow job for this annotation

GitHub Actions / test-macos-latest-10

Unreachable code detected

Check warning on line 60 in src/Box2D.NET/B2Solvers.cs

View workflow job for this annotation

GitHub Actions / test-ubuntu-latest-10

Unreachable code detected

Check warning on line 60 in src/Box2D.NET/B2Solvers.cs

View workflow job for this annotation

GitHub Actions / test-ubuntu-latest-8

Unreachable code detected

Check warning on line 60 in src/Box2D.NET/B2Solvers.cs

View workflow job for this annotation

GitHub Actions / test-windows-latest-9

Unreachable code detected

Check warning on line 60 in src/Box2D.NET/B2Solvers.cs

View workflow job for this annotation

GitHub Actions / test-windows-latest-10

Unreachable code detected

Check warning on line 60 in src/Box2D.NET/B2Solvers.cs

View workflow job for this annotation

GitHub Actions / test-windows-latest-8

Unreachable code detected
}
}

Expand Down Expand Up @@ -434,7 +434,7 @@
input.sweepB = continuousContext.sweep;
input.maxFraction = continuousContext.fraction;

B2TOIOutput output = b2TimeOfImpact(ref input);
B2TOIOutput output = b2TimeOfImpact(input);
if (isSensor)
{
// Only accept a sensor hit that is sooner than the current solid hit.
Expand Down Expand Up @@ -469,7 +469,7 @@
B2ShapeExtent extent = b2ComputeShapeExtent(fastShape, centroid);
float radius = B2_CORE_FRACTION * extent.minExtent;
input.proxyB = b2MakeProxy(centroid, 1, radius);
output = b2TimeOfImpact(ref input);
output = b2TimeOfImpact(input);
if (0.0f < output.fraction && output.fraction < continuousContext.fraction)
{
hitFraction = output.fraction;
Expand Down
2 changes: 1 addition & 1 deletion test/Box2D.NET.Test/B2DistanceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public void TimeOfImpactTest()
input.sweepB = new B2Sweep(b2Vec2_zero, b2Vec2_zero, new B2Vec2(-2.0f, 0.0f), b2Rot_identity, b2Rot_identity);
input.maxFraction = 1.0f;

B2TOIOutput output = b2TimeOfImpact(ref input);
B2TOIOutput output = b2TimeOfImpact(input);

Assert.That(output.state, Is.EqualTo(B2TOIState.b2_toiStateHit));
Assert.That(output.fraction - 0.5f, Is.LessThan(0.005f));
Expand Down
Loading