diff --git a/source/MonoGame.Extended.Collisions/CollisionComponent.cs b/source/MonoGame.Extended.Collisions/CollisionComponent.cs
index d5393ba9..24a9cbd6 100644
--- a/source/MonoGame.Extended.Collisions/CollisionComponent.cs
+++ b/source/MonoGame.Extended.Collisions/CollisionComponent.cs
@@ -206,7 +206,7 @@ namespace MonoGame.Extended.Collisions
return Vector2.Zero;
}
- var displacement = Point2.Displacement(circ1.Center, circ2.Center);
+ var displacement = circ1.Center - circ2.Center;
Vector2 desiredDisplacement;
if (displacement != Vector2.Zero)
@@ -230,7 +230,7 @@ namespace MonoGame.Extended.Collisions
if (rect.Contains(circ.Center) || cToCollPoint.Equals(Vector2.Zero))
{
- var displacement = Point2.Displacement(circ.Center, rect.Center);
+ var displacement = circ.Center - rect.Center;
Vector2 desiredDisplacement;
if (displacement != Vector2.Zero)
@@ -276,7 +276,7 @@ namespace MonoGame.Extended.Collisions
var rotation = Matrix3x2.CreateRotationZ(orientedRectangleB.Orientation.Rotation);
var circleCenterInRectangleSpace = rotation.Transform(circleA.Center - orientedRectangleB.Center);
var circleInRectangleSpace = new CircleF(circleCenterInRectangleSpace, circleA.Radius);
- var boundingRectangle = new BoundingRectangle(new Point2(), orientedRectangleB.Radii);
+ var boundingRectangle = new BoundingRectangle(new Vector2(), orientedRectangleB.Radii);
var penetrationVector = PenetrationVector(circleInRectangleSpace, boundingRectangle);
var inverseRotation = Matrix3x2.CreateRotationZ(-orientedRectangleB.Orientation.Rotation);
diff --git a/source/MonoGame.Extended.Collisions/QuadTree/QuadTree.cs b/source/MonoGame.Extended.Collisions/QuadTree/QuadTree.cs
index a46699a7..6ea602d3 100644
--- a/source/MonoGame.Extended.Collisions/QuadTree/QuadTree.cs
+++ b/source/MonoGame.Extended.Collisions/QuadTree/QuadTree.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using Microsoft.Xna.Framework;
namespace MonoGame.Extended.Collisions.QuadTree
{
@@ -225,9 +226,9 @@ namespace MonoGame.Extended.Collisions.QuadTree
RectangleF[] childAreas =
{
RectangleF.CreateFrom(min, center),
- RectangleF.CreateFrom(new Point2(center.X, min.Y), new Point2(max.X, center.Y)),
+ RectangleF.CreateFrom(new Vector2(center.X, min.Y), new Vector2(max.X, center.Y)),
RectangleF.CreateFrom(center, max),
- RectangleF.CreateFrom(new Point2(min.X, center.Y), new Point2(center.X, max.Y))
+ RectangleF.CreateFrom(new Vector2(min.X, center.Y), new Vector2(center.X, max.Y))
};
for (var i = 0; i < childAreas.Length; ++i)
diff --git a/source/MonoGame.Extended.Gui/Controls/TextBox.cs b/source/MonoGame.Extended.Gui/Controls/TextBox.cs
index 75b69404..c0766699 100644
--- a/source/MonoGame.Extended.Gui/Controls/TextBox.cs
+++ b/source/MonoGame.Extended.Gui/Controls/TextBox.cs
@@ -280,7 +280,7 @@ namespace MonoGame.Extended.Gui.Controls
//{
// var start = 0;
// var end = 0;
- // var point = Point2.Zero;
+ // var point = Vector2.Zero;
// if (_selectionIndexes.Last() > _selectionIndexes.Peek())
// {
// start = _selectionIndexes.Peek();
@@ -328,4 +328,4 @@ namespace MonoGame.Extended.Gui.Controls
return (Rectangle) caretRectangle;
}
}
-}
\ No newline at end of file
+}
diff --git a/source/MonoGame.Extended.Tiled/Renderers/TiledMapLayerModelBuilder.cs b/source/MonoGame.Extended.Tiled/Renderers/TiledMapLayerModelBuilder.cs
index fbc99d68..db14dc0a 100644
--- a/source/MonoGame.Extended.Tiled/Renderers/TiledMapLayerModelBuilder.cs
+++ b/source/MonoGame.Extended.Tiled/Renderers/TiledMapLayerModelBuilder.cs
@@ -31,7 +31,7 @@ namespace MonoGame.Extended.Tiled.Renderers
return model;
}
- public void AddSprite(Texture2D texture, Point2 position, Rectangle sourceRectangle, TiledMapTileFlipFlags flipFlags)
+ public void AddSprite(Texture2D texture, Vector2 position, Rectangle sourceRectangle, TiledMapTileFlipFlags flipFlags)
{
Indices.AddRange(CreateTileIndices(Vertices.Count));
Debug.Assert(Indices.Count <= TiledMapHelper.MaximumIndicesPerModel);
diff --git a/source/MonoGame.Extended.Tiled/Renderers/TiledMapModelBuilder.cs b/source/MonoGame.Extended.Tiled/Renderers/TiledMapModelBuilder.cs
index b96925e3..f310a85f 100644
--- a/source/MonoGame.Extended.Tiled/Renderers/TiledMapModelBuilder.cs
+++ b/source/MonoGame.Extended.Tiled/Renderers/TiledMapModelBuilder.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace MonoGame.Extended.Tiled.Renderers
@@ -110,7 +111,7 @@ namespace MonoGame.Extended.Tiled.Renderers
dictionary.Add(layer, CreateLayerModels(map, layer).ToArray());
}
- private static Point2 GetTilePosition(TiledMap map, TiledMapTile mapTile)
+ private static Vector2 GetTilePosition(TiledMap map, TiledMapTile mapTile)
{
switch (map.Orientation)
{
diff --git a/source/MonoGame.Extended.Tiled/Serialization/TiledMapLayerModelContent.cs b/source/MonoGame.Extended.Tiled/Serialization/TiledMapLayerModelContent.cs
index 31b64efd..e76ae02c 100644
--- a/source/MonoGame.Extended.Tiled/Serialization/TiledMapLayerModelContent.cs
+++ b/source/MonoGame.Extended.Tiled/Serialization/TiledMapLayerModelContent.cs
@@ -34,7 +34,7 @@ namespace MonoGame.Extended.Tiled.Serialization
{
}
- public void AddTileVertices(Point2 position, Rectangle? sourceRectangle = null, TiledMapTileFlipFlags flags = TiledMapTileFlipFlags.None)
+ public void AddTileVertices(Vector2 position, Rectangle? sourceRectangle = null, TiledMapTileFlipFlags flags = TiledMapTileFlipFlags.None)
{
float texelLeft, texelTop, texelRight, texelBottom;
var sourceRectangle1 = sourceRectangle ?? new Rectangle(0, 0, (int)ImageSize.Width, (int)ImageSize.Height);
diff --git a/source/MonoGame.Extended.Tiled/TiledMapHelper.cs b/source/MonoGame.Extended.Tiled/TiledMapHelper.cs
index 43edf67f..5815d988 100644
--- a/source/MonoGame.Extended.Tiled/TiledMapHelper.cs
+++ b/source/MonoGame.Extended.Tiled/TiledMapHelper.cs
@@ -9,7 +9,7 @@ namespace MonoGame.Extended.Tiled
// 2 triangles per tile (mesh), with each triangle indexing 3 out of 4 vertices, so 6 vertices
public const int IndicesPerTile = 6;
// by using ushort type for indices we are limited to indexing vertices from 0 to 65535
- // this limits us on how many vertices can fit inside a single vertex buffer (65536 vertices)
+ // this limits us on how many vertices can fit inside a single vertex buffer (65536 vertices)
public const int MaximumVerticesPerModel = ushort.MaxValue + 1;
// and thus, we know how many tiles we can fit inside a vertex or index buffer (16384 tiles)
public const int MaximumTilesPerGeometryContent = MaximumVerticesPerModel / VerticesPerTile;
@@ -25,20 +25,20 @@ namespace MonoGame.Extended.Tiled
return new Rectangle(x, y, tileWidth, tileHeight);
}
- internal static Point2 GetOrthogonalPosition(int tileX, int tileY, int tileWidth, int tileHeight)
+ internal static Vector2 GetOrthogonalPosition(int tileX, int tileY, int tileWidth, int tileHeight)
{
var x = tileX * tileWidth;
var y = tileY * tileHeight;
return new Vector2(x, y);
}
- internal static Point2 GetIsometricPosition(int tileX, int tileY, int tileWidth, int tileHeight)
+ internal static Vector2 GetIsometricPosition(int tileX, int tileY, int tileWidth, int tileHeight)
{
// You can think of an isometric Tiled map as a regular orthogonal map that is rotated -45 degrees
- // i.e.: the origin (0, 0) is the top tile of the diamond grid;
+ // i.e.: the origin (0, 0) is the top tile of the diamond grid;
// (mapWidth, 0) is the far right tile of the diamond grid
// (0, mapHeight) is the far left tile of the diamond grid
- // (mapWidth, mapHeight) is the bottom tile of the diamond grid
+ // (mapWidth, mapHeight) is the bottom tile of the diamond grid
var halfTileWidth = tileWidth * 0.5f;
var halfTileHeight = tileHeight * 0.5f;
diff --git a/source/MonoGame.Extended.Tiled/TiledMapPolygonObject.cs b/source/MonoGame.Extended.Tiled/TiledMapPolygonObject.cs
index 0e1f25e1..5970e454 100644
--- a/source/MonoGame.Extended.Tiled/TiledMapPolygonObject.cs
+++ b/source/MonoGame.Extended.Tiled/TiledMapPolygonObject.cs
@@ -4,12 +4,12 @@ namespace MonoGame.Extended.Tiled
{
public sealed class TiledMapPolygonObject : TiledMapObject
{
- public TiledMapPolygonObject(int identifier, string name, Point2[] points, SizeF size, Vector2 position, float rotation = 0, float opacity = 1, bool isVisible = true, string type = null)
+ public TiledMapPolygonObject(int identifier, string name, Vector2[] points, SizeF size, Vector2 position, float rotation = 0, float opacity = 1, bool isVisible = true, string type = null)
: base(identifier, name, size, position, rotation, opacity, isVisible, type)
{
Points = points;
}
- public Point2[] Points { get; }
+ public Vector2[] Points { get; }
}
}
diff --git a/source/MonoGame.Extended.Tiled/TiledMapPolylineObject.cs b/source/MonoGame.Extended.Tiled/TiledMapPolylineObject.cs
index a82494c9..607a99f8 100644
--- a/source/MonoGame.Extended.Tiled/TiledMapPolylineObject.cs
+++ b/source/MonoGame.Extended.Tiled/TiledMapPolylineObject.cs
@@ -4,12 +4,12 @@ namespace MonoGame.Extended.Tiled
{
public sealed class TiledMapPolylineObject : TiledMapObject
{
- public TiledMapPolylineObject(int identifier, string name, Point2[] points, SizeF size, Vector2 position, float rotation = 0, float opacity = 1, bool isVisible = true, string type = null)
+ public TiledMapPolylineObject(int identifier, string name, Vector2[] points, SizeF size, Vector2 position, float rotation = 0, float opacity = 1, bool isVisible = true, string type = null)
: base(identifier, name, size, position, rotation, opacity, isVisible, type)
{
Points = points;
}
- public Point2[] Points { get; }
+ public Vector2[] Points { get; }
}
}
diff --git a/source/MonoGame.Extended.Tiled/TiledMapReader.cs b/source/MonoGame.Extended.Tiled/TiledMapReader.cs
index 94848a0c..d226067e 100644
--- a/source/MonoGame.Extended.Tiled/TiledMapReader.cs
+++ b/source/MonoGame.Extended.Tiled/TiledMapReader.cs
@@ -180,16 +180,16 @@ namespace MonoGame.Extended.Tiled
return mapObject;
}
- private static Point2[] ReadPoints(ContentReader reader)
+ private static Vector2[] ReadPoints(ContentReader reader)
{
var pointCount = reader.ReadInt32();
- var points = new Point2[pointCount];
+ var points = new Vector2[pointCount];
for (var i = 0; i < pointCount; i++)
{
var x = reader.ReadSingle();
var y = reader.ReadSingle();
- points[i] = new Point2(x, y);
+ points[i] = new Vector2(x, y);
}
return points;
diff --git a/source/MonoGame.Extended.Tiled/TiledMapTilesetReader.cs b/source/MonoGame.Extended.Tiled/TiledMapTilesetReader.cs
index 2586bdeb..29166f78 100644
--- a/source/MonoGame.Extended.Tiled/TiledMapTilesetReader.cs
+++ b/source/MonoGame.Extended.Tiled/TiledMapTilesetReader.cs
@@ -132,16 +132,16 @@ namespace MonoGame.Extended.Tiled
return mapObject;
}
- private static Point2[] ReadPoints(ContentReader reader)
+ private static Vector2[] ReadPoints(ContentReader reader)
{
var pointCount = reader.ReadInt32();
- var points = new Point2[pointCount];
+ var points = new Vector2[pointCount];
for (var i = 0; i < pointCount; i++)
{
var x = reader.ReadSingle();
var y = reader.ReadSingle();
- points[i] = new Point2(x, y);
+ points[i] = new Vector2(x, y);
}
return points;
diff --git a/source/MonoGame.Extended/BitmapFonts/BitmapFont.cs b/source/MonoGame.Extended/BitmapFonts/BitmapFont.cs
index bb989b0e..61b0d81b 100644
--- a/source/MonoGame.Extended/BitmapFonts/BitmapFont.cs
+++ b/source/MonoGame.Extended/BitmapFonts/BitmapFont.cs
@@ -49,10 +49,10 @@ namespace MonoGame.Extended.BitmapFonts
public RectangleF GetStringRectangle(string text)
{
- return GetStringRectangle(text, Point2.Zero);
+ return GetStringRectangle(text, Vector2.Zero);
}
- public RectangleF GetStringRectangle(string text, Point2 position)
+ public RectangleF GetStringRectangle(string text, Vector2 position)
{
var glyphs = GetGlyphs(text, position);
var rectangle = new RectangleF(position.X, position.Y, 0, LineHeight);
@@ -74,9 +74,9 @@ namespace MonoGame.Extended.BitmapFonts
return rectangle;
}
- public RectangleF GetStringRectangle(StringBuilder text, Point2? position = null)
+ public RectangleF GetStringRectangle(StringBuilder text, Vector2? position = null)
{
- var position1 = position ?? new Point2();
+ var position1 = position ?? new Vector2();
var glyphs = GetGlyphs(text, position1);
var rectangle = new RectangleF(position1.X, position1.Y, 0, LineHeight);
@@ -97,12 +97,12 @@ namespace MonoGame.Extended.BitmapFonts
return rectangle;
}
- public StringGlyphEnumerable GetGlyphs(string text, Point2? position = null)
+ public StringGlyphEnumerable GetGlyphs(string text, Vector2? position = null)
{
return new StringGlyphEnumerable(this, text, position);
}
- public StringBuilderGlyphEnumerable GetGlyphs(StringBuilder text, Point2? position)
+ public StringBuilderGlyphEnumerable GetGlyphs(StringBuilder text, Vector2? position)
{
return new StringBuilderGlyphEnumerable(this, text, position);
}
@@ -116,7 +116,7 @@ namespace MonoGame.Extended.BitmapFonts
{
private readonly StringGlyphEnumerator _enumerator;
- public StringGlyphEnumerable(BitmapFont font, string text, Point2? position)
+ public StringGlyphEnumerable(BitmapFont font, string text, Vector2? position)
{
_enumerator = new StringGlyphEnumerator(font, text, position);
}
@@ -142,7 +142,7 @@ namespace MonoGame.Extended.BitmapFonts
private readonly BitmapFont _font;
private readonly string _text;
private int _index;
- private readonly Point2 _position;
+ private readonly Vector2 _position;
private Vector2 _positionDelta;
private BitmapFontGlyph _currentGlyph;
private BitmapFontGlyph? _previousGlyph;
@@ -158,12 +158,12 @@ namespace MonoGame.Extended.BitmapFonts
public BitmapFontGlyph Current => _currentGlyph;
- public StringGlyphEnumerator(BitmapFont font, string text, Point2? position)
+ public StringGlyphEnumerator(BitmapFont font, string text, Vector2? position)
{
_font = font;
_text = text;
_index = -1;
- _position = position ?? new Point2();
+ _position = position ?? new Vector2();
_positionDelta = new Vector2();
_currentGlyph = new BitmapFontGlyph();
_previousGlyph = null;
@@ -220,7 +220,7 @@ namespace MonoGame.Extended.BitmapFonts
public void Reset()
{
- _positionDelta = new Point2();
+ _positionDelta = new Vector2();
_index = -1;
_previousGlyph = null;
}
@@ -230,7 +230,7 @@ namespace MonoGame.Extended.BitmapFonts
{
private readonly StringBuilderGlyphEnumerator _enumerator;
- public StringBuilderGlyphEnumerable(BitmapFont font, StringBuilder text, Point2? position)
+ public StringBuilderGlyphEnumerable(BitmapFont font, StringBuilder text, Vector2? position)
{
_enumerator = new StringBuilderGlyphEnumerator(font, text, position);
}
@@ -256,7 +256,7 @@ namespace MonoGame.Extended.BitmapFonts
private readonly BitmapFont _font;
private readonly StringBuilder _text;
private int _index;
- private readonly Point2 _position;
+ private readonly Vector2 _position;
private Vector2 _positionDelta;
private BitmapFontGlyph _currentGlyph;
private BitmapFontGlyph? _previousGlyph;
@@ -272,12 +272,12 @@ namespace MonoGame.Extended.BitmapFonts
public BitmapFontGlyph Current => _currentGlyph;
- public StringBuilderGlyphEnumerator(BitmapFont font, StringBuilder text, Point2? position)
+ public StringBuilderGlyphEnumerator(BitmapFont font, StringBuilder text, Vector2? position)
{
_font = font;
_text = text;
_index = -1;
- _position = position ?? new Point2();
+ _position = position ?? new Vector2();
_positionDelta = new Vector2();
_currentGlyph = new BitmapFontGlyph();
_previousGlyph = null;
@@ -338,7 +338,7 @@ namespace MonoGame.Extended.BitmapFonts
public void Reset()
{
- _positionDelta = new Point2();
+ _positionDelta = new Vector2();
_index = -1;
_previousGlyph = null;
}
diff --git a/source/MonoGame.Extended/Math/BoundingRectangle.cs b/source/MonoGame.Extended/Math/BoundingRectangle.cs
index b608d963..f9977da4 100644
--- a/source/MonoGame.Extended/Math/BoundingRectangle.cs
+++ b/source/MonoGame.Extended/Math/BoundingRectangle.cs
@@ -8,7 +8,7 @@ namespace MonoGame.Extended
// Real-Time Collision Detection, Christer Ericson, 2005. Chapter 4.2; Bounding Volumes - Axis-aligned Bounding Boxes (AABBs). pg 77
///
- /// An axis-aligned, four sided, two dimensional box defined by a centre and a radii
+ /// An axis-aligned, four sided, two dimensional box defined by a centre and a radii
/// .
///
///
@@ -29,7 +29,7 @@ namespace MonoGame.Extended
IEquatableByRef
{
///
- /// The with and
+ /// The with and
/// set to .
///
public static readonly BoundingRectangle Empty = new BoundingRectangle();
@@ -37,7 +37,7 @@ namespace MonoGame.Extended
///
/// The centre position of this .
///
- public Point2 Center;
+ public Vector2 Center;
///
/// The distance from the point along both axes to any point on the boundary of this
@@ -47,37 +47,37 @@ namespace MonoGame.Extended
///
/// Initializes a new instance of the structure from the specified centre
- /// and the radii .
+ /// and the radii .
///
- /// The centre .
+ /// The centre .
/// The radii .
- public BoundingRectangle(Point2 center, SizeF halfExtents)
+ public BoundingRectangle(Vector2 center, SizeF halfExtents)
{
Center = center;
HalfExtents = halfExtents;
}
///
- /// Computes the from a minimum and maximum
- /// .
+ /// Computes the from a minimum and maximum
+ /// .
///
/// The minimum point.
/// The maximum point.
/// The resulting bounding rectangle.
- public static void CreateFrom(Point2 minimum, Point2 maximum, out BoundingRectangle result)
+ public static void CreateFrom(Vector2 minimum, Vector2 maximum, out BoundingRectangle result)
{
- result.Center = new Point2((maximum.X + minimum.X) * 0.5f, (maximum.Y + minimum.Y) * 0.5f);
+ result.Center = new Vector2((maximum.X + minimum.X) * 0.5f, (maximum.Y + minimum.Y) * 0.5f);
result.HalfExtents = new Vector2((maximum.X - minimum.X) * 0.5f, (maximum.Y - minimum.Y) * 0.5f);
}
///
- /// Computes the from a minimum and maximum
- /// .
+ /// Computes the from a minimum and maximum
+ /// .
///
/// The minimum point.
/// The maximum point.
/// The resulting .
- public static BoundingRectangle CreateFrom(Point2 minimum, Point2 maximum)
+ public static BoundingRectangle CreateFrom(Vector2 minimum, Vector2 maximum)
{
BoundingRectangle result;
CreateFrom(minimum, maximum, out result);
@@ -85,24 +85,24 @@ namespace MonoGame.Extended
}
///
- /// Computes the from a list of structures.
+ /// Computes the from a list of structures.
///
/// The points.
/// The resulting bounding rectangle.
- public static void CreateFrom(IReadOnlyList points, out BoundingRectangle result)
+ public static void CreateFrom(IReadOnlyList points, out BoundingRectangle result)
{
- Point2 minimum;
- Point2 maximum;
+ Vector2 minimum;
+ Vector2 maximum;
PrimitivesHelper.CreateRectangleFromPoints(points, out minimum, out maximum);
CreateFrom(minimum, maximum, out result);
}
///
- /// Computes the from a list of structures.
+ /// Computes the from a list of structures.
///
/// The points.
/// The resulting .
- public static BoundingRectangle CreateFrom(IReadOnlyList points)
+ public static BoundingRectangle CreateFrom(IReadOnlyList points)
{
BoundingRectangle result;
CreateFrom(points, out result);
@@ -179,8 +179,8 @@ namespace MonoGame.Extended
var secondMinimum = second.Center - second.HalfExtents;
var secondMaximum = second.Center + second.HalfExtents;
- var minimum = Point2.Minimum(firstMinimum, secondMinimum);
- var maximum = Point2.Maximum(firstMaximum, secondMaximum);
+ var minimum = MathExtended.CalculateMinimumVector2(firstMinimum, secondMinimum);
+ var maximum = MathExtended.CalculateMaximumVector2(firstMaximum, secondMaximum);
result = CreateFrom(minimum, maximum);
}
@@ -233,8 +233,8 @@ namespace MonoGame.Extended
var secondMinimum = second.Center - second.HalfExtents;
var secondMaximum = second.Center + second.HalfExtents;
- var minimum = Point2.Maximum(firstMinimum, secondMinimum);
- var maximum = Point2.Minimum(firstMaximum, secondMaximum);
+ var minimum = MathExtended.CalculateMaximumVector2(firstMinimum, secondMinimum);
+ var maximum = MathExtended.CalculateMinimumVector2(firstMaximum, secondMaximum);
if ((maximum.X < minimum.X) || (maximum.Y < minimum.Y))
result = new BoundingRectangle();
@@ -337,10 +337,10 @@ namespace MonoGame.Extended
}
///
- /// Updates this from a list of structures.
+ /// Updates this from a list of structures.
///
/// The points.
- public void UpdateFromPoints(IReadOnlyList points)
+ public void UpdateFromPoints(IReadOnlyList points)
{
var boundingRectangle = CreateFrom(points);
Center = boundingRectangle.Center;
@@ -349,7 +349,7 @@ namespace MonoGame.Extended
///
/// Determines whether the specified contains the specified
- /// .
+ /// .
///
/// The bounding rectangle.
/// The point.
@@ -357,7 +357,7 @@ namespace MonoGame.Extended
/// true if the contains the ; otherwise,
/// false.
///
- public static bool Contains(ref BoundingRectangle boundingRectangle, ref Point2 point)
+ public static bool Contains(ref BoundingRectangle boundingRectangle, ref Vector2 point)
{
// Real-Time Collision Detection, Christer Ericson, 2005. Chapter 4.2; Bounding Volumes - Axis-aligned Bounding Boxes (AABBs). pg 78
@@ -369,7 +369,7 @@ namespace MonoGame.Extended
///
/// Determines whether the specified contains the specified
- /// .
+ /// .
///
/// The bounding rectangle.
/// The point.
@@ -377,43 +377,43 @@ namespace MonoGame.Extended
/// true if the contains the ; otherwise,
/// false.
///
- public static bool Contains(BoundingRectangle boundingRectangle, Point2 point)
+ public static bool Contains(BoundingRectangle boundingRectangle, Vector2 point)
{
return Contains(ref boundingRectangle, ref point);
}
///
- /// Determines whether this contains the specified .
+ /// Determines whether this contains the specified .
///
/// The point.
///
/// true if this contains the ; otherwise,
/// false.
///
- public bool Contains(Point2 point)
+ public bool Contains(Vector2 point)
{
return Contains(this, point);
}
///
- /// Computes the squared distance from this to a .
+ /// Computes the squared distance from this to a .
///
/// The point.
/// The squared distance from this to the .
- public float SquaredDistanceTo(Point2 point)
+ public float SquaredDistanceTo(Vector2 point)
{
return PrimitivesHelper.SquaredDistanceToPointFromRectangle(Center - HalfExtents, Center + HalfExtents, point);
}
///
- /// Computes the closest on this to a specified
- /// .
+ /// Computes the closest on this to a specified
+ /// .
///
/// The point.
- /// The closest on this to the .
- public Point2 ClosestPointTo(Point2 point)
+ /// The closest on this to the .
+ public Vector2 ClosestPointTo(Vector2 point)
{
- Point2 result;
+ Vector2 result;
PrimitivesHelper.ClosestPointToPointFromRectangle(Center - HalfExtents, Center + HalfExtents, point, out result);
return result;
}
@@ -517,7 +517,7 @@ namespace MonoGame.Extended
public static implicit operator BoundingRectangle(Rectangle rectangle)
{
var radii = new SizeF(rectangle.Width * 0.5f, rectangle.Height * 0.5f);
- var centre = new Point2(rectangle.X + radii.Width, rectangle.Y + radii.Height);
+ var centre = new Vector2(rectangle.X + radii.Width, rectangle.Y + radii.Height);
return new BoundingRectangle(centre, radii);
}
@@ -545,7 +545,7 @@ namespace MonoGame.Extended
public static implicit operator BoundingRectangle(RectangleF rectangle)
{
var radii = new SizeF(rectangle.Width * 0.5f, rectangle.Height * 0.5f);
- var centre = new Point2(rectangle.X + radii.Width, rectangle.Y + radii.Height);
+ var centre = new Vector2(rectangle.X + radii.Width, rectangle.Y + radii.Height);
return new BoundingRectangle(centre, radii);
}
diff --git a/source/MonoGame.Extended/Math/CircleF.cs b/source/MonoGame.Extended/Math/CircleF.cs
index 70f93074..aa7fc9c4 100644
--- a/source/MonoGame.Extended/Math/CircleF.cs
+++ b/source/MonoGame.Extended/Math/CircleF.cs
@@ -8,7 +8,7 @@ namespace MonoGame.Extended
// Real-Time Collision Detection, Christer Ericson, 2005. Chapter 4.3; Bounding Volumes - Spheres. pg 88
///
- /// A two dimensional circle defined by a centre and a radius .
+ /// A two dimensional circle defined by a centre and a radius .
///
///
///
@@ -25,7 +25,7 @@ namespace MonoGame.Extended
///
/// The centre position of this .
///
- [DataMember] public Point2 Center;
+ [DataMember] public Vector2 Center;
///
/// The distance from the point to any point on the boundary of this .
@@ -35,7 +35,7 @@ namespace MonoGame.Extended
///
/// Gets or sets the position of the circle.
///
- public Point2 Position
+ public Vector2 Position
{
get => Center;
set => Center = value;
@@ -63,38 +63,38 @@ namespace MonoGame.Extended
///
/// Initializes a new instance of the structure from the specified centre
- /// and the radius .
+ /// and the radius .
///
/// The centre point.
/// The radius.
- public CircleF(Point2 center, float radius)
+ public CircleF(Vector2 center, float radius)
{
Center = center;
Radius = radius;
}
///
- /// Computes the bounding from a minimum and maximum
- /// .
+ /// Computes the bounding from a minimum and maximum
+ /// .
///
/// The minimum point.
/// The maximum point.
/// The resulting circle.
- public static void CreateFrom(Point2 minimum, Point2 maximum, out CircleF result)
+ public static void CreateFrom(Vector2 minimum, Vector2 maximum, out CircleF result)
{
- result.Center = new Point2((maximum.X + minimum.X) * 0.5f, (maximum.Y + minimum.Y) * 0.5f);
+ result.Center = new Vector2((maximum.X + minimum.X) * 0.5f, (maximum.Y + minimum.Y) * 0.5f);
var distanceVector = maximum - minimum;
result.Radius = distanceVector.X > distanceVector.Y ? distanceVector.X * 0.5f : distanceVector.Y * 0.5f;
}
///
- /// Computes the bounding from a minimum and maximum
- /// .
+ /// Computes the bounding from a minimum and maximum
+ /// .
///
/// The minimum point.
/// The maximum point.
/// An .
- public static CircleF CreateFrom(Point2 minimum, Point2 maximum)
+ public static CircleF CreateFrom(Vector2 minimum, Vector2 maximum)
{
CircleF result;
CreateFrom(minimum, maximum, out result);
@@ -102,11 +102,11 @@ namespace MonoGame.Extended
}
///
- /// Computes the bounding from a list of structures.
+ /// Computes the bounding from a list of structures.
///
/// The points.
/// The resulting circle.
- public static void CreateFrom(IReadOnlyList points, out CircleF result)
+ public static void CreateFrom(IReadOnlyList points, out CircleF result)
{
// Real-Time Collision Detection, Christer Ericson, 2005. Chapter 4.3; Bounding Volumes - Spheres. pg 89-90
@@ -116,26 +116,26 @@ namespace MonoGame.Extended
return;
}
- var minimum = new Point2(float.MaxValue, float.MaxValue);
- var maximum = new Point2(float.MinValue, float.MinValue);
+ var minimum = new Vector2(float.MaxValue, float.MaxValue);
+ var maximum = new Vector2(float.MinValue, float.MinValue);
// ReSharper disable once ForCanBeConvertedToForeach
for (var index = points.Count - 1; index >= 0; --index)
{
var point = points[index];
- minimum = Point2.Minimum(minimum, point);
- maximum = Point2.Maximum(maximum, point);
+ minimum = MathExtended.CalculateMinimumVector2(minimum, point);
+ maximum = MathExtended.CalculateMaximumVector2(maximum, point);
}
CreateFrom(minimum, maximum, out result);
}
///
- /// Computes the bounding from a list of structures.
+ /// Computes the bounding from a list of structures.
///
/// The points.
/// An .
- public static CircleF CreateFrom(IReadOnlyList points)
+ public static CircleF CreateFrom(IReadOnlyList points)
{
CircleF result;
CreateFrom(points, out result);
@@ -261,7 +261,7 @@ namespace MonoGame.Extended
///
/// Determines whether the specified contains the specified
- /// .
+ /// .
///
/// The circle.
/// The point.
@@ -269,7 +269,7 @@ namespace MonoGame.Extended
/// true if the contains the ; otherwise,
/// false.
///
- public static bool Contains(ref CircleF circle, Point2 point)
+ public static bool Contains(ref CircleF circle, Vector2 point)
{
var dx = circle.Center.X - point.X;
var dy = circle.Center.Y - point.Y;
@@ -280,7 +280,7 @@ namespace MonoGame.Extended
///
/// Determines whether the specified contains the specified
- /// .
+ /// .
///
/// The circle.
/// The point.
@@ -288,31 +288,31 @@ namespace MonoGame.Extended
/// true if the contains the ; otherwise,
/// false.
///
- public static bool Contains(CircleF circle, Point2 point)
+ public static bool Contains(CircleF circle, Vector2 point)
{
return Contains(ref circle, point);
}
///
- /// Determines whether this contains the specified .
+ /// Determines whether this contains the specified .
///
/// The point.
///
/// true if this contains the ; otherwise,
/// false.
///
- public bool Contains(Point2 point)
+ public bool Contains(Vector2 point)
{
return Contains(ref this, point);
}
///
- /// Computes the closest on this to a specified
- /// .
+ /// Computes the closest on this to a specified
+ /// .
///
/// The point.
- /// The closest on this to the .
- public Point2 ClosestPointTo(Point2 point)
+ /// The closest on this to the .
+ public Vector2 ClosestPointTo(Vector2 point)
{
var distanceVector = point - Center;
var lengthSquared = distanceVector.Dot(distanceVector);
@@ -323,18 +323,18 @@ namespace MonoGame.Extended
}
///
- /// Computes the on the boundary of of this using the specified angle.
+ /// Computes the on the boundary of of this using the specified angle.
///
/// The angle in radians.
- /// The on the boundary of this using .
- public Point2 BoundaryPointAt(float angle)
+ /// The on the boundary of this using .
+ public Vector2 BoundaryPointAt(float angle)
{
var direction = new Vector2((float) Math.Cos(angle), (float) Math.Sin(angle));
return Center + Radius * direction;
}
[Obsolete("Circle.GetPointAlongEdge() may be removed in the future. Use BoundaryPointAt() instead.")]
- public Point2 GetPointAlongEdge(float angle)
+ public Vector2 GetPointAlongEdge(float angle)
{
return Center + new Vector2(Radius * (float) Math.Cos(angle), Radius * (float) Math.Sin(angle));
}
@@ -460,7 +460,7 @@ namespace MonoGame.Extended
{
var halfWidth = rectangle.Width / 2;
var halfHeight = rectangle.Height / 2;
- return new CircleF(new Point2(rectangle.X + halfWidth, rectangle.Y + halfHeight),
+ return new CircleF(new Vector2(rectangle.X + halfWidth, rectangle.Y + halfHeight),
halfWidth > halfHeight ? halfWidth : halfHeight);
}
@@ -499,7 +499,7 @@ namespace MonoGame.Extended
{
var halfWidth = rectangle.Width * 0.5f;
var halfHeight = rectangle.Height * 0.5f;
- return new CircleF(new Point2(rectangle.X + halfWidth, rectangle.Y + halfHeight),
+ return new CircleF(new Vector2(rectangle.X + halfWidth, rectangle.Y + halfHeight),
halfWidth > halfHeight ? halfWidth : halfHeight);
}
diff --git a/source/MonoGame.Extended/Math/EllipseF.cs b/source/MonoGame.Extended/Math/EllipseF.cs
index 684a770f..1b67aa03 100644
--- a/source/MonoGame.Extended/Math/EllipseF.cs
+++ b/source/MonoGame.Extended/Math/EllipseF.cs
@@ -11,7 +11,7 @@ namespace MonoGame.Extended
[DataMember] public float RadiusX { get; set; }
[DataMember] public float RadiusY { get; set; }
- public Point2 Position
+ public Vector2 Position
{
get => Center;
set => Center = value;
@@ -23,7 +23,7 @@ namespace MonoGame.Extended
RadiusX = radiusX;
RadiusY = radiusY;
}
-
+
public float Left => Center.X - RadiusX;
public float Top => Center.Y - RadiusY;
public float Right => Center.X + RadiusX;
@@ -62,8 +62,8 @@ namespace MonoGame.Extended
public bool Equals(ref EllipseF ellispse)
{
// ReSharper disable once CompareOfFloatsByEqualityOperator
- return ellispse.Center == Center
- && ellispse.RadiusX == RadiusX
+ return ellispse.Center == Center
+ && ellispse.RadiusX == RadiusX
&& ellispse.RadiusY == RadiusY;
}
diff --git a/source/MonoGame.Extended/Math/OrientedRectangle.cs b/source/MonoGame.Extended/Math/OrientedRectangle.cs
index 8f648e02..0806e8dd 100644
--- a/source/MonoGame.Extended/Math/OrientedRectangle.cs
+++ b/source/MonoGame.Extended/Math/OrientedRectangle.cs
@@ -19,7 +19,7 @@ namespace MonoGame.Extended
///
/// The centre position of this .
///
- public Point2 Center;
+ public Vector2 Center;
///
/// The distance from the point along both axes to any point on the boundary of this
@@ -35,12 +35,12 @@ namespace MonoGame.Extended
///
/// Initializes a new instance of the structure from the specified centre
- /// and the radii .
+ /// and the radii .
///
- /// The centre .
+ /// The centre .
/// The radii .
/// The orientation .
- public OrientedRectangle(Point2 center, SizeF radii, Matrix3x2 orientation)
+ public OrientedRectangle(Vector2 center, SizeF radii, Matrix3x2 orientation)
{
Center = center;
Radii = radii;
@@ -56,7 +56,7 @@ namespace MonoGame.Extended
{
var topLeft = -Radii;
var bottomLeft = -new Vector2(Radii.X, -Radii.Y);
- var topRight = (Vector2)new Point2(Radii.X, -Radii.Y);
+ var topRight = (Vector2)new Vector2(Radii.X, -Radii.Y);
var bottomRight = Radii;
return new List
@@ -69,7 +69,7 @@ namespace MonoGame.Extended
}
}
- public Point2 Position
+ public Vector2 Position
{
get => Vector2.Transform(-Radii, Orientation) + Center;
set => throw new NotImplementedException();
@@ -167,7 +167,7 @@ namespace MonoGame.Extended
public static explicit operator OrientedRectangle(RectangleF rectangle)
{
var radii = new SizeF(rectangle.Width * 0.5f, rectangle.Height * 0.5f);
- var centre = new Point2(rectangle.X + radii.Width, rectangle.Y + radii.Height);
+ var centre = new Vector2(rectangle.X + radii.Width, rectangle.Y + radii.Height);
return new OrientedRectangle(centre, radii, Matrix3x2.Identity);
}
diff --git a/source/MonoGame.Extended/Math/Point2.cs b/source/MonoGame.Extended/Math/Point2.cs
deleted file mode 100644
index b2d19b50..00000000
--- a/source/MonoGame.Extended/Math/Point2.cs
+++ /dev/null
@@ -1,380 +0,0 @@
-using System;
-using System.Diagnostics;
-using Microsoft.Xna.Framework;
-
-namespace MonoGame.Extended
-{
- // Real-Time Collision Detection, Christer Ericson, 2005. Chapter 3.2; A Math and Geometry Primer - Coordinate Systems and Points. pg 35
-
- ///
- /// A two-dimensional point defined by a 2-tuple of real numbers, (x, y).
- ///
- ///
- ///
- /// A point is a position in two-dimensional space, the location of which is described in terms of a
- /// two-dimensional coordinate system, given by a reference point, called the origin, and two coordinate axes.
- ///
- ///
- /// A common two-dimensional coordinate system is the Cartesian (or rectangular) coordinate system where the
- /// coordinate axes, conventionally denoted the X axis and Y axis, are perpindicular to each other. For the
- /// three-dimensional rectangular coordinate system, the third axis is called the Z axis.
- ///
- ///
- ///
- ///
- [DebuggerDisplay("{DebugDisplayString,nq}")]
- public struct Point2 : IEquatable, IEquatableByRef
- {
- ///
- /// Returns a with and equal to 0.0f.
- ///
- public static readonly Point2 Zero = new Point2();
-
- ///
- /// Returns a with and set to not a number.
- ///
- public static readonly Point2 NaN = new Point2(float.NaN, float.NaN);
-
- ///
- /// The x-coordinate of this .
- ///
- public float X;
-
- ///
- /// The y-coordinate of this .
- ///
- public float Y;
-
- ///
- /// Initializes a new instance of the structure from the specified coordinates.
- ///
- /// The x-coordinate.
- /// The y-coordinate.
- public Point2(float x, float y)
- {
- X = x;
- Y = y;
- }
-
- ///
- /// Compares two structures. The result specifies
- /// whether the values of the and
- /// fields of the two
- /// structures are equal.
- ///
- /// The first point.
- /// The second point.
- ///
- /// true if the and
- /// fields of the two
- /// structures are equal; otherwise, false.
- ///
- public static bool operator ==(Point2 first, Point2 second)
- {
- return first.Equals(ref second);
- }
-
- ///
- /// Indicates whether this is equal to another .
- ///
- /// The point.
- ///
- /// true if this is equal to the ; otherwise,
- /// false.
- ///
- public bool Equals(Point2 point)
- {
- return Equals(ref point);
- }
-
- ///
- /// Indicates whether this is equal to another .
- ///
- /// The point.
- ///
- /// true if this is equal to the parameter; otherwise,
- /// false.
- ///
- public bool Equals(ref Point2 point)
- {
- // ReSharper disable CompareOfFloatsByEqualityOperator
- return (point.X == X) && (point.Y == Y);
- // ReSharper restore CompareOfFloatsByEqualityOperator
- }
-
- ///
- /// Returns a value indicating whether this is equal to a specified object.
- ///
- /// The object to make the comparison with.
- ///
- /// true if this is equal to ; otherwise, false.
- ///
- public override bool Equals(object obj)
- {
- if (obj is Point2)
- return Equals((Point2) obj);
- return false;
- }
-
- ///
- /// Compares two structures. The result specifies
- /// whether the values of the or
- /// fields of the two
- /// structures are unequal.
- ///
- /// The first point.
- /// The second point.
- ///
- /// true if the or
- /// fields of the two
- /// structures are unequal; otherwise, false.
- ///
- public static bool operator !=(Point2 first, Point2 second)
- {
- return !(first == second);
- }
-
- ///
- /// Calculates the representing the addition of a and a
- /// .
- ///
- /// The point.
- /// The vector.
- ///
- /// The representing the addition of a and a .
- ///
- public static Point2 operator +(Point2 point, Vector2 vector)
- {
- return Add(point, vector);
- }
-
- ///
- /// Calculates the representing the addition of a and a
- /// .
- ///
- /// The point.
- /// The vector.
- ///
- /// The representing the addition of a and a .
- ///
- public static Point2 Add(Point2 point, Vector2 vector)
- {
- Point2 p;
- p.X = point.X + vector.X;
- p.Y = point.Y + vector.Y;
- return p;
- }
-
- ///
- /// Calculates the representing the subtraction of a and a
- /// .
- ///
- /// The point.
- /// The vector.
- ///
- /// The representing the substraction of a and a .
- ///
- public static Point2 operator -(Point2 point, Vector2 vector)
- {
- return Subtract(point, vector);
- }
-
- ///
- /// Calculates the representing the addition of a and a
- /// .
- ///
- /// The point.
- /// The vector.
- ///
- /// The representing the substraction of a and a .
- ///
- public static Point2 Subtract(Point2 point, Vector2 vector)
- {
- Point2 p;
- p.X = point.X - vector.X;
- p.Y = point.Y - vector.Y;
- return p;
- }
-
- ///
- /// Calculates the representing the displacement of two structures.
- ///
- /// The second point.
- /// The first point.
- ///
- /// The representing the displacement of two structures.
- ///
- public static Vector2 operator -(Point2 point1, Point2 point2)
- {
- return Displacement(point1, point2);
- }
-
- ///
- /// Calculates the representing the displacement of two structures.
- ///
- /// The second point.
- /// The first point.
- ///
- /// The representing the displacement of two structures.
- ///
- public static Vector2 Displacement(Point2 point2, Point2 point1)
- {
- Vector2 vector;
- vector.X = point2.X - point1.X;
- vector.Y = point2.Y - point1.Y;
- return vector;
- }
-
- ///
- /// Translates a by a given .
- ///
- /// The point.
- /// The size.
- ///
- /// The result of the operator.
- ///
- public static Point2 operator +(Point2 point, SizeF size)
- {
- return Add(point, size);
- }
-
- ///
- /// Translates a by a given .
- ///
- /// The point.
- /// The size.
- ///
- /// The result of the operator.
- ///
- public static Point2 Add(Point2 point, SizeF size)
- {
- return new Point2(point.X + size.Width, point.Y + size.Height);
- }
-
- ///
- /// Translates a by the negative of a given .
- ///
- /// The point.
- /// The size.
- ///
- /// The result of the operator.
- ///
- public static Point2 operator -(Point2 point, SizeF size)
- {
- return Subtract(point, size);
- }
-
- ///
- /// Translates a by the negative of a given .
- ///
- /// The point.
- /// The size.
- ///
- /// The result of the operator.
- ///
- public static Point2 Subtract(Point2 point, SizeF size)
- {
- return new Point2(point.X - size.Width, point.Y - size.Height);
- }
-
- ///
- /// Returns a hash code of this suitable for use in hashing algorithms and data
- /// structures like a hash table.
- ///
- ///
- /// A hash code of this .
- ///
- public override int GetHashCode()
- {
- unchecked
- {
- return (X.GetHashCode()*397) ^ Y.GetHashCode();
- }
- }
-
- ///
- /// Calculates the that contains the minimal coordinate values from two
- /// structures.
- /// structures.
- ///
- /// The first point.
- /// The second point.
- ///
- /// The the that contains the minimal coordinate values from two
- /// structures.
- ///
- public static Point2 Minimum(Point2 first, Point2 second)
- {
- return new Point2(first.X < second.X ? first.X : second.X,
- first.Y < second.Y ? first.Y : second.Y);
- }
-
- ///
- /// Calculates the that contains the maximal coordinate values from two
- /// structures.
- /// structures.
- ///
- /// The first point.
- /// The second point.
- ///
- /// The the that contains the maximal coordinate values from two
- /// structures.
- ///
- public static Point2 Maximum(Point2 first, Point2 second)
- {
- return new Point2(first.X > second.X ? first.X : second.X,
- first.Y > second.Y ? first.Y : second.Y);
- }
-
- ///
- /// Performs an implicit conversion from a to a position .
- ///
- /// The point.
- ///
- /// The resulting .
- ///
- public static implicit operator Vector2(Point2 point)
- {
- return new Vector2(point.X, point.Y);
- }
-
- ///
- /// Performs an implicit conversion from a to a position .
- ///
- /// The vector.
- ///
- /// The resulting .
- ///
- public static implicit operator Point2(Vector2 vector)
- {
- return new Point2(vector.X, vector.Y);
- }
-
-
- ///
- /// Performs an implicit conversion from a to a .
- ///
- /// The point.
- ///
- /// The resulting .
- ///
- public static implicit operator Point2(Point point)
- {
- return new Point2(point.X, point.Y);
- }
-
-
- ///
- /// Returns a that represents this .
- ///
- ///
- /// A that represents this .
- ///
- public override string ToString()
- {
- return $"({X}, {Y})";
- }
-
- internal string DebugDisplayString => ToString();
- }
-}
diff --git a/source/MonoGame.Extended/Math/PrimitivesHelper.cs b/source/MonoGame.Extended/Math/PrimitivesHelper.cs
index 0180943b..374736ec 100644
--- a/source/MonoGame.Extended/Math/PrimitivesHelper.cs
+++ b/source/MonoGame.Extended/Math/PrimitivesHelper.cs
@@ -37,14 +37,14 @@ namespace MonoGame.Extended
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal static void CreateRectangleFromPoints(IReadOnlyList points, out Point2 minimum, out Point2 maximum)
+ internal static void CreateRectangleFromPoints(IReadOnlyList points, out Vector2 minimum, out Vector2 maximum)
{
// Real-Time Collision Detection, Christer Ericson, 2005. Chapter 4.2; Bounding Volumes - Axis-aligned Bounding Boxes (AABBs). pg 82-84
if (points == null || points.Count == 0)
{
- minimum = Point2.Zero;
- maximum = Point2.Zero;
+ minimum = Vector2.Zero;
+ maximum = Vector2.Zero;
return;
}
@@ -54,13 +54,13 @@ namespace MonoGame.Extended
for (var index = points.Count - 1; index > 0; --index)
{
var point = points[index];
- minimum = Point2.Minimum(minimum, point);
- maximum = Point2.Maximum(maximum, point);
+ minimum = MathExtended.CalculateMinimumVector2(minimum, point);
+ maximum = MathExtended.CalculateMaximumVector2(maximum, point);
}
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal static void TransformRectangle(ref Point2 center, ref Vector2 halfExtents, ref Matrix3x2 transformMatrix)
+ internal static void TransformRectangle(ref Vector2 center, ref Vector2 halfExtents, ref Matrix3x2 transformMatrix)
{
// Real-Time Collision Detection, Christer Ericson, 2005. Chapter 4.2; Bounding Volumes - Axis-aligned Bounding Boxes (AABBs). pg 86-87
@@ -73,7 +73,7 @@ namespace MonoGame.Extended
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static void TransformOrientedRectangle(
- ref Point2 center,
+ ref Vector2 center,
ref Matrix3x2 orientation,
ref Matrix3x2 transformMatrix)
{
@@ -87,7 +87,7 @@ namespace MonoGame.Extended
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal static float SquaredDistanceToPointFromRectangle(Point2 minimum, Point2 maximum, Point2 point)
+ internal static float SquaredDistanceToPointFromRectangle(Vector2 minimum, Vector2 maximum, Vector2 point)
{
// Real-Time Collision Detection, Christer Ericson, 2005. Chapter 5.1.3.1; Basic Primitive Tests - Closest-point Computations - Distance of Point to AABB. pg 130-131
var squaredDistance = 0.0f;
@@ -121,7 +121,7 @@ namespace MonoGame.Extended
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
- internal static void ClosestPointToPointFromRectangle(Point2 minimum, Point2 maximum, Point2 point, out Point2 result)
+ internal static void ClosestPointToPointFromRectangle(Vector2 minimum, Vector2 maximum, Vector2 point, out Vector2 result)
{
// Real-Time Collision Detection, Christer Ericson, 2005. Chapter 5.1.2; Basic Primitive Tests - Closest-point Computations. pg 130-131
diff --git a/source/MonoGame.Extended/Math/Ray2.cs b/source/MonoGame.Extended/Math/Ray2.cs
index c8ed7e5f..d99244ba 100644
--- a/source/MonoGame.Extended/Math/Ray2.cs
+++ b/source/MonoGame.Extended/Math/Ray2.cs
@@ -4,9 +4,9 @@ using Microsoft.Xna.Framework;
namespace MonoGame.Extended
{
- // Real-Time Collision Detection, Christer Ericson, 2005. Chapter 3.5; A Math and Geometry Primer - Lines, Rays, and Segments. pg 53-54
+ // Real-Time Collision Detection, Christer Ericson, 2005. Chapter 3.5; A Math and Geometry Primer - Lines, Rays, and Segments. pg 53-54
///
- /// A two dimensional ray defined by a starting and a direction .
+ /// A two dimensional ray defined by a starting and a direction .
///
///
///
@@ -14,9 +14,9 @@ namespace MonoGame.Extended
public struct Ray2 : IEquatable, IEquatableByRef
{
///
- /// The starting of this .
+ /// The starting of this .
///
- public Point2 Position;
+ public Vector2 Position;
///
/// The direction of this .
@@ -28,7 +28,7 @@ namespace MonoGame.Extended
///
/// The starting point.
/// The direction vector.
- public Ray2(Point2 position, Vector2 direction)
+ public Ray2(Vector2 position, Vector2 direction)
{
Position = position;
Direction = direction;
@@ -196,4 +196,4 @@ namespace MonoGame.Extended
internal string DebugDisplayString => ToString();
}
-}
\ No newline at end of file
+}
diff --git a/source/MonoGame.Extended/Math/RectangleF.cs b/source/MonoGame.Extended/Math/RectangleF.cs
index df420afb..91fad0a6 100644
--- a/source/MonoGame.Extended/Math/RectangleF.cs
+++ b/source/MonoGame.Extended/Math/RectangleF.cs
@@ -85,11 +85,11 @@ namespace MonoGame.Extended
public bool IsEmpty => Width.Equals(0) && Height.Equals(0) && X.Equals(0) && Y.Equals(0);
///
- /// Gets the representing the the top-left of this .
+ /// Gets the representing the the top-left of this .
///
- public Point2 Position
+ public Vector2 Position
{
- get { return new Point2(X, Y); }
+ get { return new Vector2(X, Y); }
set
{
X = value.X;
@@ -113,29 +113,29 @@ namespace MonoGame.Extended
}
///
- /// Gets the representing the center of this .
+ /// Gets the representing the center of this .
///
- public Point2 Center => new Point2(X + Width * 0.5f, Y + Height * 0.5f);
+ public Vector2 Center => new Vector2(X + Width * 0.5f, Y + Height * 0.5f);
///
- /// Gets the representing the top-left of this .
+ /// Gets the representing the top-left of this .
///
- public Point2 TopLeft => new Point2(X, Y);
+ public Vector2 TopLeft => new Vector2(X, Y);
///
- /// Gets the representing the top-right of this .
+ /// Gets the representing the top-right of this .
///
- public Point2 TopRight => new Point2(X + Width, Y);
+ public Vector2 TopRight => new Vector2(X + Width, Y);
///
- /// Gets the representing the bottom-left of this .
+ /// Gets the representing the bottom-left of this .
///
- public Point2 BottomLeft => new Point2(X, Y + Height);
+ public Vector2 BottomLeft => new Vector2(X, Y + Height);
///
- /// Gets the representing the bottom-right of this .
+ /// Gets the representing the bottom-right of this .
///
- public Point2 BottomRight => new Point2(X + Width, Y + Height);
+ public Vector2 BottomRight => new Vector2(X + Width, Y + Height);
///
/// Initializes a new instance of the structure from the specified top-left xy-coordinate
@@ -155,11 +155,11 @@ namespace MonoGame.Extended
///
/// Initializes a new instance of the structure from the specified top-left
- /// and the extents .
+ /// and the extents .
///
/// The top-left point.
/// The extents.
- public RectangleF(Point2 position, SizeF size)
+ public RectangleF(Vector2 position, SizeF size)
{
X = position.X;
Y = position.Y;
@@ -168,13 +168,13 @@ namespace MonoGame.Extended
}
///
- /// Computes the from a minimum and maximum
- /// .
+ /// Computes the from a minimum and maximum
+ /// .
///
/// The minimum point.
/// The maximum point.
/// The resulting rectangle.
- public static void CreateFrom(Point2 minimum, Point2 maximum, out RectangleF result)
+ public static void CreateFrom(Vector2 minimum, Vector2 maximum, out RectangleF result)
{
result.X = minimum.X;
result.Y = minimum.Y;
@@ -183,13 +183,13 @@ namespace MonoGame.Extended
}
///
- /// Computes the from a minimum and maximum
- /// .
+ /// Computes the from a minimum and maximum
+ /// .
///
/// The minimum point.
/// The maximum point.
/// The resulting .
- public static RectangleF CreateFrom(Point2 minimum, Point2 maximum)
+ public static RectangleF CreateFrom(Vector2 minimum, Vector2 maximum)
{
RectangleF result;
CreateFrom(minimum, maximum, out result);
@@ -197,24 +197,24 @@ namespace MonoGame.Extended
}
///
- /// Computes the from a list of structures.
+ /// Computes the from a list of structures.
///
/// The points.
/// The resulting rectangle.
- public static void CreateFrom(IReadOnlyList points, out RectangleF result)
+ public static void CreateFrom(IReadOnlyList points, out RectangleF result)
{
- Point2 minimum;
- Point2 maximum;
+ Vector2 minimum;
+ Vector2 maximum;
PrimitivesHelper.CreateRectangleFromPoints(points, out minimum, out maximum);
CreateFrom(minimum, maximum, out result);
}
///
- /// Computes the from a list of structures.
+ /// Computes the from a list of structures.
///
/// The points.
/// The resulting .
- public static RectangleF CreateFrom(IReadOnlyList points)
+ public static RectangleF CreateFrom(IReadOnlyList points)
{
RectangleF result;
CreateFrom(points, out result);
@@ -342,8 +342,8 @@ namespace MonoGame.Extended
var secondMinimum = second.TopLeft;
var secondMaximum = second.BottomRight;
- var minimum = Point2.Maximum(firstMinimum, secondMinimum);
- var maximum = Point2.Minimum(firstMaximum, secondMaximum);
+ var minimum = MathExtended.CalculateMaximumVector2(firstMinimum, secondMinimum);
+ var maximum = MathExtended.CalculateMinimumVector2(firstMaximum, secondMaximum);
if ((maximum.X < minimum.X) || (maximum.Y < minimum.Y))
result = new RectangleF();
@@ -443,7 +443,7 @@ namespace MonoGame.Extended
///
/// Determines whether the specified contains the specified
- /// .
+ /// .
///
/// The rectangle.
/// The point.
@@ -451,14 +451,14 @@ namespace MonoGame.Extended
/// true if the contains the ; otherwise,
/// false.
///
- public static bool Contains(ref RectangleF rectangle, ref Point2 point)
+ public static bool Contains(ref RectangleF rectangle, ref Vector2 point)
{
return rectangle.X <= point.X && point.X < rectangle.X + rectangle.Width && rectangle.Y <= point.Y && point.Y < rectangle.Y + rectangle.Height;
}
///
/// Determines whether the specified contains the specified
- /// .
+ /// .
///
/// The rectangle.
/// The point.
@@ -466,30 +466,30 @@ namespace MonoGame.Extended
/// true if the contains the ; otherwise,
/// false.
///
- public static bool Contains(RectangleF rectangle, Point2 point)
+ public static bool Contains(RectangleF rectangle, Vector2 point)
{
return Contains(ref rectangle, ref point);
}
///
/// Determines whether this contains the specified
- /// .
+ /// .
///
/// The point.
///
/// true if the this contains the ; otherwise,
/// false.
///
- public bool Contains(Point2 point)
+ public bool Contains(Vector2 point)
{
return Contains(ref this, ref point);
}
///
- /// Updates this from a list of structures.
+ /// Updates this from a list of structures.
///
/// The points.
- public void UpdateFromPoints(IReadOnlyList points)
+ public void UpdateFromPoints(IReadOnlyList points)
{
var rectangle = CreateFrom(points);
X = rectangle.X;
@@ -499,34 +499,34 @@ namespace MonoGame.Extended
}
///
- /// Computes the squared distance from this to a .
+ /// Computes the squared distance from this to a .
///
/// The point.
/// The squared distance from this to the .
- public float SquaredDistanceTo(Point2 point)
+ public float SquaredDistanceTo(Vector2 point)
{
return PrimitivesHelper.SquaredDistanceToPointFromRectangle(TopLeft, BottomRight, point);
}
///
- /// Computes the distance from this to a .
+ /// Computes the distance from this to a .
///
/// The point.
/// The distance from this to the .
- public float DistanceTo(Point2 point)
+ public float DistanceTo(Vector2 point)
{
return (float)Math.Sqrt(SquaredDistanceTo(point));
}
///
- /// Computes the closest on this to a specified
- /// .
+ /// Computes the closest on this to a specified
+ /// .
///
/// The point.
- /// The closest on this to the .
- public Point2 ClosestPointTo(Point2 point)
+ /// The closest on this to the .
+ public Vector2 ClosestPointTo(Vector2 point)
{
- Point2 result;
+ Vector2 result;
PrimitivesHelper.ClosestPointToPointFromRectangle(TopLeft, BottomRight, point, out result);
return result;
}
diff --git a/source/MonoGame.Extended/Math/Segment2.cs b/source/MonoGame.Extended/Math/Segment2.cs
index d8452ae7..0095ab17 100644
--- a/source/MonoGame.Extended/Math/Segment2.cs
+++ b/source/MonoGame.Extended/Math/Segment2.cs
@@ -1,10 +1,11 @@
using System;
+using Microsoft.Xna.Framework;
namespace MonoGame.Extended
{
- // Real-Time Collision Detection, Christer Ericson, 2005. Chapter 3.5; A Math and Geometry Primer - Lines, Rays, and Segments. pg 53-54
+ // Real-Time Collision Detection, Christer Ericson, 2005. Chapter 3.5; A Math and Geometry Primer - Lines, Rays, and Segments. pg 53-54
///
- /// A two dimensional line segment defined by two structures, a starting point and an ending
+ /// A two dimensional line segment defined by two structures, a starting point and an ending
/// point.
///
///
@@ -12,22 +13,22 @@ namespace MonoGame.Extended
public struct Segment2 : IEquatable, IEquatableByRef
{
///
- /// The starting of this .
+ /// The starting of this .
///
- public Point2 Start;
+ public Vector2 Start;
///
- /// The ending of this .
+ /// The ending of this .
///
- public Point2 End;
+ public Vector2 End;
///
/// Initializes a new instance of the structure from the specified starting and ending
- /// structures.
+ /// structures.
///
/// The starting point.
/// The ending point.
- public Segment2(Point2 start, Point2 end)
+ public Segment2(Vector2 start, Vector2 end)
{
Start = start;
End = end;
@@ -41,17 +42,17 @@ namespace MonoGame.Extended
/// The ending x-coordinate.
/// The ending y-coordinate.
public Segment2(float x1, float y1, float x2, float y2)
- : this(new Point2(x1, y1), new Point2(x2, y2))
+ : this(new Vector2(x1, y1), new Vector2(x2, y2))
{
}
// Real-Time Collision Detection, Christer Ericson, 2005. Chapter 5.1.2; Basic Primitive Tests - Closest Point on Line Segment to Point. pg 127-130
///
- /// Computes the closest on this to a specified .
+ /// Computes the closest on this to a specified .
///
/// The point.
- /// The closest on this to the .
- public Point2 ClosestPointTo(Point2 point)
+ /// The closest on this to the .
+ public Vector2 ClosestPointTo(Vector2 point)
{
// Computes the parameterized position: d(t) = Start + t * (End – Start)
@@ -71,16 +72,16 @@ namespace MonoGame.Extended
// The point projects inside the [Start, End] interval, must do deferred division now
t /= denominator;
startToEnd *= t;
- return new Point2(Start.X + startToEnd.X, Start.Y + startToEnd.Y);
+ return new Vector2(Start.X + startToEnd.X, Start.Y + startToEnd.Y);
}
- // Real-Time Collision Detection, Christer Ericson, 2005. Chapter 5.1.2.1; Basic Primitive Tests - Distance of Point to Segment. pg 127-130
+ // Real-Time Collision Detection, Christer Ericson, 2005. Chapter 5.1.2.1; Basic Primitive Tests - Distance of Point to Segment. pg 127-130
///
- /// Computes the squared distance from this to a specified .
+ /// Computes the squared distance from this to a specified .
///
/// The point.
- /// The squared distance from this to a specified .
- public float SquaredDistanceTo(Point2 point)
+ /// The squared distance from this to a specified .
+ public float SquaredDistanceTo(Vector2 point)
{
var startToEnd = End - Start;
var startToPoint = point - Start;
@@ -98,11 +99,11 @@ namespace MonoGame.Extended
}
///
- /// Computes the distance from this to a specified .
+ /// Computes the distance from this to a specified .
///
/// The point.
- /// The distance from this to a specified .
- public float DistanceTo(Point2 point)
+ /// The distance from this to a specified .
+ public float DistanceTo(Vector2 point)
{
return (float) Math.Sqrt(SquaredDistanceTo(point));
}
@@ -112,14 +113,14 @@ namespace MonoGame.Extended
///
/// The bounding box.
///
- /// When this method returns, contains the of intersection, if an
- /// intersection was found; otherwise, the . This parameter is passed uninitialized.
+ /// When this method returns, contains the of intersection, if an
+ /// intersection was found; otherwise, the . This parameter is passed uninitialized.
///
///
/// true if this intersects with ; otherwise,
/// false.
///
- public bool Intersects(RectangleF rectangle, out Point2 intersectionPoint)
+ public bool Intersects(RectangleF rectangle, out Vector2 intersectionPoint)
{
// Real-Time Collision Detection, Christer Ericson, 2005. Chapter 5.3; Basic Primitive Tests - Intersecting Lines, Rays, and (Directed Segments). pg 179-181
@@ -133,7 +134,7 @@ namespace MonoGame.Extended
!PrimitivesHelper.IntersectsSlab(Start.X, direction.X, minimumPoint.X, maximumPoint.X, ref minimumDistance,
ref maximumDistance))
{
- intersectionPoint = Point2.NaN;
+ intersectionPoint = new Vector2(float.NaN);
return false;
}
@@ -141,7 +142,7 @@ namespace MonoGame.Extended
!PrimitivesHelper.IntersectsSlab(Start.Y, direction.Y, minimumPoint.Y, maximumPoint.Y, ref minimumDistance,
ref maximumDistance))
{
- intersectionPoint = Point2.NaN;
+ intersectionPoint = new Vector2(float.NaN);
return false;
}
@@ -164,14 +165,14 @@ namespace MonoGame.Extended
///
/// The bounding box.
///
- /// When this method returns, contains the of intersection, if an
- /// intersection was found; otherwise, the . This parameter is passed uninitialized.
+ /// When this method returns, contains the of intersection, if an
+ /// intersection was found; otherwise, the . This parameter is passed uninitialized.
///
///
/// true if this intersects with ; otherwise,
/// false.
///
- public bool Intersects(BoundingRectangle boundingRectangle, out Point2 intersectionPoint)
+ public bool Intersects(BoundingRectangle boundingRectangle, out Vector2 intersectionPoint)
{
// Real-Time Collision Detection, Christer Ericson, 2005. Chapter 5.3; Basic Primitive Tests - Intersecting Lines, Rays, and (Directed Segments). pg 179-181
@@ -185,7 +186,7 @@ namespace MonoGame.Extended
!PrimitivesHelper.IntersectsSlab(Start.X, direction.X, minimumPoint.X, maximumPoint.X, ref minimumDistance,
ref maximumDistance))
{
- intersectionPoint = Point2.NaN;
+ intersectionPoint = new Vector2(float.NaN);
return false;
}
@@ -193,7 +194,7 @@ namespace MonoGame.Extended
!PrimitivesHelper.IntersectsSlab(Start.Y, direction.Y, minimumPoint.Y, maximumPoint.Y, ref minimumDistance,
ref maximumDistance))
{
- intersectionPoint = Point2.NaN;
+ intersectionPoint = new Vector2(float.NaN);
return false;
}
@@ -314,4 +315,4 @@ namespace MonoGame.Extended
internal string DebugDisplayString => ToString();
}
-}
\ No newline at end of file
+}
diff --git a/source/MonoGame.Extended/Math/ShapeF.cs b/source/MonoGame.Extended/Math/ShapeF.cs
index 66293038..6d2262a2 100644
--- a/source/MonoGame.Extended/Math/ShapeF.cs
+++ b/source/MonoGame.Extended/Math/ShapeF.cs
@@ -14,7 +14,7 @@ namespace MonoGame.Extended
///
/// Gets or sets the position of the shape.
///
- Point2 Position { get; set; }
+ Vector2 Position { get; set; }
///
/// Gets escribed rectangle, which lying outside the shape
@@ -77,7 +77,7 @@ namespace MonoGame.Extended
var rotation = Matrix3x2.CreateRotationZ(orientedRectangle.Orientation.Rotation);
var circleCenterInRectangleSpace = rotation.Transform(circle.Center - orientedRectangle.Center);
var circleInRectangleSpace = new CircleF(circleCenterInRectangleSpace, circle.Radius);
- var boundingRectangle = new BoundingRectangle(new Point2(), orientedRectangle.Radii);
+ var boundingRectangle = new BoundingRectangle(new Vector2(), orientedRectangle.Radii);
return circleInRectangleSpace.Intersects(boundingRectangle);
}
diff --git a/source/MonoGame.Extended/Math/SizeF.cs b/source/MonoGame.Extended/Math/SizeF.cs
index 7612faf9..b4e89053 100644
--- a/source/MonoGame.Extended/Math/SizeF.cs
+++ b/source/MonoGame.Extended/Math/SizeF.cs
@@ -53,13 +53,13 @@ namespace MonoGame.Extended
///
/// Compares two structures. The result specifies
/// whether the values of the and
- /// fields of the two structures are equal.
+ /// fields of the two structures are equal.
///
/// The first size.
/// The second size.
///
/// true if the and
- /// fields of the two structures are equal; otherwise, false.
+ /// fields of the two structures are equal; otherwise, false.
///
public static bool operator ==(SizeF first, SizeF second)
{
@@ -71,7 +71,7 @@ namespace MonoGame.Extended
///
/// The size.
///
- /// true if this is equal to the parameter; otherwise,
+ /// true if this is equal to the parameter; otherwise,
/// false.
///
public bool Equals(SizeF size)
@@ -84,7 +84,7 @@ namespace MonoGame.Extended
///
/// The size.
///
- /// true if this is equal to the ; otherwise,
+ /// true if this is equal to the ; otherwise,
/// false.
///
public bool Equals(ref SizeF size)
@@ -200,7 +200,7 @@ namespace MonoGame.Extended
/// structures like a hash table.
///
///
- /// A hash code of this .
+ /// A hash code of this .
///
public override int GetHashCode()
{
@@ -211,13 +211,13 @@ namespace MonoGame.Extended
}
///
- /// Performs an implicit conversion from a to a .
+ /// Performs an implicit conversion from a to a .
///
/// The point.
///
/// The resulting .
///
- public static implicit operator SizeF(Point2 point)
+ public static implicit operator SizeF(Vector2 point)
{
return new SizeF(point.X, point.Y);
}
@@ -236,19 +236,7 @@ namespace MonoGame.Extended
}
///
- /// Performs an implicit conversion from a to a .
- ///
- /// The size.
- ///
- /// The resulting .
- ///
- public static implicit operator Point2(SizeF size)
- {
- return new Point2(size.Width, size.Height);
- }
-
- ///
- /// Performs an implicit conversion from a to a .
+ /// Performs an implicit conversion from a to a .
///
/// The size.
///
@@ -259,18 +247,6 @@ namespace MonoGame.Extended
return new Vector2(size.Width, size.Height);
}
- ///
- /// Performs an implicit conversion from a to a .
- ///
- /// The vector.
- ///
- /// The resulting .
- ///
- public static implicit operator SizeF(Vector2 vector)
- {
- return new SizeF(vector.X, vector.Y);
- }
-
/////
///// Performs an implicit conversion from a to a .
/////
diff --git a/source/MonoGame.Extended/MathExtended.cs b/source/MonoGame.Extended/MathExtended.cs
new file mode 100644
index 00000000..26f3d08b
--- /dev/null
+++ b/source/MonoGame.Extended/MathExtended.cs
@@ -0,0 +1,71 @@
+using Microsoft.Xna.Framework;
+
+namespace MonoGame.Extended;
+
+public static class MathExtended
+{
+ ///
+ /// Calculates a new with the component-wise minimum values from two given
+ /// values.
+ ///
+ /// The first Vector2 value.
+ /// The second Vector2 value.
+ ///
+ /// The calculated value with the component-wise minimum values.
+ public static Vector2 CalculateMinimumVector2(Vector2 first, Vector2 second)
+ {
+ return new Vector2
+ {
+ X = first.X < second.X ? first.X : second.X,
+ Y = first.Y < second.Y ? first.Y : second.Y
+ };
+ }
+
+ ///
+ /// Calculates a new with the component-wise minimum values from two given
+ /// values.
+ ///
+ /// The first Vector2 value.
+ /// The second Vector2 value.
+ ///
+ /// When this method returns, contains the calculated value with the component-wise minimum
+ /// values. This parameter is passed uninitialized.
+ ///
+ public static void CalculateMinimumVector2(Vector2 first, Vector2 second, out Vector2 result)
+ {
+ result.X = first.X < second.X ? first.X : second.X;
+ result.Y = first.Y < second.Y ? first.Y : second.Y;
+ }
+
+ ///
+ /// Calculates a new with the component-wise minimum values from two given
+ /// values.
+ ///
+ /// The first Vector2 value.
+ /// The second Vector2 value.
+ /// The calculated value with the component-wise maximum values.
+ public static Vector2 CalculateMaximumVector2(Vector2 first, Vector2 second)
+ {
+ return new Vector2
+ {
+ X = first.X > second.X ? first.X : second.X,
+ Y = first.Y > second.Y ? first.Y : second.Y
+ };
+ }
+
+ ///
+ /// Calculates a new with the component-wise values from two given
+ /// values.
+ ///
+ /// The first Vector2 value.
+ /// The second Vector2 value.
+ ///
+ /// When this method returns, contains the calculated value with the component-wise maximum
+ /// values. This parameter is passed uninitialized.
+ ///
+ public static void CalculateMaximumVector2(Vector2 first, Vector2 second, out Vector2 result)
+ {
+ result.X = first.X > second.X ? first.X : second.X;
+ result.Y = first.Y > second.Y ? first.Y : second.Y;
+ }
+}
diff --git a/tests/MonoGame.Extended.Collisions.Tests/CollisionComponentTests.cs b/tests/MonoGame.Extended.Collisions.Tests/CollisionComponentTests.cs
index b44c1bf7..7e19a261 100644
--- a/tests/MonoGame.Extended.Collisions.Tests/CollisionComponentTests.cs
+++ b/tests/MonoGame.Extended.Collisions.Tests/CollisionComponentTests.cs
@@ -20,7 +20,7 @@ namespace MonoGame.Extended.Collisions.Tests
public CollisionComponentTests()
{
- _collisionComponent = new CollisionComponent(new RectangleF(Point2.Zero, new Point2(10, 10)));
+ _collisionComponent = new CollisionComponent(new RectangleF(Vector2.Zero, new Vector2(10, 10)));
}
#region Circle Circle
@@ -28,8 +28,8 @@ namespace MonoGame.Extended.Collisions.Tests
[Fact]
public void PenetrationVectorSameCircleTest()
{
- Point2 pos1 = Point2.Zero;
- Point2 pos2 = Point2.Zero;
+ Vector2 pos1 = Vector2.Zero;
+ Vector2 pos2 = Vector2.Zero;
IShapeF shape1 = new CircleF(pos1, 2.0f);
IShapeF shape2 = new CircleF(pos2, 2.0f);
@@ -55,8 +55,8 @@ namespace MonoGame.Extended.Collisions.Tests
[Fact]
public void PenetrationVectorSlightlyOverlappingCircleTest()
{
- Point2 pos1 = new Point2(0, 1.5f);
- Point2 pos2 = Point2.Zero;
+ Vector2 pos1 = new Vector2(0, 1.5f);
+ Vector2 pos2 = Vector2.Zero;
IShapeF shape1 = new CircleF(pos1, 2.0f);
IShapeF shape2 = new CircleF(pos2, 2.0f);
@@ -85,8 +85,8 @@ namespace MonoGame.Extended.Collisions.Tests
[Fact]
public void PenetrationVectorSlightlyOverlappingOffAxisTest()
{
- Point2 pos1 = new Point2(2, 2.5f);
- Point2 pos2 = new Point2(2, 1);
+ Vector2 pos1 = new Vector2(2, 2.5f);
+ Vector2 pos2 = new Vector2(2, 1);
IShapeF shape1 = new CircleF(pos1, 2.0f);
IShapeF shape2 = new CircleF(pos2, 2.0f);
@@ -116,8 +116,8 @@ namespace MonoGame.Extended.Collisions.Tests
[Fact]
public void PenetrationZeroRadiusCircleCircleTest()
{
- Point2 pos1 = new Point2(0, 1.5f);
- Point2 pos2 = Point2.Zero;
+ Vector2 pos1 = new Vector2(0, 1.5f);
+ Vector2 pos2 = Vector2.Zero;
IShapeF shape1 = new CircleF(pos1, 0);
IShapeF shape2 = new CircleF(pos2, 2.0f);
@@ -150,8 +150,8 @@ namespace MonoGame.Extended.Collisions.Tests
[Fact]
public void PenetrationVectorCircleRectangleTest()
{
- Point2 pos1 = new Point2(0, 1);
- Point2 pos2 = new Point2(-2, -1);
+ Vector2 pos1 = new Vector2(0, 1);
+ Vector2 pos2 = new Vector2(-2, -1);
IShapeF shape1 = new CircleF(pos1, 2.0f);
IShapeF shape2 = new RectangleF(pos2, new SizeF(4, 2));
@@ -179,8 +179,8 @@ namespace MonoGame.Extended.Collisions.Tests
[Fact]
public void PenetrationVectorCircleContainedInRectangleTest()
{
- Point2 pos1 = new Point2(0, 0);
- Point2 pos2 = new Point2(-2, -1);
+ Vector2 pos1 = new Vector2(0, 0);
+ Vector2 pos2 = new Vector2(-2, -1);
IShapeF shape1 = new CircleF(pos1, 1.0f);
IShapeF shape2 = new RectangleF(pos2, new SizeF(4, 2));
@@ -208,8 +208,8 @@ namespace MonoGame.Extended.Collisions.Tests
[Fact]
public void PenetrationVectorCircleOffAxisRectangleTest()
{
- Point2 pos1 = new Point2(2, 1);
- Point2 pos2 = new Point2(-2, -1);
+ Vector2 pos1 = new Vector2(2, 1);
+ Vector2 pos2 = new Vector2(-2, -1);
IShapeF shape1 = new CircleF(pos1, 2.0f);
IShapeF shape2 = new RectangleF(pos2, new SizeF(4, 2));
@@ -241,8 +241,8 @@ namespace MonoGame.Extended.Collisions.Tests
[Fact]
public void PenetrationVectorRectangleRectangleTest()
{
- Point2 pos1 = new Point2(0, 0);
- Point2 pos2 = new Point2(-2, -1);
+ Vector2 pos1 = new Vector2(0, 0);
+ Vector2 pos2 = new Vector2(-2, -1);
IShapeF shape1 = new RectangleF(pos1, new SizeF(4, 2));
IShapeF shape2 = new RectangleF(pos2, new SizeF(4, 2));
@@ -270,8 +270,8 @@ namespace MonoGame.Extended.Collisions.Tests
[Fact]
public void PenetrationVectorRectangleRectangleOffAxisTest()
{
- Point2 pos1 = new Point2(4, 2);
- Point2 pos2 = new Point2(3, 1);
+ Vector2 pos1 = new Vector2(4, 2);
+ Vector2 pos2 = new Vector2(3, 1);
IShapeF shape1 = new RectangleF(pos1, new SizeF(4, 2));
IShapeF shape2 = new RectangleF(pos2, new SizeF(4, 2));
@@ -303,8 +303,8 @@ namespace MonoGame.Extended.Collisions.Tests
[Fact]
public void Actors_is_colliding()
{
- var staticBounds = new RectangleF(new Point2(0, 0), new SizeF(1, 1));
- var anotherStaticBounds = new RectangleF(new Point2(0, 0), new SizeF(1, 1));
+ var staticBounds = new RectangleF(new Vector2(0, 0), new SizeF(1, 1));
+ var anotherStaticBounds = new RectangleF(new Vector2(0, 0), new SizeF(1, 1));
var staticActor = new CollisionIndicatingActor(staticBounds);
var anotherStaticActor = new CollisionIndicatingActor(anotherStaticBounds);
_collisionComponent.Insert(staticActor);
@@ -319,13 +319,13 @@ namespace MonoGame.Extended.Collisions.Tests
[Fact]
public void Actors_is_not_colliding_when_dynamic_actor_is_moved_out_of_collision_bounds()
{
- var staticBounds = new RectangleF(new Point2(0, 0), new SizeF(1, 1));
- var dynamicBounds = new RectangleF(new Point2(0, 0), new SizeF(1, 1));
+ var staticBounds = new RectangleF(new Vector2(0, 0), new SizeF(1, 1));
+ var dynamicBounds = new RectangleF(new Vector2(0, 0), new SizeF(1, 1));
var staticActor = new CollisionIndicatingActor(staticBounds);
var dynamicActor = new CollisionIndicatingActor(dynamicBounds);
_collisionComponent.Insert(staticActor);
_collisionComponent.Insert(dynamicActor);
- dynamicActor.MoveTo(new Point2(2, 2));
+ dynamicActor.MoveTo(new Vector2(2, 2));
_collisionComponent.Update(_gameTime);
@@ -336,17 +336,17 @@ namespace MonoGame.Extended.Collisions.Tests
[Fact]
public void Actors_is_colliding_when_dynamic_actor_is_moved_after_update()
{
- var staticBounds = new RectangleF(new Point2(0, 0), new SizeF(1, 1));
+ var staticBounds = new RectangleF(new Vector2(0, 0), new SizeF(1, 1));
var staticActor = new CollisionIndicatingActor(staticBounds);
_collisionComponent.Insert(staticActor);
for (int i = 0; i < QuadTree.QuadTree.DefaultMaxObjectsPerNode; i++)
{
- var fillerBounds = new RectangleF(new Point2(0, 2), new SizeF(.1f, .1f));
+ var fillerBounds = new RectangleF(new Vector2(0, 2), new SizeF(.1f, .1f));
var fillerActor = new CollisionIndicatingActor(fillerBounds);
_collisionComponent.Insert(fillerActor);
}
- var dynamicBounds = new RectangleF(new Point2(2, 2), new SizeF(1, 1));
+ var dynamicBounds = new RectangleF(new Vector2(2, 2), new SizeF(1, 1));
var dynamicActor = new CollisionIndicatingActor(dynamicBounds);
_collisionComponent.Insert(dynamicActor);
@@ -354,7 +354,7 @@ namespace MonoGame.Extended.Collisions.Tests
Assert.False(staticActor.IsColliding);
Assert.False(dynamicActor.IsColliding);
- dynamicActor.MoveTo(new Point2(0, 0));
+ dynamicActor.MoveTo(new Vector2(0, 0));
_collisionComponent.Update(_gameTime);
Assert.True(dynamicActor.IsColliding);
@@ -364,13 +364,13 @@ namespace MonoGame.Extended.Collisions.Tests
[Fact]
public void Actors_is_colliding_when_dynamic_actor_is_moved_into_collision_bounds()
{
- var staticBounds = new RectangleF(new Point2(0, 0), new SizeF(1, 1));
- var dynamicBounds = new RectangleF(new Point2(2, 2), new SizeF(1, 1));
+ var staticBounds = new RectangleF(new Vector2(0, 0), new SizeF(1, 1));
+ var dynamicBounds = new RectangleF(new Vector2(2, 2), new SizeF(1, 1));
var staticActor = new CollisionIndicatingActor(staticBounds);
var dynamicActor = new CollisionIndicatingActor(dynamicBounds);
_collisionComponent.Insert(staticActor);
_collisionComponent.Insert(dynamicActor);
- dynamicActor.MoveTo(new Point2(0, 0));
+ dynamicActor.MoveTo(new Vector2(0, 0));
_collisionComponent.Update(_gameTime);
@@ -406,7 +406,7 @@ namespace MonoGame.Extended.Collisions.Tests
public bool IsColliding { get; private set; }
- public void MoveTo(Point2 position)
+ public void MoveTo(Vector2 position)
{
_bounds = new RectangleF(position, _bounds.Size);
}
diff --git a/tests/MonoGame.Extended.Tests/AssertExtensions.cs b/tests/MonoGame.Extended.Tests/AssertExtensions.cs
index 72347ca0..9db36f15 100644
--- a/tests/MonoGame.Extended.Tests/AssertExtensions.cs
+++ b/tests/MonoGame.Extended.Tests/AssertExtensions.cs
@@ -1,10 +1,11 @@
using System;
+using Microsoft.Xna.Framework;
namespace MonoGame.Extended.Tests
{
public static class AssertExtensions
{
- public static bool AreApproximatelyEqual(Point2 firstPoint, Point2 secondPoint)
+ public static bool AreApproximatelyEqual(Vector2 firstPoint, Vector2 secondPoint)
{
return Math.Abs(firstPoint.X - secondPoint.X) < float.Epsilon &&
Math.Abs(firstPoint.Y - secondPoint.Y) < float.Epsilon;
@@ -18,4 +19,4 @@ namespace MonoGame.Extended.Tests
Math.Abs(firstRectangle.Height - secondRectangle.Height) < float.Epsilon;
}
}
-}
\ No newline at end of file
+}
diff --git a/tests/MonoGame.Extended.Tests/MathExtendedTests.cs b/tests/MonoGame.Extended.Tests/MathExtendedTests.cs
new file mode 100644
index 00000000..897c1d25
--- /dev/null
+++ b/tests/MonoGame.Extended.Tests/MathExtendedTests.cs
@@ -0,0 +1,55 @@
+using Microsoft.Xna.Framework;
+
+namespace MonoGame.Extended.Tests;
+
+public class MathExtendedTests
+{
+ [Fact]
+ public void CalculateMinimumVector2_Returns_Expected()
+ {
+ Vector2 a = new Vector2(1, 4);
+ Vector2 b = new Vector2(3, 2);
+
+ Vector2 expected = new Vector2(1, 2);
+ Vector2 actual = MathExtended.CalculateMinimumVector2(a, b);
+
+ Assert.Equal(expected, actual);
+ }
+
+ [Fact]
+ public void CalculateMinimumVector2_Out_Expected()
+ {
+ Vector2 a = new Vector2(1, 4);
+ Vector2 b = new Vector2(3, 2);
+
+ Vector2 expected = new Vector2(1, 2);
+ MathExtended.CalculateMinimumVector2(a, b, out Vector2 actual);
+
+ Assert.Equal(expected, actual);
+ }
+
+ [Fact]
+ public void CalculateMaximumVector2_Returns_Expected()
+ {
+ Vector2 a = new Vector2(1, 4);
+ Vector2 b = new Vector2(3, 2);
+
+ Vector2 expected = new Vector2(3, 4);
+ Vector2 actual = MathExtended.CalculateMaximumVector2(a, b);
+
+ Assert.Equal(expected, actual);
+ }
+
+ [Fact]
+ public void CalculateMaximumVector2_Out_Expected()
+ {
+ Vector2 a = new Vector2(1, 4);
+ Vector2 b = new Vector2(3, 2);
+
+ Vector2 expected = new Vector2(3, 4);
+ MathExtended.CalculateMaximumVector2(a, b, out Vector2 actual);
+
+ Assert.Equal(expected, actual);
+ }
+}
+
diff --git a/tests/MonoGame.Extended.Tests/Primitives/BoundingRectangleTests.cs b/tests/MonoGame.Extended.Tests/Primitives/BoundingRectangleTests.cs
index 2d6dc5b1..9e3cf15d 100644
--- a/tests/MonoGame.Extended.Tests/Primitives/BoundingRectangleTests.cs
+++ b/tests/MonoGame.Extended.Tests/Primitives/BoundingRectangleTests.cs
@@ -13,17 +13,17 @@
// get
// {
// yield return
-// new TestCaseData(new Point2(), new Vector2()).SetName(
+// new TestCaseData(new Vector2(), new Vector2()).SetName(
// "The empty bounding rectangle has the expected position and radii.");
// yield return
-// new TestCaseData(new Point2(5, 5), new Vector2(15, 15)).SetName(
+// new TestCaseData(new Vector2(5, 5), new Vector2(15, 15)).SetName(
// "A non-empty bounding rectangle has the expected position and radii.");
// }
// }
// [Fact]
// [TestCaseSource(nameof(ConstructorTestCases))]
-// public void Constructor(Point2 centre, Vector2 radii)
+// public void Constructor(Vector2 centre, Vector2 radii)
// {
// var boundingRectangle = new BoundingRectangle(centre, radii);
// Assert.Equal(centre, boundingRectangle.Center);
@@ -35,12 +35,12 @@
// get
// {
// yield return
-// new TestCaseData(new Point2(), new Point2(), new BoundingRectangle()).SetName(
+// new TestCaseData(new Vector2(), new Vector2(), new BoundingRectangle()).SetName(
// "The bounding rectangle created from the zero minimum point and zero maximum point is the empty bounding rectangle.")
// ;
// yield return
-// new TestCaseData(new Point2(5, 5), new Point2(15, 15),
-// new BoundingRectangle(new Point2(10, 10), new Size2(5, 5))).SetName(
+// new TestCaseData(new Vector2(5, 5), new Vector2(15, 15),
+// new BoundingRectangle(new Vector2(10, 10), new Size2(5, 5))).SetName(
// "The bounding rectangle created from the non-zero minimum point and the non-zero maximum point is the expected bounding rectangle.")
// ;
// }
@@ -48,7 +48,7 @@
// [Fact]
// [TestCaseSource(nameof(CreateFromMinimumMaximumTestCases))]
-// public void CreateFromMinimumMaximum(Point2 minimum, Point2 maximum, BoundingRectangle expectedBoundingRectangle)
+// public void CreateFromMinimumMaximum(Vector2 minimum, Vector2 maximum, BoundingRectangle expectedBoundingRectangle)
// {
// var actualBoundingRectangle = BoundingRectangle.CreateFrom(minimum, maximum);
// Assert.Equal(expectedBoundingRectangle, actualBoundingRectangle);
@@ -62,22 +62,22 @@
// new TestCaseData(null, new BoundingRectangle()).SetName(
// "The bounding rectangle created from null points is the empty bounding rectangle.");
// yield return
-// new TestCaseData(new Point2[0], new BoundingRectangle()).SetName(
+// new TestCaseData(new Vector2[0], new BoundingRectangle()).SetName(
// "The bounding rectangle created from the empty set of points is the empty bounding rectangle.");
// yield return
// new TestCaseData(
// new[]
// {
-// new Point2(5, 5), new Point2(10, 10), new Point2(15, 15), new Point2(-5, -5),
-// new Point2(-15, -15)
-// }, new BoundingRectangle(new Point2(0, 0), new Size2(15, 15))).SetName(
+// new Vector2(5, 5), new Vector2(10, 10), new Vector2(15, 15), new Vector2(-5, -5),
+// new Vector2(-15, -15)
+// }, new BoundingRectangle(new Vector2(0, 0), new Size2(15, 15))).SetName(
// "The bounding rectangle created from a non-empty set of points is the expected bounding rectangle.");
// }
// }
// [Fact]
// [TestCaseSource(nameof(CreateFromPointsTestCases))]
-// public void CreateFromPoints(Point2[] points, BoundingRectangle expectedBoundingRectangle)
+// public void CreateFromPoints(Vector2[] points, BoundingRectangle expectedBoundingRectangle)
// {
// var actualBoundingRectangle = BoundingRectangle.CreateFrom(points);
// Assert.Equal(expectedBoundingRectangle, actualBoundingRectangle);
@@ -92,7 +92,7 @@
// "The bounding rectangle created from the empty bounding rectangle transformed by the identity matrix is the empty bounding rectangle.")
// ;
// yield return
-// new TestCaseData(new BoundingRectangle(new Point2(0, 0), new Size2(20, 20)), Matrix3x2.CreateScale(2), new BoundingRectangle(new Point2(0, 0), new Size2(40, 40))).SetName(
+// new TestCaseData(new BoundingRectangle(new Vector2(0, 0), new Size2(20, 20)), Matrix3x2.CreateScale(2), new BoundingRectangle(new Vector2(0, 0), new Size2(40, 40))).SetName(
// "The bounding rectangle created from a non-empty bounding rectangle transformed by a non-identity matrix is the expected bounding rectangle.")
// ;
// }
@@ -115,8 +115,8 @@
// new TestCaseData(new BoundingRectangle(), new BoundingRectangle(), new BoundingRectangle()).SetName(
// "The union of two empty bounding rectangles is the empty bounding rectangle.");
// yield return
-// new TestCaseData(new BoundingRectangle(new Point2(0, 0), new Size2(15, 15)),
-// new BoundingRectangle(new Point2(20, 20), new Size2(40, 40)), new BoundingRectangle(new Point2(20, 20), new Size2(40, 40)))
+// new TestCaseData(new BoundingRectangle(new Vector2(0, 0), new Size2(15, 15)),
+// new BoundingRectangle(new Vector2(20, 20), new Size2(40, 40)), new BoundingRectangle(new Vector2(20, 20), new Size2(40, 40)))
// .SetName(
// "The union of two non-empty bounding rectangles is the expected bounding rectangle.");
// }
@@ -138,13 +138,13 @@
// new TestCaseData(new BoundingRectangle(), new BoundingRectangle(), new BoundingRectangle()).SetName(
// "The intersection of two empty bounding rectangles is the empty bounding box.");
// yield return
-// new TestCaseData(new BoundingRectangle(new Point2(-10, -10), new Size2(15, 15)),
-// new BoundingRectangle(new Point2(20, 20), new Size2(40, 40)),
-// new BoundingRectangle(new Point2(-7.5f, -7.5f), new Size2(12.5f, 12.5f))).SetName(
+// new TestCaseData(new BoundingRectangle(new Vector2(-10, -10), new Size2(15, 15)),
+// new BoundingRectangle(new Vector2(20, 20), new Size2(40, 40)),
+// new BoundingRectangle(new Vector2(-7.5f, -7.5f), new Size2(12.5f, 12.5f))).SetName(
// "The intersection of two overlapping non-empty bounding rectangles is the expected bounding rectangle.");
// yield return
-// new TestCaseData(new BoundingRectangle(new Point2(-30, -30), new Size2(15, 15)),
-// new BoundingRectangle(new Point2(20, 20), new Size2(10, 10)),
+// new TestCaseData(new BoundingRectangle(new Vector2(-30, -30), new Size2(15, 15)),
+// new BoundingRectangle(new Vector2(20, 20), new Size2(10, 10)),
// BoundingRectangle.Empty).SetName(
// "The intersection of two non-overlapping non-empty bounding rectangles is the empty bounding rectangle.");
// }
@@ -167,12 +167,12 @@
// new TestCaseData(new BoundingRectangle(), new BoundingRectangle(), true).SetName(
// "Two empty bounding rectangles intersect.");
// yield return
-// new TestCaseData(new BoundingRectangle(new Point2(-10, -10), new Size2(15, 15)),
-// new BoundingRectangle(new Point2(20, 20), new Size2(40, 40)), true).SetName(
+// new TestCaseData(new BoundingRectangle(new Vector2(-10, -10), new Size2(15, 15)),
+// new BoundingRectangle(new Vector2(20, 20), new Size2(40, 40)), true).SetName(
// "Two overlapping non-empty bounding rectangles intersect.");
// yield return
-// new TestCaseData(new BoundingRectangle(new Point2(-40, -50), new Size2(15, 15)),
-// new BoundingRectangle(new Point2(20, 20), new Size2(15, 15)), false).SetName(
+// new TestCaseData(new BoundingRectangle(new Vector2(-40, -50), new Size2(15, 15)),
+// new BoundingRectangle(new Vector2(20, 20), new Size2(15, 15)), false).SetName(
// "Two non-overlapping non-empty bounding rectangles do not intersect.");
// }
// }
@@ -190,14 +190,14 @@
// get
// {
// yield return
-// new TestCaseData(new BoundingRectangle(), new Point2(), true).SetName(
+// new TestCaseData(new BoundingRectangle(), new Vector2(), true).SetName(
// "The empty bounding rectangle contains the zero point.");
// yield return
-// new TestCaseData(new BoundingRectangle(new Point2(0, 0), new Size2(15, 15)), new Point2(-15, -15), true)
+// new TestCaseData(new BoundingRectangle(new Vector2(0, 0), new Size2(15, 15)), new Vector2(-15, -15), true)
// .SetName(
// "A non-empty bounding rectangle contains a point inside it.");
// yield return
-// new TestCaseData(new BoundingRectangle(new Point2(0, 0), new Size2(15, 15)), new Point2(-16, 15), false)
+// new TestCaseData(new BoundingRectangle(new Vector2(0, 0), new Size2(15, 15)), new Vector2(-16, 15), false)
// .SetName(
// "A non-empty bounding rectangle does not contain a point outside it.");
// }
@@ -205,7 +205,7 @@
// [Fact]
// [TestCaseSource(nameof(ContainsPointTestCases))]
-// public void ContainsPoint(BoundingRectangle boundingRectangle, Point2 point, bool expectedToContainPoint)
+// public void ContainsPoint(BoundingRectangle boundingRectangle, Vector2 point, bool expectedToContainPoint)
// {
// Assert.Equal(expectedToContainPoint, boundingRectangle.Contains(point));
// Assert.Equal(expectedToContainPoint, BoundingRectangle.Contains(boundingRectangle, point));
@@ -216,16 +216,16 @@
// get
// {
// yield return
-// new TestCaseData(new BoundingRectangle(), new Point2(), new Point2()).SetName(
+// new TestCaseData(new BoundingRectangle(), new Vector2(), new Vector2()).SetName(
// "The closest point on the empty bounding rectangle to the zero point is the zero point.");
// yield return
-// new TestCaseData(new BoundingRectangle(new Point2(0, 0), new Point2(50, 50)), new Point2(25, 25),
-// new Point2(25, 25)).SetName(
+// new TestCaseData(new BoundingRectangle(new Vector2(0, 0), new Vector2(50, 50)), new Vector2(25, 25),
+// new Vector2(25, 25)).SetName(
// "The closest point on a non-empty bounding rectangle to a point which is inside the bounding rectangle is that point.")
// ;
// yield return
-// new TestCaseData(new BoundingRectangle(new Point2(0, 0), new Point2(50, 50)), new Point2(400, 0),
-// new Point2(50, 0)).SetName(
+// new TestCaseData(new BoundingRectangle(new Vector2(0, 0), new Vector2(50, 50)), new Vector2(400, 0),
+// new Vector2(50, 0)).SetName(
// "The closest point on a non-empty bounding rectangle to a point which is outside the bounding rectangle is the expected point.")
// ;
// }
@@ -233,7 +233,7 @@
// [Fact]
// [TestCaseSource(nameof(ClosestPointTestCases))]
-// public void ClosestPoint(BoundingRectangle boundingRectangle, Point2 point, Point2 expectedClosestPoint)
+// public void ClosestPoint(BoundingRectangle boundingRectangle, Vector2 point, Vector2 expectedClosestPoint)
// {
// var actualClosestPoint = boundingRectangle.ClosestPointTo(point);
// Assert.Equal(expectedClosestPoint, actualClosestPoint);
@@ -249,14 +249,14 @@
// ;
// yield return
// new TestCaseData(
-// new BoundingRectangle(new Point2(0, 0), new Size2(float.MaxValue, float.MinValue)),
-// new BoundingRectangle(new Point2(0, 0),
-// new Point2(float.MinValue, float.MaxValue)), false).SetName(
+// new BoundingRectangle(new Vector2(0, 0), new Size2(float.MaxValue, float.MinValue)),
+// new BoundingRectangle(new Vector2(0, 0),
+// new Vector2(float.MinValue, float.MaxValue)), false).SetName(
// "Two different non-empty bounding rectangles are not equal.");
// yield return
// new TestCaseData(
-// new BoundingRectangle(new Point2(0, 0), new Size2(float.MinValue, float.MaxValue)),
-// new BoundingRectangle(new Point2(0, 0),
+// new BoundingRectangle(new Vector2(0, 0), new Size2(float.MinValue, float.MaxValue)),
+// new BoundingRectangle(new Vector2(0, 0),
// new Size2(float.MinValue, float.MaxValue)), true).SetName(
// "Two identical non-empty bounding rectangles are equal.");
// }
@@ -303,12 +303,12 @@
// new TestCaseData(new BoundingRectangle(), new BoundingRectangle(), true).SetName(
// "Two empty bounding rectangles have the same hash code.");
// yield return
-// new TestCaseData(new BoundingRectangle(new Point2(0, 0), new Size2(50, 50)),
-// new BoundingRectangle(new Point2(0, 0), new Size2(50, 50)), true).SetName(
+// new TestCaseData(new BoundingRectangle(new Vector2(0, 0), new Size2(50, 50)),
+// new BoundingRectangle(new Vector2(0, 0), new Size2(50, 50)), true).SetName(
// "Two indentical non-empty bounding rectangles have the same hash code.");
// yield return
-// new TestCaseData(new BoundingRectangle(new Point2(0, 0), new Size2(50, 50)),
-// new BoundingRectangle(new Point2(50, 50), new Size2(50, 50)), false).SetName(
+// new TestCaseData(new BoundingRectangle(new Vector2(0, 0), new Size2(50, 50)),
+// new BoundingRectangle(new Vector2(50, 50), new Size2(50, 50)), false).SetName(
// "Two different non-empty bounding rectangles do not have the same hash code.");
// }
// }
@@ -333,7 +333,7 @@
// new TestCaseData(new BoundingRectangle(), new Rectangle()).SetName(
// "The empty bounding rectangle point converted to a rectangle is the empty rectangle.");
// yield return
-// new TestCaseData(new BoundingRectangle(new Point2(25, 25), new Size2(25, 25)),
+// new TestCaseData(new BoundingRectangle(new Vector2(25, 25), new Size2(25, 25)),
// new Rectangle(0, 0, 50, 50)).SetName(
// "A non-empty bounding rectangle converted to a rectangle is the expected rectangle.");
// }
@@ -356,7 +356,7 @@
// "The empty rectangle converted to a bounding rectangle is the empty bounding rectangle.");
// yield return
// new TestCaseData(new Rectangle(0, 0, 50, 50),
-// new BoundingRectangle(new Point2(25, 25), new Size2(25, 25))).SetName(
+// new BoundingRectangle(new Vector2(25, 25), new Size2(25, 25))).SetName(
// "A non-empty rectangle converted to a bounding rectangle is the expected bounding rectangle.");
// }
// }
@@ -375,11 +375,11 @@
// {
// yield return
// new TestCaseData(new BoundingRectangle(),
-// string.Format(CultureInfo.CurrentCulture, "Centre: {0}, Radii: {1}", new Point2(),
+// string.Format(CultureInfo.CurrentCulture, "Centre: {0}, Radii: {1}", new Vector2(),
// new Vector2())).SetName(
// "The empty bounding rectangle has the expected string representation using the current culture.");
-// yield return new TestCaseData(new BoundingRectangle(new Point2(5.1f, -5.123f), new Size2(5.4f, -5.4123f)),
-// string.Format(CultureInfo.CurrentCulture, "Centre: {0}, Radii: {1}", new Point2(5.1f, -5.123f),
+// yield return new TestCaseData(new BoundingRectangle(new Vector2(5.1f, -5.123f), new Size2(5.4f, -5.4123f)),
+// string.Format(CultureInfo.CurrentCulture, "Centre: {0}, Radii: {1}", new Vector2(5.1f, -5.123f),
// new Vector2(5.4f, -5.4123f))).SetName(
// "A non-empty bounding rectangle has the expected string representation using the current culture.");
// }
diff --git a/tests/MonoGame.Extended.Tests/Primitives/CircleFTests.cs b/tests/MonoGame.Extended.Tests/Primitives/CircleFTests.cs
index f88155f6..a0d45f69 100644
--- a/tests/MonoGame.Extended.Tests/Primitives/CircleFTests.cs
+++ b/tests/MonoGame.Extended.Tests/Primitives/CircleFTests.cs
@@ -13,8 +13,8 @@ public class CircleFTests
[Fact]
public void CircCircIntersectionDiagonalCircleTest()
{
- var circle = new CircleF(new Point2(16.0f, 16.0f), 16.0f);
- var point = new Point2(0, 0);
+ var circle = new CircleF(new Vector2(16.0f, 16.0f), 16.0f);
+ var point = new Vector2(0, 0);
Assert.False(circle.Contains(point));
}
@@ -23,17 +23,17 @@ public class CircleFTests
// get
// {
// yield return
-// new TestCaseData(new Point2(), 0.0f).SetName(
+// new TestCaseData(new Vector2(), 0.0f).SetName(
// "The empty circle has the expected position and radius.");
// yield return
-// new TestCaseData(new Point2(5, 5), 15f).SetName(
+// new TestCaseData(new Vector2(5, 5), 15f).SetName(
// "A non-empty circle has the expected position and radius.");
// }
// }
// [Fact]
// [TestCaseSource(nameof(ConstructorTestCases))]
-// public void Constructor(Point2 centre, float radius)
+// public void Constructor(Vector2 centre, float radius)
// {
// var circle = new CircleF(centre, radius);
// Assert.Equal(centre, circle.Center);
@@ -45,12 +45,12 @@ public class CircleFTests
// get
// {
// yield return
-// new TestCaseData(new Point2(), new Point2(), new CircleF()).SetName(
+// new TestCaseData(new Vector2(), new Vector2(), new CircleF()).SetName(
// "The bounding circle created from the zero minimum point and zero maximum point is the empty bounding circle.")
// ;
// yield return
-// new TestCaseData(new Point2(5, 5), new Point2(15, 15),
-// new CircleF(new Point2(10, 10), 5f)).SetName(
+// new TestCaseData(new Vector2(5, 5), new Vector2(15, 15),
+// new CircleF(new Vector2(10, 10), 5f)).SetName(
// "The bounding circle created from the non-zero minimum point and the non-zero maximum point is the expected bounding circle.")
// ;
// }
@@ -58,7 +58,7 @@ public class CircleFTests
// [Fact]
// [TestCaseSource(nameof(CreateFromMinimumMaximumTestCases))]
-// public void CreateFromMinimumMaximum(Point2 minimum, Point2 maximum, CircleF expectedBoundingCircle)
+// public void CreateFromMinimumMaximum(Vector2 minimum, Vector2 maximum, CircleF expectedBoundingCircle)
// {
// var actualBoundingCircle = CircleF.CreateFrom(minimum, maximum);
// Assert.Equal(expectedBoundingCircle, actualBoundingCircle);
@@ -72,22 +72,22 @@ public class CircleFTests
// new TestCaseData(null, new CircleF()).SetName(
// "The bounding circle created from null points is the empty bounding circle.");
// yield return
-// new TestCaseData(new Point2[0], new CircleF()).SetName(
+// new TestCaseData(new Vector2[0], new CircleF()).SetName(
// "The bounding circle created from the empty set of points is the empty bounding circle.");
// yield return
// new TestCaseData(
// new[]
// {
-// new Point2(5, 5), new Point2(10, 10), new Point2(15, 15), new Point2(-5, -5),
-// new Point2(-15, -15)
-// }, new CircleF(new Point2(0, 0), 15)).SetName(
+// new Vector2(5, 5), new Vector2(10, 10), new Vector2(15, 15), new Vector2(-5, -5),
+// new Vector2(-15, -15)
+// }, new CircleF(new Vector2(0, 0), 15)).SetName(
// "The bounding circle created from a non-empty set of points is the expected bounding circle.");
// }
// }
// [Fact]
// [TestCaseSource(nameof(CreateFromPointsTestCases))]
-// public void CreateFromPoints(Point2[] points, CircleF expectedCircle)
+// public void CreateFromPoints(Vector2[] points, CircleF expectedCircle)
// {
// var actualCircle = CircleF.CreateFrom(points);
// Assert.Equal(expectedCircle, actualCircle);
@@ -101,12 +101,12 @@ public class CircleFTests
// new TestCaseData(new CircleF(), new CircleF(), true).SetName(
// "Two empty circles intersect.");
// yield return
-// new TestCaseData(new CircleF(new Point2(-10, -10), 15),
-// new CircleF(new Point2(20, 20), 40), true).SetName(
+// new TestCaseData(new CircleF(new Vector2(-10, -10), 15),
+// new CircleF(new Vector2(20, 20), 40), true).SetName(
// "Two overlapping non-empty circles intersect.");
// yield return
-// new TestCaseData(new CircleF(new Point2(-40, -50), 15),
-// new CircleF(new Point2(20, 20), 15), false).SetName(
+// new TestCaseData(new CircleF(new Vector2(-40, -50), 15),
+// new CircleF(new Vector2(20, 20), 15), false).SetName(
// "Two non-overlapping non-empty circles do not intersect.");
// }
// }
@@ -127,12 +127,12 @@ public class CircleFTests
// new TestCaseData(new CircleF(), new RectangleF(), true).SetName(
// "The empty circle and the empty rectangle intersect.");
// yield return
-// new TestCaseData(new CircleF(new Point2(0, 0), 15),
-// new RectangleF(new Point2(0, 0), new Size2(40, 40)), true).SetName(
+// new TestCaseData(new CircleF(new Vector2(0, 0), 15),
+// new RectangleF(new Vector2(0, 0), new Size2(40, 40)), true).SetName(
// "The non-empty circle and a non-empty overlapping rectangle intersect.");
// yield return
-// new TestCaseData(new CircleF(new Point2(-40, -50), 15),
-// new RectangleF(new Point2(20, 20), new Size2(15, 15)), false).SetName(
+// new TestCaseData(new CircleF(new Vector2(-40, -50), 15),
+// new RectangleF(new Vector2(20, 20), new Size2(15, 15)), false).SetName(
// "The non-empty circle and a non-empty non-overlapping rectangle do not intersect.");
// }
// }
@@ -150,14 +150,14 @@ public class CircleFTests
// get
// {
// yield return
-// new TestCaseData(new CircleF(), new Point2(), true).SetName(
+// new TestCaseData(new CircleF(), new Vector2(), true).SetName(
// "The empty circle contains the zero point.");
// yield return
-// new TestCaseData(new CircleF(new Point2(0, 0), 15), new Point2(-15, -15), true)
+// new TestCaseData(new CircleF(new Vector2(0, 0), 15), new Vector2(-15, -15), true)
// .SetName(
// "A non-empty circle contains a point inside it.");
// yield return
-// new TestCaseData(new CircleF(new Point2(0, 0), 15), new Point2(-16, 15), false)
+// new TestCaseData(new CircleF(new Vector2(0, 0), 15), new Vector2(-16, 15), false)
// .SetName(
// "A non-empty circle does not contain a point outside it.");
// }
@@ -165,7 +165,7 @@ public class CircleFTests
// [Fact]
// [TestCaseSource(nameof(ContainsPointTestCases))]
-// public void ContainsPoint(CircleF circle, Point2 point, bool expectedToContainPoint)
+// public void ContainsPoint(CircleF circle, Vector2 point, bool expectedToContainPoint)
// {
// Assert.Equal(expectedToContainPoint, circle.Contains(point));
// Assert.Equal(expectedToContainPoint, CircleF.Contains(circle, point));
@@ -176,16 +176,16 @@ public class CircleFTests
// get
// {
// yield return
-// new TestCaseData(new CircleF(), new Point2(), new Point2()).SetName(
+// new TestCaseData(new CircleF(), new Vector2(), new Vector2()).SetName(
// "The closest point on the empty circle to the zero point is the zero point.");
// yield return
-// new TestCaseData(new CircleF(new Point2(0, 0), 50), new Point2(25, 25),
-// new Point2(25, 25)).SetName(
+// new TestCaseData(new CircleF(new Vector2(0, 0), 50), new Vector2(25, 25),
+// new Vector2(25, 25)).SetName(
// "The closest point on a non-empty circle to a point which is inside the circle is that point.")
// ;
// yield return
-// new TestCaseData(new CircleF(new Point2(0, 0), 50), new Point2(400, 0),
-// new Point2(50, 0)).SetName(
+// new TestCaseData(new CircleF(new Vector2(0, 0), 50), new Vector2(400, 0),
+// new Vector2(50, 0)).SetName(
// "The closest point on a non-empty circle to a point which is outside the circle is the expected point.")
// ;
// }
@@ -193,7 +193,7 @@ public class CircleFTests
// [Fact]
// [TestCaseSource(nameof(ClosestPointTestCases))]
-// public void ClosestPoint(CircleF circle, Point2 point, Point2 expectedClosestPoint)
+// public void ClosestPoint(CircleF circle, Vector2 point, Vector2 expectedClosestPoint)
// {
// var actualClosestPoint = circle.ClosestPointTo(point);
// Assert.Equal(expectedClosestPoint, actualClosestPoint);
@@ -204,18 +204,18 @@ public class CircleFTests
// get
// {
// yield return
-// new TestCaseData(new CircleF(), 0.0f, new Point2()).SetName(
+// new TestCaseData(new CircleF(), 0.0f, new Vector2()).SetName(
// "The boundary point on the empty circle at an angle is the zero point.");
// yield return
-// new TestCaseData(new CircleF(new Point2(0, 0), 50), MathHelper.PiOver2,
-// new Point2(0, 50)).SetName(
+// new TestCaseData(new CircleF(new Vector2(0, 0), 50), MathHelper.PiOver2,
+// new Vector2(0, 50)).SetName(
// "The boundary point on a non-empty circle at an angle is the expected point.");
// }
// }
// [Fact]
// [TestCaseSource(nameof(BoundaryPointTestCases))]
-// public void BoundaryPointAt(CircleF circle, float angle, Point2 expectedPoint)
+// public void BoundaryPointAt(CircleF circle, float angle, Vector2 expectedPoint)
// {
// var actualPoint = circle.BoundaryPointAt(angle);
// AssertExtensions.AreApproximatelyEqual(expectedPoint, actualPoint);
@@ -231,13 +231,13 @@ public class CircleFTests
// ;
// yield return
// new TestCaseData(
-// new CircleF(new Point2(0, 0), float.MaxValue),
-// new CircleF(new Point2(0, 0), float.MinValue), false).SetName(
+// new CircleF(new Vector2(0, 0), float.MaxValue),
+// new CircleF(new Vector2(0, 0), float.MinValue), false).SetName(
// "Two different non-empty circles are not equal.");
// yield return
// new TestCaseData(
-// new CircleF(new Point2(0, 0), float.MinValue),
-// new CircleF(new Point2(0, 0), float.MinValue), true).SetName(
+// new CircleF(new Vector2(0, 0), float.MinValue),
+// new CircleF(new Vector2(0, 0), float.MinValue), true).SetName(
// "Two identical non-empty circles are equal.");
// }
// }
@@ -283,12 +283,12 @@ public class CircleFTests
// new TestCaseData(new CircleF(), new CircleF(), true).SetName(
// "Two empty circles have the same hash code.");
// yield return
-// new TestCaseData(new CircleF(new Point2(0, 0), 50),
-// new CircleF(new Point2(0, 0), 50), true).SetName(
+// new TestCaseData(new CircleF(new Vector2(0, 0), 50),
+// new CircleF(new Vector2(0, 0), 50), true).SetName(
// "Two indentical non-empty circles have the same hash code.");
// yield return
-// new TestCaseData(new CircleF(new Point2(0, 0), 50),
-// new CircleF(new Point2(50, 50), 50), false).SetName(
+// new TestCaseData(new CircleF(new Vector2(0, 0), 50),
+// new CircleF(new Vector2(50, 50), 50), false).SetName(
// "Two different non-empty circles do not have the same hash code.");
// }
// }
@@ -313,7 +313,7 @@ public class CircleFTests
// new TestCaseData(new CircleF(), new Rectangle()).SetName(
// "The empty circle converted to a rectangle is the empty integer rectangle.");
// yield return
-// new TestCaseData(new CircleF(new Point2(25, 25), 25),
+// new TestCaseData(new CircleF(new Vector2(25, 25), 25),
// new Rectangle(0, 0, 50, 50)).SetName(
// "A non-empty circle converted to a rectangle is the expected integer rectangle.");
// }
@@ -335,7 +335,7 @@ public class CircleFTests
// new TestCaseData(new CircleF(), new RectangleF()).SetName(
// "The empty circle converted to a rectangle is the empty float rectangle.");
// yield return
-// new TestCaseData(new CircleF(new Point2(25, 25), 25),
+// new TestCaseData(new CircleF(new Vector2(25, 25), 25),
// new RectangleF(0, 0, 50, 50)).SetName(
// "A non-empty circle converted to a rectangle is the expected float rectangle.");
// }
@@ -358,7 +358,7 @@ public class CircleFTests
// "The empty rectangle converted to a circle is the empty circle.");
// yield return
// new TestCaseData(new Rectangle(0, 0, 50, 50),
-// new CircleF(new Point2(25, 25), 25)).SetName(
+// new CircleF(new Vector2(25, 25), 25)).SetName(
// "A non-empty rectangle converted to a circle is the expected circle.");
// }
// }
@@ -380,7 +380,7 @@ public class CircleFTests
// "The empty rectangle converted to a circle is the empty circle.");
// yield return
// new TestCaseData(new RectangleF(0, 0, 50, 50),
-// new CircleF(new Point2(25, 25), 25)).SetName(
+// new CircleF(new Vector2(25, 25), 25)).SetName(
// "A non-empty rectangle converted to a circle is the expected circle.");
// }
// }
@@ -399,11 +399,11 @@ public class CircleFTests
// {
// yield return
// new TestCaseData(new CircleF(),
-// string.Format(CultureInfo.CurrentCulture, "Centre: {0}, Radius: {1}", new Point2(),
+// string.Format(CultureInfo.CurrentCulture, "Centre: {0}, Radius: {1}", new Vector2(),
// 0)).SetName(
// "The empty circle has the expected string representation using the current culture.");
-// yield return new TestCaseData(new CircleF(new Point2(5.1f, -5.123f), 5.4f),
-// string.Format(CultureInfo.CurrentCulture, "Centre: {0}, Radius: {1}", new Point2(5.1f, -5.123f),
+// yield return new TestCaseData(new CircleF(new Vector2(5.1f, -5.123f), 5.4f),
+// string.Format(CultureInfo.CurrentCulture, "Centre: {0}, Radius: {1}", new Vector2(5.1f, -5.123f),
// 5.4f)).SetName(
// "A non-empty circle has the expected string representation using the current culture.");
// }
diff --git a/tests/MonoGame.Extended.Tests/Primitives/OrientedRectangleTests.cs b/tests/MonoGame.Extended.Tests/Primitives/OrientedRectangleTests.cs
index dfb1a1f4..3c0ec4ac 100644
--- a/tests/MonoGame.Extended.Tests/Primitives/OrientedRectangleTests.cs
+++ b/tests/MonoGame.Extended.Tests/Primitives/OrientedRectangleTests.cs
@@ -10,9 +10,9 @@ public class OrientedRectangleTests
[Fact]
public void Initializes_oriented_rectangle()
{
- var rectangle = new OrientedRectangle(new Point2(1, 2), new SizeF(3, 4), new Matrix3x2(5, 6, 7, 8, 9, 10));
+ var rectangle = new OrientedRectangle(new Vector2(1, 2), new SizeF(3, 4), new Matrix3x2(5, 6, 7, 8, 9, 10));
- Assert.Equal(new Point2(1, 2), rectangle.Center);
+ Assert.Equal(new Vector2(1, 2), rectangle.Center);
Assert.Equal(new Vector2(3, 4), rectangle.Radii);
Assert.Equal(new Matrix3x2(5, 6, 7, 8, 9, 10), rectangle.Orientation);
CollectionAssert.Equal(
@@ -31,14 +31,14 @@ public class OrientedRectangleTests
new object[]
{
"empty compared with empty is true",
- new OrientedRectangle(Point2.Zero, SizeF.Empty, Matrix3x2.Identity),
- new OrientedRectangle(Point2.Zero, SizeF.Empty, Matrix3x2.Identity)
+ new OrientedRectangle(Vector2.Zero, SizeF.Empty, Matrix3x2.Identity),
+ new OrientedRectangle(Vector2.Zero, SizeF.Empty, Matrix3x2.Identity)
},
new object[]
{
"initialized compared with initialized true",
- new OrientedRectangle(new Point2(1, 2), new SizeF(3, 4), new Matrix3x2(5, 6, 7, 8, 9, 10)),
- new OrientedRectangle(new Point2(1, 2), new SizeF(3, 4), new Matrix3x2(5, 6, 7, 8, 9, 10))
+ new OrientedRectangle(new Vector2(1, 2), new SizeF(3, 4), new Matrix3x2(5, 6, 7, 8, 9, 10)),
+ new OrientedRectangle(new Vector2(1, 2), new SizeF(3, 4), new Matrix3x2(5, 6, 7, 8, 9, 10))
}
};
@@ -57,29 +57,29 @@ public class OrientedRectangleTests
[Fact]
public void Center_point_is_not_translated()
{
- var rectangle = new OrientedRectangle(new Point2(1, 2), new SizeF(), Matrix3x2.Identity);
+ var rectangle = new OrientedRectangle(new Vector2(1, 2), new SizeF(), Matrix3x2.Identity);
var transform = Matrix3x2.Identity;
var result = OrientedRectangle.Transform(rectangle, ref transform);
- Assert.Equal(new Point2(1, 2), result.Center);
+ Assert.Equal(new Vector2(1, 2), result.Center);
}
[Fact]
public void Center_point_is_translated()
{
- var rectangle = new OrientedRectangle(new Point2(0, 0), new SizeF(), new Matrix3x2());
+ var rectangle = new OrientedRectangle(new Vector2(0, 0), new SizeF(), new Matrix3x2());
var transform = Matrix3x2.CreateTranslation(1, 2);
var result = OrientedRectangle.Transform(rectangle, ref transform);
- Assert.Equal(new Point2(1, 2), result.Center);
+ Assert.Equal(new Vector2(1, 2), result.Center);
}
[Fact]
public void Radii_is_not_changed_by_identity_transform()
{
- var rectangle = new OrientedRectangle(new Point2(), new SizeF(10, 20), new Matrix3x2());
+ var rectangle = new OrientedRectangle(new Vector2(), new SizeF(10, 20), new Matrix3x2());
var transform = Matrix3x2.Identity;
var result = OrientedRectangle.Transform(rectangle, ref transform);
@@ -90,7 +90,7 @@ public class OrientedRectangleTests
[Fact]
public void Radii_is_not_changed_by_translation()
{
- var rectangle = new OrientedRectangle(new Point2(1, 2), new SizeF(10, 20), new Matrix3x2());
+ var rectangle = new OrientedRectangle(new Vector2(1, 2), new SizeF(10, 20), new Matrix3x2());
var transform = Matrix3x2.CreateTranslation(1, 2);
var result = OrientedRectangle.Transform(rectangle, ref transform);
@@ -101,12 +101,12 @@ public class OrientedRectangleTests
[Fact]
public void Orientation_is_rotated_45_degrees_left()
{
- var rectangle = new OrientedRectangle(new Point2(), new SizeF(), Matrix3x2.Identity);
+ var rectangle = new OrientedRectangle(new Vector2(), new SizeF(), Matrix3x2.Identity);
var transform = Matrix3x2.CreateRotationZ(MathHelper.PiOver4);
var result = OrientedRectangle.Transform(rectangle, ref transform);
- Assert.Equal(new Point2(), result.Center);
+ Assert.Equal(new Vector2(), result.Center);
Assert.Equal(new Vector2(), result.Radii);
Assert.Equal(Matrix3x2.CreateRotationZ(MathHelper.PiOver4), result.Orientation);
}
@@ -114,13 +114,13 @@ public class OrientedRectangleTests
[Fact]
public void Orientation_is_rotated_to_45_degrees_from_180()
{
- var rectangle = new OrientedRectangle(new Point2(), new SizeF(), Matrix3x2.CreateRotationZ(MathHelper.Pi));
+ var rectangle = new OrientedRectangle(new Vector2(), new SizeF(), Matrix3x2.CreateRotationZ(MathHelper.Pi));
var transform = Matrix3x2.CreateRotationZ(-3 * MathHelper.PiOver4);
var expectedOrientation = Matrix3x2.CreateRotationZ(MathHelper.PiOver4);
var result = OrientedRectangle.Transform(rectangle, ref transform);
- Assert.Equal(new Point2(), result.Center);
+ Assert.Equal(new Vector2(), result.Center);
Assert.Equal(new Vector2(), result.Radii);
Assert.Equal(expectedOrientation.M11, result.Orientation.M11, 6);
Assert.Equal(expectedOrientation.M12, result.Orientation.M12, 6);
@@ -133,7 +133,7 @@ public class OrientedRectangleTests
[Fact]
public void Points_are_same_as_center()
{
- var rectangle = new OrientedRectangle(new Point2(1, 2), new SizeF(), Matrix3x2.Identity);
+ var rectangle = new OrientedRectangle(new Vector2(1, 2), new SizeF(), Matrix3x2.Identity);
var transform = Matrix3x2.Identity;
var result = OrientedRectangle.Transform(rectangle, ref transform);
@@ -152,7 +152,7 @@ public class OrientedRectangleTests
[Fact]
public void Points_are_translated()
{
- var rectangle = new OrientedRectangle(new Point2(0, 0), new SizeF(2, 4), Matrix3x2.Identity);
+ var rectangle = new OrientedRectangle(new Vector2(0, 0), new SizeF(2, 4), Matrix3x2.Identity);
var transform = Matrix3x2.CreateTranslation(10, 20);
var result = OrientedRectangle.Transform(rectangle, ref transform);
@@ -207,7 +207,7 @@ public class OrientedRectangleTests
* :
* :
*/
- var rectangle = new OrientedRectangle(new Point2(1, 2), new SizeF(2, 4), Matrix3x2.Identity);
+ var rectangle = new OrientedRectangle(new Vector2(1, 2), new SizeF(2, 4), Matrix3x2.Identity);
var transform =
Matrix3x2.CreateRotationZ(MathHelper.PiOver2)
*
diff --git a/tests/MonoGame.Extended.Tests/Primitives/Ray2DTests.cs b/tests/MonoGame.Extended.Tests/Primitives/Ray2DTests.cs
index 04e8b00a..a1ff63f1 100644
--- a/tests/MonoGame.Extended.Tests/Primitives/Ray2DTests.cs
+++ b/tests/MonoGame.Extended.Tests/Primitives/Ray2DTests.cs
@@ -5,7 +5,7 @@
//namespace MonoGame.Extended.Tests.Primitives
//{
-//
+//
// public class Ray2Tests
// {
// public IEnumerable ConstructorTestCases
@@ -13,17 +13,17 @@
// get
// {
// yield return
-// new TestCaseData(new Point2(), new Vector2()).SetName(
+// new TestCaseData(new Vector2(), new Vector2()).SetName(
// "The degenerate ray has the expected position and direction.");
// yield return
-// new TestCaseData(new Point2(5, 5), new Vector2(15, 15)).SetName(
+// new TestCaseData(new Vector2(5, 5), new Vector2(15, 15)).SetName(
// "A non-degenerate ray has the expected position and direction.");
// }
// }
// [Fact]
// [TestCaseSource(nameof(ConstructorTestCases))]
-// public void Constructor(Point2 position, Vector2 direction)
+// public void Constructor(Vector2 position, Vector2 direction)
// {
// var ray = new Ray2(position, direction);
// Assert.Equal(position, ray.Position);
@@ -35,10 +35,10 @@
// get
// {
// yield return
-// new TestCaseData(new Ray2(), new Point2(), new Vector2()).SetName(
+// new TestCaseData(new Ray2(), new Vector2(), new Vector2()).SetName(
// "The degenerate ray has the expected position and direction.");
// yield return
-// new TestCaseData(new Ray2(new Point2(5, 5), new Vector2(15, 15)), new Point2(5, 5),
+// new TestCaseData(new Ray2(new Vector2(5, 5), new Vector2(15, 15)), new Vector2(5, 5),
// new Vector2(15, 15)).SetName
// (
// "A non-degenerate ray has the expected position and direction.");
@@ -47,14 +47,14 @@
// [Fact]
// [TestCaseSource(nameof(PositionDirectionTestCases))]
-// public void PositionDirection(Ray2 ray, Point2 expectedPosition, Vector2 expecetedDirection)
+// public void PositionDirection(Ray2 ray, Vector2 expectedPosition, Vector2 expecetedDirection)
// {
// Assert.Equal(expectedPosition, ray.Position);
// Assert.Equal(expecetedDirection, ray.Direction);
// ray.Position.X = 10;
// ray.Position.Y = 10;
-// Assert.Equal(new Point2(10, 10), ray.Position);
+// Assert.Equal(new Vector2(10, 10), ray.Position);
// ray.Direction.X = -10.123f;
// ray.Direction.Y = 10.123f;
@@ -66,20 +66,20 @@
// get
// {
// yield return
-// new TestCaseData(new Ray2(), new BoundingRectangle(), true, Point2.Zero, Point2.Zero).SetName(
+// new TestCaseData(new Ray2(), new BoundingRectangle(), true, Vector2.Zero, Vector2.Zero).SetName(
// "The degenerate ray intersects the empty bounding box.");
// yield return
-// new TestCaseData(new Ray2(new Point2(-75, -75), new Vector2(75, -75)),
-// new BoundingRectangle(new Point2(), new Size2(50, 50)), false, Point2.NaN, Point2.NaN).SetName(
+// new TestCaseData(new Ray2(new Vector2(-75, -75), new Vector2(75, -75)),
+// new BoundingRectangle(new Vector2(), new Size2(50, 50)), false, Vector2.NaN, Vector2.NaN).SetName(
// "A non-degenerate ray that does not cross a non-empty bounding box does not intersect the bounding box.");
// yield return
-// new TestCaseData(new Ray2(new Point2(0, 0), new Vector2(25, 0)), new BoundingRectangle(new Point2(), new Size2(50, 50)),
-// true, new Point2(0, 0), new Point2(50, 0)).SetName(
+// new TestCaseData(new Ray2(new Vector2(0, 0), new Vector2(25, 0)), new BoundingRectangle(new Vector2(), new Size2(50, 50)),
+// true, new Vector2(0, 0), new Vector2(50, 0)).SetName(
// "A non-degenerate ray starting from inside a non-empty bounding box intersects the bounding box.");
// yield return
-// new TestCaseData(new Ray2(new Point2(-100, 0), new Vector2(100, 0)),
-// new BoundingRectangle(new Point2(), new Size2(50, 50)),
-// true, new Point2(-50, 0), new Point2(50, 0)).SetName(
+// new TestCaseData(new Ray2(new Vector2(-100, 0), new Vector2(100, 0)),
+// new BoundingRectangle(new Vector2(), new Size2(50, 50)),
+// true, new Vector2(-50, 0), new Vector2(50, 0)).SetName(
// "A non-degenerate ray crossing a non-empty bounding box intersects the bounding box.");
// }
// }
@@ -87,7 +87,7 @@
// [Fact]
// [TestCaseSource(nameof(IntersectsBoundingRectangleTestCases))]
// public void IntersectsBoundingRectangle(Ray2 ray, BoundingRectangle boundingRectangle, bool expectedResult,
-// Point2 firstExpectedIntersectionPoint, Point2 secondExpectedIntersectionPoint)
+// Vector2 firstExpectedIntersectionPoint, Vector2 secondExpectedIntersectionPoint)
// {
// float rayNearDistance, rayFarDistance;
// var actualResult = ray.Intersects(boundingRectangle, out rayNearDistance, out rayFarDistance);
@@ -114,14 +114,14 @@
// yield return
// new TestCaseData(new Ray2(), new Ray2(), true).SetName("Two degenerate rays are equal.");
// yield return
-// new TestCaseData(new Ray2(new Point2(float.MinValue, float.MaxValue),
-// new Vector2(float.MaxValue, float.MinValue)), new Ray2(new Point2(float.MaxValue, float.MinValue),
+// new TestCaseData(new Ray2(new Vector2(float.MinValue, float.MaxValue),
+// new Vector2(float.MaxValue, float.MinValue)), new Ray2(new Vector2(float.MaxValue, float.MinValue),
// new Vector2(float.MaxValue, float.MinValue)), false).SetName(
// "Two different non-degenerate rays are not equal.");
// yield return
// new TestCaseData(
-// new Ray2(new Point2(float.MinValue, float.MaxValue),
-// new Vector2(float.MinValue, float.MaxValue)), new Ray2(new Point2(float.MinValue, float.MaxValue),
+// new Ray2(new Vector2(float.MinValue, float.MaxValue),
+// new Vector2(float.MinValue, float.MaxValue)), new Ray2(new Vector2(float.MinValue, float.MaxValue),
// new Vector2(float.MinValue, float.MaxValue)), true)
// .SetName(
// "Two identical non-degenerate rays are equal.");
@@ -168,12 +168,12 @@
// new TestCaseData(new Ray2(), new Ray2(), true).SetName(
// "Two degenerate rays have the same hash code.");
// yield return
-// new TestCaseData(new Ray2(new Point2(50, 50), new Vector2(50, 50)),
-// new Ray2(new Point2(50, 50), new Vector2(50, 50)), true).SetName(
+// new TestCaseData(new Ray2(new Vector2(50, 50), new Vector2(50, 50)),
+// new Ray2(new Vector2(50, 50), new Vector2(50, 50)), true).SetName(
// "Two indentical non-zero points have the same hash code.");
// yield return
-// new TestCaseData(new Ray2(new Point2(0, 0), new Vector2(50, 50)),
-// new Ray2(new Point2(50, 50), new Vector2(50, 50)), false).SetName(
+// new TestCaseData(new Ray2(new Vector2(0, 0), new Vector2(50, 50)),
+// new Ray2(new Vector2(50, 50), new Vector2(50, 50)), false).SetName(
// "Two different non-zero points do not have the same hash code.");
// }
// }
@@ -196,11 +196,11 @@
// {
// yield return
// new TestCaseData(new Ray2(),
-// string.Format(CultureInfo.CurrentCulture, "Position: {0}, Direction: {1}", new Point2(),
+// string.Format(CultureInfo.CurrentCulture, "Position: {0}, Direction: {1}", new Vector2(),
// new Vector2())).SetName(
// "The degenerate ray has the expected string representation using the current culture.");
-// yield return new TestCaseData(new Ray2(new Point2(5.1f, -5.123f), new Vector2(0, 1)),
-// string.Format(CultureInfo.CurrentCulture, "Position: {0}, Direction: {1}", new Point2(5.1f, -5.123f),
+// yield return new TestCaseData(new Ray2(new Vector2(5.1f, -5.123f), new Vector2(0, 1)),
+// string.Format(CultureInfo.CurrentCulture, "Position: {0}, Direction: {1}", new Vector2(5.1f, -5.123f),
// new Vector2(0, 1))).SetName(
// "A non-degenerate ray has the expected string representation using the current culture.");
// }
diff --git a/tests/MonoGame.Extended.Tests/Primitives/RectangleFTests.cs b/tests/MonoGame.Extended.Tests/Primitives/RectangleFTests.cs
index 74abe8ed..84376a2b 100644
--- a/tests/MonoGame.Extended.Tests/Primitives/RectangleFTests.cs
+++ b/tests/MonoGame.Extended.Tests/Primitives/RectangleFTests.cs
@@ -37,29 +37,29 @@ namespace MonoGame.Extended.Tests.Primitives
[Fact]
public void Center_point_is_not_translated()
{
- var rectangle = new RectangleF(new Point2(0, 0), new SizeF(20, 30));
+ var rectangle = new RectangleF(new Vector2(0, 0), new SizeF(20, 30));
var transform = Matrix3x2.Identity;
var result = RectangleF.Transform(rectangle, ref transform);
- Assert.Equal(new Point2(10, 15), result.Center);
+ Assert.Equal(new Vector2(10, 15), result.Center);
}
[Fact]
public void Center_point_is_translated()
{
- var rectangleF = new RectangleF(new Point2(0, 0), new SizeF(20, 30));
+ var rectangleF = new RectangleF(new Vector2(0, 0), new SizeF(20, 30));
var transform = Matrix3x2.CreateTranslation(1, 2);
var result = RectangleF.Transform(rectangleF, ref transform);
- Assert.Equal(new Point2(11, 17), result.Center);
+ Assert.Equal(new Vector2(11, 17), result.Center);
}
[Fact]
public void Size_is_not_changed_by_identity_transform()
{
- var rectangle = new RectangleF(new Point2(0, 0), new SizeF(20, 30));
+ var rectangle = new RectangleF(new Vector2(0, 0), new SizeF(20, 30));
var transform = Matrix3x2.Identity;
var result = RectangleF.Transform(rectangle, ref transform);
@@ -70,7 +70,7 @@ namespace MonoGame.Extended.Tests.Primitives
[Fact]
public void Size_is_not_changed_by_translation()
{
- var rectangle = new RectangleF(new Point2(0, 0), new SizeF(20, 30));
+ var rectangle = new RectangleF(new Vector2(0, 0), new SizeF(20, 30));
var transform = Matrix3x2.CreateTranslation(1, 2);
var result = RectangleF.Transform(rectangle, ref transform);
@@ -117,7 +117,7 @@ namespace MonoGame.Extended.Tests.Primitives
* :
* :
*/
- var rectangle = new RectangleF(new Point2(0, 0), new SizeF(2, 4));
+ var rectangle = new RectangleF(new Vector2(0, 0), new SizeF(2, 4));
var transform =
Matrix3x2.CreateRotationZ(MathHelper.PiOver2)
*
diff --git a/tests/MonoGame.Extended.Tests/Primitives/Segment2DTests.cs b/tests/MonoGame.Extended.Tests/Primitives/Segment2DTests.cs
index b9945273..802960b0 100644
--- a/tests/MonoGame.Extended.Tests/Primitives/Segment2DTests.cs
+++ b/tests/MonoGame.Extended.Tests/Primitives/Segment2DTests.cs
@@ -11,19 +11,19 @@
// get
// {
// yield return
-// new TestCaseData(new Point2(), new Point2()).SetName(
+// new TestCaseData(new Vector2(), new Vector2()).SetName(
// "The empty segment has expected starting and ending points.");
// yield return
// new TestCaseData(
-// new Point2(float.MaxValue, float.MinValue),
-// new Point2(int.MaxValue, int.MinValue)).SetName(
+// new Vector2(float.MaxValue, float.MinValue),
+// new Vector2(int.MaxValue, int.MinValue)).SetName(
// "A non-empty segment has the expected starting and ending points.");
// }
// }
// [Fact]
// [TestCaseSource(nameof(ConstructorTestCases))]
-// public void Constructor(Point2 startingPoint, Point2 endingPoint)
+// public void Constructor(Vector2 startingPoint, Vector2 endingPoint)
// {
// var segment = new Segment2(startingPoint, endingPoint);
// Assert.Equal(startingPoint, segment.Start);
@@ -35,21 +35,21 @@
// get
// {
// yield return
-// new TestCaseData(new Segment2(), new Point2(), new Point2()).SetName(
+// new TestCaseData(new Segment2(), new Vector2(), new Vector2()).SetName(
// "The closest point on the empty segment to the zero point is the zero point.");
// yield return
-// new TestCaseData(new Segment2(new Point2(0, 0), new Point2(200, 0)), new Point2(-100, 200),
-// new Point2(0, 0)).SetName(
+// new TestCaseData(new Segment2(new Vector2(0, 0), new Vector2(200, 0)), new Vector2(-100, 200),
+// new Vector2(0, 0)).SetName(
// "The closest point on a non-empty segment to a point which is projected beyond the start of the segment is the segment's starting point.")
// ;
// yield return
-// new TestCaseData(new Segment2(new Point2(0, 0), new Point2(200, 0)), new Point2(400, 200),
-// new Point2(200, 0)).SetName(
+// new TestCaseData(new Segment2(new Vector2(0, 0), new Vector2(200, 0)), new Vector2(400, 200),
+// new Vector2(200, 0)).SetName(
// "The closest point on a non-empty segment to a point which is projected beyond the end of the segment is the segment's ending point.")
// ;
// yield return
-// new TestCaseData(new Segment2(new Point2(0, 0), new Point2(200, 0)), new Point2(100, 200),
-// new Point2(100, 0)).SetName(
+// new TestCaseData(new Segment2(new Vector2(0, 0), new Vector2(200, 0)), new Vector2(100, 200),
+// new Vector2(100, 0)).SetName(
// "The closest point on a non-empty segment to a point which is projected inside the segment is the projected point.")
// ;
// }
@@ -57,7 +57,7 @@
// [Fact]
// [TestCaseSource(nameof(ClosestPointTestCases))]
-// public void ClosestPoint(Segment2 segment, Point2 point, Point2 expectedClosestPoint)
+// public void ClosestPoint(Segment2 segment, Vector2 point, Vector2 expectedClosestPoint)
// {
// var actualClosestPoint = segment.ClosestPointTo(point);
// Assert.Equal(expectedClosestPoint, actualClosestPoint);
@@ -68,20 +68,20 @@
// get
// {
// yield return
-// new TestCaseData(new Segment2(), new Point2(), 0).SetName(
+// new TestCaseData(new Segment2(), new Vector2(), 0).SetName(
// "The squared distance of the zero point to the empty segment is 0.");
// yield return
-// new TestCaseData(new Segment2(new Point2(0, 0), new Point2(20, 0)), new Point2(-10, 20), 500)
+// new TestCaseData(new Segment2(new Vector2(0, 0), new Vector2(20, 0)), new Vector2(-10, 20), 500)
// .SetName(
// "The squared distance of a point projected beyond the start of a non-empty segment is the squared distance from the segment's starting point to the point.")
// ;
// yield return
-// new TestCaseData(new Segment2(new Point2(0, 0), new Point2(20, 0)), new Point2(40, 20), 400)
+// new TestCaseData(new Segment2(new Vector2(0, 0), new Vector2(20, 0)), new Vector2(40, 20), 400)
// .SetName(
// "The squared distance of a point projected beyond the end of a non-empty segment is the squared distance from the segment's ending point to the point.")
// ;
// yield return
-// new TestCaseData(new Segment2(new Point2(0, 0), new Point2(20, 0)), new Point2(10, 25), 625).SetName
+// new TestCaseData(new Segment2(new Vector2(0, 0), new Vector2(20, 0)), new Vector2(10, 25), 625).SetName
// (
// "The squared distance of a point projected inside a non-empty segment is the squared distance from the projected point to the point.")
// ;
@@ -90,7 +90,7 @@
// [Fact]
// [TestCaseSource(nameof(SquaredDistanceToPointTestCases))]
-// public void SquaredDistanceToPoint(Segment2 segment, Point2 point,
+// public void SquaredDistanceToPoint(Segment2 segment, Vector2 point,
// float expectedDistance)
// {
// var actualDistance = segment.SquaredDistanceTo(point);
@@ -102,20 +102,20 @@
// get
// {
// yield return
-// new TestCaseData(new Segment2(), new BoundingRectangle(), true, Point2.Zero).SetName(
+// new TestCaseData(new Segment2(), new BoundingRectangle(), true, Vector2.Zero).SetName(
// "The empty segment intersects the empty bounding box.");
// yield return
-// new TestCaseData(new Segment2(new Point2(-75, -75), new Point2(75, -75)),
-// new BoundingRectangle(new Point2(), new Size2(50, 50)), false, Point2.NaN).SetName(
+// new TestCaseData(new Segment2(new Vector2(-75, -75), new Vector2(75, -75)),
+// new BoundingRectangle(new Vector2(), new Size2(50, 50)), false, Vector2.NaN).SetName(
// "A non-empty segment outside a non-empty bounding box does not intersect the bounding box.");
// yield return
-// new TestCaseData(new Segment2(new Point2(0, 0), new Point2(25, 0)), new BoundingRectangle(new Point2(), new Size2(50, 50)),
-// true, new Point2(0, 0)).SetName(
+// new TestCaseData(new Segment2(new Vector2(0, 0), new Vector2(25, 0)), new BoundingRectangle(new Vector2(), new Size2(50, 50)),
+// true, new Vector2(0, 0)).SetName(
// "A non-empty segment inside a non-empty bounding box intersects the bounding box.");
// yield return
-// new TestCaseData(new Segment2(new Point2(-100, 0), new Point2(100, 0)),
-// new BoundingRectangle(new Point2(), new Size2(50, 50)),
-// true, new Point2(-50, 0)).SetName(
+// new TestCaseData(new Segment2(new Vector2(-100, 0), new Vector2(100, 0)),
+// new BoundingRectangle(new Vector2(), new Size2(50, 50)),
+// true, new Vector2(-50, 0)).SetName(
// "A non-empty segment crossing a non-empty bounding box intersects the bounding box.");
// }
// }
@@ -123,9 +123,9 @@
// [Fact]
// [TestCaseSource(nameof(IntersectsBoundingRectangleTestCases))]
// public void IntersectsBoundingRectangle(Segment2 segment, BoundingRectangle boundingRectangle, bool expectedResult,
-// Point2 expectedIntersectionPoint)
+// Vector2 expectedIntersectionPoint)
// {
-// Point2 actualIntersectionPoint;
+// Vector2 actualIntersectionPoint;
// var actualResult = segment.Intersects(boundingRectangle, out actualIntersectionPoint);
// Assert.Equal(expectedResult, actualResult);
@@ -149,15 +149,15 @@
// ;
// yield return
// new TestCaseData(
-// new Segment2(new Point2(0, 0), new Point2(float.MaxValue, float.MinValue)),
-// new Segment2(new Point2(0, 0),
-// new Point2(float.MinValue, float.MaxValue)), false).SetName(
+// new Segment2(new Vector2(0, 0), new Vector2(float.MaxValue, float.MinValue)),
+// new Segment2(new Vector2(0, 0),
+// new Vector2(float.MinValue, float.MaxValue)), false).SetName(
// "Two different non-empty segments are not equal.");
// yield return
// new TestCaseData(
-// new Segment2(new Point2(0, 0), new Point2(float.MinValue, float.MaxValue)),
-// new Segment2(new Point2(0, 0),
-// new Point2(float.MinValue, float.MaxValue)), true).SetName(
+// new Segment2(new Vector2(0, 0), new Vector2(float.MinValue, float.MaxValue)),
+// new Segment2(new Vector2(0, 0),
+// new Vector2(float.MinValue, float.MaxValue)), true).SetName(
// "Two identical non-empty segments are equal.");
// }
// }
@@ -202,12 +202,12 @@
// new TestCaseData(new Segment2(), new Segment2(), true).SetName(
// "Two empty segments have the same hash code.");
// yield return
-// new TestCaseData(new Segment2(new Point2(0, 0), new Point2(50, 50)),
-// new Segment2(new Point2(0, 0), new Point2(50, 50)), true).SetName(
+// new TestCaseData(new Segment2(new Vector2(0, 0), new Vector2(50, 50)),
+// new Segment2(new Vector2(0, 0), new Vector2(50, 50)), true).SetName(
// "Two indentical non-empty segments have the same hash code.");
// yield return
-// new TestCaseData(new Segment2(new Point2(0, 0), new Point2(50, 50)),
-// new Segment2(new Point2(50, 50), new Point2(50, 50)), false).SetName(
+// new TestCaseData(new Segment2(new Vector2(0, 0), new Vector2(50, 50)),
+// new Segment2(new Vector2(50, 50), new Vector2(50, 50)), false).SetName(
// "Two different non-empty segments do not have the same hash code.");
// }
// }
@@ -230,12 +230,12 @@
// {
// yield return
// new TestCaseData(new Segment2(),
-// string.Format(CultureInfo.CurrentCulture, "{0} -> {1}", new Point2(),
-// new Point2())).SetName(
+// string.Format(CultureInfo.CurrentCulture, "{0} -> {1}", new Vector2(),
+// new Vector2())).SetName(
// "The empty segment has the expected string representation using the current culture.");
-// yield return new TestCaseData(new Segment2(new Point2(5.1f, -5.123f), new Point2(5.4f, -5.4123f)),
-// string.Format(CultureInfo.CurrentCulture, "{0} -> {1}", new Point2(5.1f, -5.123f),
-// new Point2(5.4f, -5.4123f))).SetName(
+// yield return new TestCaseData(new Segment2(new Vector2(5.1f, -5.123f), new Vector2(5.4f, -5.4123f)),
+// string.Format(CultureInfo.CurrentCulture, "{0} -> {1}", new Vector2(5.1f, -5.123f),
+// new Vector2(5.4f, -5.4123f))).SetName(
// "A non-empty segment has the expected string representation using the current culture.");
// }
// }
diff --git a/tests/MonoGame.Extended.Tests/Primitives/ShapeTests.cs b/tests/MonoGame.Extended.Tests/Primitives/ShapeTests.cs
index 28255cfe..7e6e05b9 100644
--- a/tests/MonoGame.Extended.Tests/Primitives/ShapeTests.cs
+++ b/tests/MonoGame.Extended.Tests/Primitives/ShapeTests.cs
@@ -10,8 +10,8 @@ public class ShapeTests
[Fact]
public void CircCircIntersectionSameCircleTest()
{
- IShapeF shape1 = new CircleF(Point2.Zero, 2.0f);
- IShapeF shape2 = new CircleF(Point2.Zero, 2.0f);
+ IShapeF shape1 = new CircleF(Vector2.Zero, 2.0f);
+ IShapeF shape2 = new CircleF(Vector2.Zero, 2.0f);
Assert.True(shape1.Intersects(shape2));
}
@@ -19,8 +19,8 @@ public class ShapeTests
[Fact]
public void CircCircIntersectionOverlappingTest()
{
- IShapeF shape1 = new CircleF(new Point2(1, 2), 2.0f);
- IShapeF shape2 = new CircleF(Point2.Zero, 2.0f);
+ IShapeF shape1 = new CircleF(new Vector2(1, 2), 2.0f);
+ IShapeF shape2 = new CircleF(Vector2.Zero, 2.0f);
Assert.True(shape1.Intersects(shape2));
}
@@ -28,8 +28,8 @@ public class ShapeTests
[Fact]
public void CircleCircleNotIntersectingTest()
{
- IShapeF shape1 = new CircleF(new Point2(5, 5), 2.0f);
- IShapeF shape2 = new CircleF(Point2.Zero, 2.0f);
+ IShapeF shape1 = new CircleF(new Vector2(5, 5), 2.0f);
+ IShapeF shape2 = new CircleF(Vector2.Zero, 2.0f);
Assert.False(shape1.Intersects(shape2));
}
@@ -40,8 +40,8 @@ public class ShapeTests
[Fact]
public void RectRectSameRectTest()
{
- IShapeF shape1 = new RectangleF(Point2.Zero, new SizeF(5, 5));
- IShapeF shape2 = new RectangleF(Point2.Zero, new SizeF(5, 5));
+ IShapeF shape1 = new RectangleF(Vector2.Zero, new SizeF(5, 5));
+ IShapeF shape2 = new RectangleF(Vector2.Zero, new SizeF(5, 5));
Assert.True(shape1.Intersects(shape2));
}
@@ -49,8 +49,8 @@ public class ShapeTests
[Fact]
public void RectRectIntersectingTest()
{
- IShapeF shape1 = new RectangleF(Point2.Zero, new SizeF(5, 5));
- IShapeF shape2 = new RectangleF(new Point2(3, 3), new SizeF(5, 5));
+ IShapeF shape1 = new RectangleF(Vector2.Zero, new SizeF(5, 5));
+ IShapeF shape2 = new RectangleF(new Vector2(3, 3), new SizeF(5, 5));
Assert.True(shape1.Intersects(shape2));
}
@@ -58,8 +58,8 @@ public class ShapeTests
[Fact]
public void RectRectNotIntersectingTest()
{
- IShapeF shape1 = new RectangleF(Point2.Zero, new SizeF(5, 5));
- IShapeF shape2 = new RectangleF(new Point2(10, 10), new SizeF(5, 5));
+ IShapeF shape1 = new RectangleF(Vector2.Zero, new SizeF(5, 5));
+ IShapeF shape2 = new RectangleF(new Vector2(10, 10), new SizeF(5, 5));
Assert.False(shape1.Intersects(shape2));
}
@@ -67,8 +67,8 @@ public class ShapeTests
[Fact]
public void RectCircContainedTest()
{
- IShapeF shape1 = new RectangleF(Point2.Zero, new SizeF(5, 5));
- IShapeF shape2 = new CircleF(Point2.Zero, 4);
+ IShapeF shape1 = new RectangleF(Vector2.Zero, new SizeF(5, 5));
+ IShapeF shape2 = new CircleF(Vector2.Zero, 4);
Assert.True(shape1.Intersects(shape2));
Assert.True(shape2.Intersects(shape1));
@@ -77,8 +77,8 @@ public class ShapeTests
[Fact]
public void RectCircOnEdgeTest()
{
- IShapeF shape1 = new RectangleF(Point2.Zero, new SizeF(5, 5));
- IShapeF shape2 = new CircleF(new Point2(5, 0), 4);
+ IShapeF shape1 = new RectangleF(Vector2.Zero, new SizeF(5, 5));
+ IShapeF shape2 = new CircleF(new Vector2(5, 0), 4);
Assert.True(shape1.Intersects(shape2));
Assert.True(shape2.Intersects(shape1));
@@ -99,8 +99,8 @@ public class ShapeTests
* :
* :
*/
- IShapeF rectangle = new OrientedRectangle(Point2.Zero, new SizeF(1, 1), Matrix3x2.Identity);
- var circle = new CircleF(Point2.Zero, 1);
+ IShapeF rectangle = new OrientedRectangle(Vector2.Zero, new SizeF(1, 1), Matrix3x2.Identity);
+ var circle = new CircleF(Vector2.Zero, 1);
Assert.True(rectangle.Intersects(circle));
}
@@ -117,8 +117,8 @@ public class ShapeTests
* :
* :
*/
- IShapeF rectangle = new OrientedRectangle(Point2.Zero, new SizeF(1, 1), Matrix3x2.Identity);
- var circle = new CircleF(new Point2(-2, 1), .99f);
+ IShapeF rectangle = new OrientedRectangle(Vector2.Zero, new SizeF(1, 1), Matrix3x2.Identity);
+ var circle = new CircleF(new Vector2(-2, 1), .99f);
Assert.False(rectangle.Intersects(circle));
}
@@ -135,8 +135,8 @@ public class ShapeTests
* * *
* :* *
*/
- IShapeF rectangle = new OrientedRectangle(new Point2(-1, 1), new SizeF(1.42f, 1.42f), Matrix3x2.CreateRotationZ(-MathHelper.PiOver4));
- var circle = new CircleF(new Point2(1, -1), 1.4f);
+ IShapeF rectangle = new OrientedRectangle(new Vector2(-1, 1), new SizeF(1.42f, 1.42f), Matrix3x2.CreateRotationZ(-MathHelper.PiOver4));
+ var circle = new CircleF(new Vector2(1, -1), 1.4f);
Assert.False(rectangle.Intersects(circle));
}
@@ -153,8 +153,8 @@ public class ShapeTests
* :**
* :
*/
- IShapeF rectangle = new OrientedRectangle(new Point2(-1, 0), new SizeF(1, 1), Matrix3x2.Identity);
- var rect = new RectangleF(new Point2(0.001f, 0), new SizeF(2, 2));
+ IShapeF rectangle = new OrientedRectangle(new Vector2(-1, 0), new SizeF(1, 1), Matrix3x2.Identity);
+ var rect = new RectangleF(new Vector2(0.001f, 0), new SizeF(2, 2));
Assert.False(rectangle.Intersects(rect));
}
@@ -171,8 +171,8 @@ public class ShapeTests
* :**
* :
*/
- IShapeF rectangle = new OrientedRectangle(new Point2(-1, 0), new SizeF(1, 1), Matrix3x2.Identity);
- var rect = new RectangleF(new Point2(0, 0), new SizeF(2, 2));
+ IShapeF rectangle = new OrientedRectangle(new Vector2(-1, 0), new SizeF(1, 1), Matrix3x2.Identity);
+ var rect = new RectangleF(new Vector2(0, 0), new SizeF(2, 2));
Assert.True(rectangle.Intersects(rect));
}
diff --git a/tests/MonoGame.Extended.Tests/Primitives/Size2Tests.cs b/tests/MonoGame.Extended.Tests/Primitives/Size2Tests.cs
index faaa4267..bfda0d4a 100644
--- a/tests/MonoGame.Extended.Tests/Primitives/Size2Tests.cs
+++ b/tests/MonoGame.Extended.Tests/Primitives/Size2Tests.cs
@@ -5,7 +5,7 @@
//namespace MonoGame.Extended.Tests.Primitives
//{
-//
+//
// public class Size2Tests
// {
// public IEnumerable ConstructorTestCases
@@ -184,18 +184,18 @@
// get
// {
// yield return
-// new TestCaseData(new Size2(), new Point2()).SetName("The empty size converted to a point is the zero point.");
+// new TestCaseData(new Size2(), new Vector2()).SetName("The empty size converted to a point is the zero point.");
// yield return
-// new TestCaseData(new Size2(float.MinValue, float.MaxValue), new Point2(float.MinValue, float.MaxValue)).SetName(
+// new TestCaseData(new Size2(float.MinValue, float.MaxValue), new Vector2(float.MinValue, float.MaxValue)).SetName(
// "A non-empty size converted to a point is the expected point.");
// }
// }
// [Fact]
// [TestCaseSource(nameof(ToPointTestCases))]
-// public void ToPoint(Size2 size, Point2 expectedPoint)
+// public void ToPoint(Size2 size, Vector2 expectedPoint)
// {
-// var actualPoint = (Point2)size;
+// var actualPoint = (Vector2)size;
// Assert.Equal(expectedPoint, actualPoint);
// }
@@ -204,16 +204,16 @@
// get
// {
// yield return
-// new TestCaseData(new Point2(), new Size2()).SetName("The zero point converted to a size is the empty size.");
+// new TestCaseData(new Vector2(), new Size2()).SetName("The zero point converted to a size is the empty size.");
// yield return
-// new TestCaseData(new Point2(float.MinValue, float.MaxValue), new Size2(float.MinValue, float.MaxValue)).SetName(
+// new TestCaseData(new Vector2(float.MinValue, float.MaxValue), new Size2(float.MinValue, float.MaxValue)).SetName(
// "A non-zero point converted to a size is the expected size.");
// }
// }
// [Fact]
// [TestCaseSource(nameof(FromPointTestCases))]
-// public void FromPoint(Point2 point, Size2 expectedSize)
+// public void FromPoint(Vector2 point, Size2 expectedSize)
// {
// var actualSize = (Size2)point;
// Assert.Equal(expectedSize, actualSize);