(61d00a474) v0.9.7.1

This commit is contained in:
Regalis
2020-03-04 13:04:10 +01:00
parent 3c50efa5c9
commit 3c09ebe02f
5086 changed files with 786063 additions and 295871 deletions
@@ -1,3 +1,8 @@
/* Original source Farseer Physics Engine:
* Copyright (c) 2014 Ian Qvist, http://farseerphysics.codeplex.com
* Microsoft Permissive License (Ms-PL) v1.1
*/
/*
* Farseer Physics Engine:
* Copyright (c) 2012 Ian Qvist
@@ -21,6 +26,7 @@
*/
using FarseerPhysics.Common;
using FarseerPhysics.Common.Maths;
using Microsoft.Xna.Framework;
namespace FarseerPhysics.Collision.Shapes
@@ -143,8 +149,8 @@ namespace FarseerPhysics.Collision.Shapes
output = new RayCastOutput();
// Put the ray into the edge's frame of reference.
Vector2 p1 = MathUtils.MulT(transform.q, input.Point1 - transform.p);
Vector2 p2 = MathUtils.MulT(transform.q, input.Point2 - transform.p);
Vector2 p1 = Complex.Divide(input.Point1 - transform.p, ref transform.q);
Vector2 p2 = Complex.Divide(input.Point2 - transform.p, ref transform.q);
Vector2 d = p2 - p1;
Vector2 v1 = _vertex1;
@@ -201,15 +207,43 @@ namespace FarseerPhysics.Collision.Shapes
public override void ComputeAABB(out AABB aabb, ref Transform transform, int childIndex)
{
Vector2 v1 = MathUtils.Mul(ref transform, _vertex1);
Vector2 v2 = MathUtils.Mul(ref transform, _vertex2);
// OPT: Vector2 v1 = Transform.Multiply(ref _vertex1, ref transform);
float v1X = (_vertex1.X * transform.q.Real - _vertex1.Y * transform.q.Imaginary) + transform.p.X;
float v1Y = (_vertex1.Y * transform.q.Real + _vertex1.X * transform.q.Imaginary) + transform.p.Y;
// OPT: Vector2 v2 = Transform.Multiply(ref _vertex2, ref transform);
float v2X = (_vertex2.X * transform.q.Real - _vertex2.Y * transform.q.Imaginary) + transform.p.X;
float v2Y = (_vertex2.Y * transform.q.Real + _vertex2.X * transform.q.Imaginary) + transform.p.Y;
Vector2 lower = Vector2.Min(v1, v2);
Vector2 upper = Vector2.Max(v1, v2);
// OPT: aabb.LowerBound = Vector2.Min(v1, v2);
// OPT: aabb.UpperBound = Vector2.Max(v1, v2);
if (v1X < v2X)
{
aabb.LowerBound.X = v1X;
aabb.UpperBound.X = v2X;
}
else
{
aabb.LowerBound.X = v2X;
aabb.UpperBound.X = v1X;
}
if (v1Y < v2Y)
{
aabb.LowerBound.Y = v1Y;
aabb.UpperBound.Y = v2Y;
}
else
{
aabb.LowerBound.Y = v2Y;
aabb.UpperBound.Y = v1Y;
}
Vector2 r = new Vector2(Radius, Radius);
aabb.LowerBound = lower - r;
aabb.UpperBound = upper + r;
// OPT: Vector2 r = new Vector2(Radius, Radius);
// OPT: aabb.LowerBound = aabb.LowerBound - r;
// OPT: aabb.UpperBound = aabb.LowerBound + r;
aabb.LowerBound.X -= Radius;
aabb.LowerBound.Y -= Radius;
aabb.UpperBound.X += Radius;
aabb.UpperBound.Y += Radius;
}
protected override void ComputeProperties()