33using System.Runtime.InteropServices;
37 [StructLayout(LayoutKind.Sequential, Size = Line.Size)]
38 [AdvBrowsableOrder(
"Normal,D")]
39#if !CompactFramework && !WindowsCE && !PocketPC && !XBOX360 && !SILVERLIGHT && !WINDOWS_PHONE && !NETFX_CORE && !NETFX_CORE
43 public struct Line : IEquatable<Line>
48 Transform(ref matrix, ref line, out result);
60 Vector2D.
Dot(ref point, ref result.Normal, out result.D);
65 Transform(ref matrix, ref line, out result);
77 Vector2D.
Dot(ref point, ref result.Normal, out result.D);
86 [InstanceConstructor(
"Normal,D")]
153 DistanceFromOrigin = -((DistanceFromOrigin +
D) / dir);
154 if (DistanceFromOrigin >= 0)
156 result = DistanceFromOrigin;
164 Vector2D[] vertexes = box.Corners();
168 int sign = Math.Sign(distance);
170 for (
int index = 1; index < vertexes.Length; ++index)
174 if (Math.Sign(distance) != sign)
183 circle.Intersects(ref
this, out result);
187 if (polygon ==
null) {
throw new ArgumentNullException(
"polygon"); }
188 Vector2D[] vertexes = polygon.Vertexes;
192 int sign = Math.Sign(distance);
194 for (
int index = 1; index < vertexes.Length; ++index)
198 if (Math.Sign(distance) != sign)
209 return string.Format(
"N: {0} D: {1}",
Normal,
D);
221 return Equals(ref
this, ref other);
225 return Equals(ref line1, ref line2);
229 return Vector2D.
Equals(ref line1.Normal, ref line2.Normal) && line1.D == line2.D;
234 return Equals(ref line1, ref line2);
238 return !
Equals(ref line1, ref line2);
static Scalar Sqrt(Scalar d)
Scalar Intersects(Ray ray)
void GetDistance(ref Vector2D point, out Scalar result)
static Line Transform(Matrix3x3 matrix, Line line)
static void Transform(ref Matrix2x3 matrix, ref Line line, out Line result)
Line(Scalar nX, Scalar nY, Scalar d)
static bool operator==(Line line1, Line line2)
bool Intersects(BoundingRectangle rect)
static bool operator!=(Line line1, Line line2)
void Intersects(ref BoundingCircle circle, out bool result)
static bool Equals(ref Line line1, ref Line line2)
Line(Vector2D normal, Scalar d)
static void Transform(ref Matrix3x3 matrix, ref Line line, out Line result)
void Intersects(ref BoundingRectangle box, out bool result)
void Intersects(ref Ray ray, out Scalar result)
Scalar GetDistance(Vector2D point)
static Line Transform(Matrix2x3 matrix, Line line)
void Intersects(ref BoundingPolygon polygon, out bool result)
Line(Vector2D point1, Vector2D point2)
override int GetHashCode()
override string ToString()
bool Intersects(BoundingCircle circle)
bool Intersects(BoundingPolygon polygon)
Scalar Intersects(Ray ray)
override bool Equals(object obj)
static bool Equals(Line line1, Line line2)
A 2x3 matrix which can represent rotations around axes.
A 3x3 matrix which can represent rotations around axes.
This is the Vector Class.
static readonly Vector2D Zero
Vector2D(0,0)
static Vector2D Multiply(Vector2D source, Scalar scalar)
Does Scaler Multiplication on a Vector2D.
const int Size
The Size of the class in bytes;
Scalar X
This is the X value. (Usually represents a horizontal position or direction.)
static Vector2D Transform(Matrix3x3 matrix, Vector2D source)
Uses a matrix multiplication to Transform the vector.
static Scalar Dot(Vector2D left, Vector2D right)
Does a Dot Operation Also know as an Inner Product.
static Vector2D Normalize(Vector2D source)
This returns the Normalized Vector2D that is passed. This is also known as a Unit Vector.
override int GetHashCode()
Provides a unique hash code based on the member variables of this class. This should be done because ...
static Vector2D Subtract(Vector2D left, Vector2D right)
Subtracts 2 Vector2Ds.
Scalar Y
This is the Y value. (Usually represents a vertical position or direction.)
override bool Equals(object obj)
Compares this Vector to another object. This should be done because the equality operators (==,...