Unstable 1.8.4.0
This commit is contained in:
+1
-1
@@ -150,7 +150,7 @@ namespace FarseerPhysics.Common.Decomposition.Seidel
|
||||
{
|
||||
Point a = (p.Next - p);
|
||||
Point b = (p.Prev - p);
|
||||
return (float)Math.Atan2(a.Cross(b), a.Dot(b));
|
||||
return MathF.Atan2(a.Cross(b), a.Dot(b));
|
||||
}
|
||||
|
||||
private bool AngleSign()
|
||||
|
||||
@@ -709,7 +709,7 @@ namespace FarseerPhysics.Common
|
||||
/// </summary>
|
||||
public void Normalize()
|
||||
{
|
||||
float d = MathHelper.TwoPi * (float)Math.Floor(A0 / MathHelper.TwoPi);
|
||||
float d = MathHelper.TwoPi * MathF.Floor(A0 / MathHelper.TwoPi);
|
||||
A0 -= d;
|
||||
A -= d;
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace FarseerPhysics.Common.Maths
|
||||
|
||||
public float Phase
|
||||
{
|
||||
get { return (float)Math.Atan2(Imaginary, Real); }
|
||||
get { return MathF.Atan2(Imaginary, Real); }
|
||||
set
|
||||
{
|
||||
if (value == 0)
|
||||
@@ -26,14 +26,14 @@ namespace FarseerPhysics.Common.Maths
|
||||
this = Complex.One;
|
||||
return;
|
||||
}
|
||||
this.Real = (float)Math.Cos(value);
|
||||
this.Imaginary = (float)Math.Sin(value);
|
||||
this.Real = MathF.Cos(value);
|
||||
this.Imaginary = MathF.Sin(value);
|
||||
}
|
||||
}
|
||||
|
||||
public float Magnitude
|
||||
{
|
||||
get { return (float)Math.Round(Math.Sqrt(MagnitudeSquared())); }
|
||||
get { return MathF.Round(MathF.Sqrt(MagnitudeSquared())); }
|
||||
}
|
||||
|
||||
|
||||
@@ -49,8 +49,8 @@ namespace FarseerPhysics.Common.Maths
|
||||
return Complex.One;
|
||||
|
||||
return new Complex(
|
||||
(float)Math.Cos(angle),
|
||||
(float)Math.Sin(angle));
|
||||
MathF.Cos(angle),
|
||||
MathF.Sin(angle));
|
||||
}
|
||||
|
||||
public void Conjugate()
|
||||
|
||||
@@ -315,7 +315,7 @@ namespace FarseerPhysics.Common
|
||||
for (int i = 1; i < divisions; i++)
|
||||
{
|
||||
Vector2 normal = GetPositionNormal(t);
|
||||
float angle = (float)Math.Atan2(normal.Y, normal.X);
|
||||
float angle = MathF.Atan2(normal.Y, normal.X);
|
||||
|
||||
verts.Add(new Vector3(end, angle));
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Original source Farseer Physics Engine:
|
||||
/* Original source Farseer Physics Engine:
|
||||
* Copyright (c) 2014 Ian Qvist, http://farseerphysics.codeplex.com
|
||||
* Microsoft Permissive License (Ms-PL) v1.1
|
||||
*/
|
||||
@@ -14,7 +14,7 @@ using FarseerPhysics.Dynamics;
|
||||
namespace FarseerPhysics.Common.PhysicsLogic
|
||||
{
|
||||
// Original Code by Steven Lu - see http://www.box2d.org/forum/viewtopic.php?f=3&t=1688
|
||||
// Ported to Farseer 3.0 by Nicolás Hormazábal
|
||||
// Ported to Farseer 3.0 by Nicolás Hormazábal
|
||||
|
||||
internal struct ShapeData
|
||||
{
|
||||
@@ -185,7 +185,7 @@ namespace FarseerPhysics.Common.PhysicsLogic
|
||||
if ((shapes[i].Body.BodyType == BodyType.Dynamic) && ps != null)
|
||||
{
|
||||
Vector2 toCentroid = shapes[i].Body.GetWorldPoint(ps.MassData.Centroid) - pos;
|
||||
float angleToCentroid = (float)Math.Atan2(toCentroid.Y, toCentroid.X);
|
||||
float angleToCentroid = MathF.Atan2(toCentroid.Y, toCentroid.X);
|
||||
float min = float.MaxValue;
|
||||
float max = float.MinValue;
|
||||
float minAbsolute = 0.0f;
|
||||
@@ -194,7 +194,7 @@ namespace FarseerPhysics.Common.PhysicsLogic
|
||||
for (int j = 0; j < ps.Vertices.Count; ++j)
|
||||
{
|
||||
Vector2 toVertex = (shapes[i].Body.GetWorldPoint(ps.Vertices[j]) - pos);
|
||||
float newAngle = (float)Math.Atan2(toVertex.Y, toVertex.X);
|
||||
float newAngle = MathF.Atan2(toVertex.Y, toVertex.X);
|
||||
float diff = (newAngle - angleToCentroid);
|
||||
|
||||
diff = (diff - MathHelper.Pi) % (2 * MathHelper.Pi);
|
||||
@@ -253,7 +253,7 @@ namespace FarseerPhysics.Common.PhysicsLogic
|
||||
midpt = midpt / 2;
|
||||
|
||||
Vector2 p1 = pos;
|
||||
Vector2 p2 = radius * new Vector2((float)Math.Cos(midpt), (float)Math.Sin(midpt)) + pos;
|
||||
Vector2 p2 = radius * new Vector2(MathF.Cos(midpt), MathF.Sin(midpt)) + pos;
|
||||
|
||||
// RaycastOne
|
||||
bool hitClosest = false;
|
||||
@@ -343,7 +343,7 @@ namespace FarseerPhysics.Common.PhysicsLogic
|
||||
j += offset)
|
||||
{
|
||||
Vector2 p1 = pos;
|
||||
Vector2 p2 = pos + radius * new Vector2((float)Math.Cos(j), (float)Math.Sin(j));
|
||||
Vector2 p2 = pos + radius * new Vector2(MathF.Cos(j), MathF.Sin(j));
|
||||
Vector2 hitpoint = Vector2.Zero;
|
||||
float minlambda = float.MaxValue;
|
||||
|
||||
@@ -371,7 +371,7 @@ namespace FarseerPhysics.Common.PhysicsLogic
|
||||
float impulse = (arclen / (MinRays + insertedRays)) * maxForce * 180.0f / MathHelper.Pi * (1.0f - Math.Min(1.0f, minlambda));
|
||||
|
||||
// We Apply the impulse!!!
|
||||
Vector2 vectImp = Vector2.Dot(impulse * new Vector2((float)Math.Cos(j), (float)Math.Sin(j)), -ro.Normal) * new Vector2((float)Math.Cos(j), (float)Math.Sin(j));
|
||||
Vector2 vectImp = Vector2.Dot(impulse * new Vector2(MathF.Cos(j), MathF.Sin(j)), -ro.Normal) * new Vector2(MathF.Cos(j), MathF.Sin(j));
|
||||
_data[i].Body.ApplyLinearImpulse(ref vectImp, ref hitpoint);
|
||||
|
||||
// We gather the fixtures for returning them
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace FarseerPhysics.Common.PhysicsLogic
|
||||
float forcePercent = GetPercent(distance, radius);
|
||||
|
||||
Vector2 forceVector = pos - overlappingBody.Position;
|
||||
forceVector *= 1f / (float)Math.Sqrt(forceVector.X * forceVector.X + forceVector.Y * forceVector.Y);
|
||||
forceVector *= 1f / MathF.Sqrt(forceVector.X * forceVector.X + forceVector.Y * forceVector.Y);
|
||||
forceVector *= MathHelper.Min(force * forcePercent, maxForce);
|
||||
forceVector *= -1;
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace FarseerPhysics.Common.PhysicsLogic
|
||||
private float GetPercent(float distance, float radius)
|
||||
{
|
||||
//(1-(distance/radius))^power-1
|
||||
float percent = (float)Math.Pow(1 - ((distance - radius) / radius), Power) - 1;
|
||||
float percent = MathF.Pow(1 - ((distance - radius) / radius), Power) - 1;
|
||||
|
||||
if (float.IsNaN(percent))
|
||||
return 0f;
|
||||
|
||||
@@ -137,8 +137,8 @@ namespace FarseerPhysics.Common.PolygonManipulation
|
||||
float dy0 = vertices[middle].Y - vertices[lower].Y;
|
||||
float dx1 = vertices[upper].Y - vertices[middle].X;
|
||||
float dy1 = vertices[upper].Y - vertices[middle].Y;
|
||||
float norm0 = (float)Math.Sqrt(dx0 * dx0 + dy0 * dy0);
|
||||
float norm1 = (float)Math.Sqrt(dx1 * dx1 + dy1 * dy1);
|
||||
float norm0 = MathF.Sqrt(dx0 * dx0 + dy0 * dy0);
|
||||
float norm1 = MathF.Sqrt(dx1 * dx1 + dy1 * dy1);
|
||||
|
||||
if (!(norm0 > 0.0f && norm1 > 0.0f) && newNVertices > 3)
|
||||
{
|
||||
|
||||
@@ -112,8 +112,8 @@ namespace FarseerPhysics.Common
|
||||
phase--;
|
||||
}
|
||||
|
||||
vertices.Add(posOffset + new Vector2(xRadius * (float)Math.Cos(stepSize * -(i + phase)),
|
||||
-yRadius * (float)Math.Sin(stepSize * -(i + phase))));
|
||||
vertices.Add(posOffset + new Vector2(xRadius * MathF.Cos(stepSize * -(i + phase)),
|
||||
-yRadius * MathF.Sin(stepSize * -(i + phase))));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,8 +160,8 @@ namespace FarseerPhysics.Common
|
||||
|
||||
vertices.Add(new Vector2(xRadius, 0));
|
||||
for (int i = numberOfEdges - 1; i > 0; --i)
|
||||
vertices.Add(new Vector2(xRadius * (float)Math.Cos(stepSize * i),
|
||||
-yRadius * (float)Math.Sin(stepSize * i)));
|
||||
vertices.Add(new Vector2(xRadius * MathF.Cos(stepSize * i),
|
||||
-yRadius * MathF.Sin(stepSize * i)));
|
||||
|
||||
return vertices;
|
||||
}
|
||||
@@ -177,8 +177,8 @@ namespace FarseerPhysics.Common
|
||||
float stepSize = radians / sides;
|
||||
for (int i = sides - 1; i > 0; i--)
|
||||
{
|
||||
vertices.Add(new Vector2(radius * (float)Math.Cos(stepSize * i),
|
||||
radius * (float)Math.Sin(stepSize * i)));
|
||||
vertices.Add(new Vector2(radius * MathF.Cos(stepSize * i),
|
||||
radius * MathF.Sin(stepSize * i)));
|
||||
}
|
||||
|
||||
return vertices;
|
||||
@@ -252,8 +252,8 @@ namespace FarseerPhysics.Common
|
||||
float stepSize = MathHelper.Pi / topEdges;
|
||||
for (int i = 1; i < topEdges; i++)
|
||||
{
|
||||
vertices.Add(new Vector2(topRadius * (float)Math.Cos(stepSize * i),
|
||||
topRadius * (float)Math.Sin(stepSize * i) + newHeight));
|
||||
vertices.Add(new Vector2(topRadius * MathF.Cos(stepSize * i),
|
||||
topRadius * MathF.Sin(stepSize * i) + newHeight));
|
||||
}
|
||||
|
||||
vertices.Add(new Vector2(-topRadius, newHeight));
|
||||
@@ -264,8 +264,8 @@ namespace FarseerPhysics.Common
|
||||
stepSize = MathHelper.Pi / bottomEdges;
|
||||
for (int i = 1; i < bottomEdges; i++)
|
||||
{
|
||||
vertices.Add(new Vector2(-bottomRadius * (float)Math.Cos(stepSize * i),
|
||||
-bottomRadius * (float)Math.Sin(stepSize * i) - newHeight));
|
||||
vertices.Add(new Vector2(-bottomRadius * MathF.Cos(stepSize * i),
|
||||
-bottomRadius * MathF.Sin(stepSize * i) - newHeight));
|
||||
}
|
||||
|
||||
vertices.Add(new Vector2(bottomRadius, -newHeight));
|
||||
@@ -298,24 +298,24 @@ namespace FarseerPhysics.Common
|
||||
{
|
||||
vertices.Add(
|
||||
new Vector2(radius *
|
||||
(float)Math.Cos(stepSize * i + toothAngleStepSize * 2f + toothTipStepSize),
|
||||
MathF.Cos(stepSize * i + toothAngleStepSize * 2f + toothTipStepSize),
|
||||
-radius *
|
||||
(float)Math.Sin(stepSize * i + toothAngleStepSize * 2f + toothTipStepSize)));
|
||||
MathF.Sin(stepSize * i + toothAngleStepSize * 2f + toothTipStepSize)));
|
||||
|
||||
vertices.Add(
|
||||
new Vector2((radius + toothHeight) *
|
||||
(float)Math.Cos(stepSize * i + toothAngleStepSize + toothTipStepSize),
|
||||
MathF.Cos(stepSize * i + toothAngleStepSize + toothTipStepSize),
|
||||
-(radius + toothHeight) *
|
||||
(float)Math.Sin(stepSize * i + toothAngleStepSize + toothTipStepSize)));
|
||||
MathF.Sin(stepSize * i + toothAngleStepSize + toothTipStepSize)));
|
||||
}
|
||||
|
||||
vertices.Add(new Vector2((radius + toothHeight) *
|
||||
(float)Math.Cos(stepSize * i + toothAngleStepSize),
|
||||
MathF.Cos(stepSize * i + toothAngleStepSize),
|
||||
-(radius + toothHeight) *
|
||||
(float)Math.Sin(stepSize * i + toothAngleStepSize)));
|
||||
MathF.Sin(stepSize * i + toothAngleStepSize)));
|
||||
|
||||
vertices.Add(new Vector2(radius * (float)Math.Cos(stepSize * i),
|
||||
-radius * (float)Math.Sin(stepSize * i)));
|
||||
vertices.Add(new Vector2(radius * MathF.Cos(stepSize * i),
|
||||
-radius * MathF.Sin(stepSize * i)));
|
||||
}
|
||||
|
||||
return vertices;
|
||||
|
||||
@@ -287,8 +287,8 @@ namespace FarseerPhysics.Common
|
||||
{
|
||||
Debug.Assert(!AttachedToBody, "Rotating vertices that are used by a Body can result in unstable behavior.");
|
||||
|
||||
float num1 = (float)Math.Cos(value);
|
||||
float num2 = (float)Math.Sin(value);
|
||||
float num1 = MathF.Cos(value);
|
||||
float num2 = MathF.Sin(value);
|
||||
|
||||
for (int i = 0; i < Count; i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user