fix point not being transformed
parent
1d9c523cb2
commit
ec3e63e5e2
|
@ -26,7 +26,7 @@ namespace MoonTools.Core.Bonk
|
||||||
|
|
||||||
public Vector2 Support(Vector2 direction, Transform2D transform)
|
public Vector2 Support(Vector2 direction, Transform2D transform)
|
||||||
{
|
{
|
||||||
return position;
|
return Vector2.Transform(position.ToVector2(), transform.TransformMatrix);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Equals(object obj)
|
public override bool Equals(object obj)
|
||||||
|
@ -64,4 +64,4 @@ namespace MoonTools.Core.Bonk
|
||||||
return !(a == b);
|
return !(a == b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,8 @@ namespace Tests
|
||||||
[Test]
|
[Test]
|
||||||
public void PointLineOverlapping()
|
public void PointLineOverlapping()
|
||||||
{
|
{
|
||||||
var point = new Point(1, 1);
|
var point = new Point(-3, -3);
|
||||||
|
var pointTransform = new Transform2D(new Position2D(4, 4));
|
||||||
var line = new Line(new Position2D(-2, -2), new Position2D(2, 2));
|
var line = new Line(new Position2D(-2, -2), new Position2D(2, 2));
|
||||||
|
|
||||||
GJK2D.TestCollision(point, Transform2D.DefaultTransform, line, Transform2D.DefaultTransform).Should().BeTrue();
|
GJK2D.TestCollision(point, Transform2D.DefaultTransform, line, Transform2D.DefaultTransform).Should().BeTrue();
|
||||||
|
@ -41,10 +42,11 @@ namespace Tests
|
||||||
[Test]
|
[Test]
|
||||||
public void PointCircleNotOverlapping()
|
public void PointCircleNotOverlapping()
|
||||||
{
|
{
|
||||||
var point = new Point(3, 0);
|
var point = new Point(0, 0);
|
||||||
|
var pointTransform = new Transform2D(new Position2D(3, 0));
|
||||||
var circle = new Circle(1);
|
var circle = new Circle(1);
|
||||||
|
|
||||||
GJK2D.TestCollision(point, Transform2D.DefaultTransform, circle, Transform2D.DefaultTransform).Should().BeFalse();
|
GJK2D.TestCollision(point, pointTransform, circle, Transform2D.DefaultTransform).Should().BeFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
|
Loading…
Reference in New Issue