7[DebuggerDisplay(
"{DebugDisplayString,nq}")]
66 return X.GetHashCode() +
Y.GetHashCode();
88 return "{X:" +
X +
" Y:" +
Y +
"}";
100 result.X = value1.X + value2.X;
101 result.Y = value1.Y + value2.Y;
111 result.X =
Barycentric(value1.X, value2.X, value3.X, amount1, amount2);
112 result.Y =
Barycentric(value1.Y, value2.Y, value3.Y, amount1, amount2);
122 result.X =
CatmullRom(value1.X, value2.X, value3.X, value4.X, amount);
123 result.Y =
CatmullRom(value1.Y, value2.Y, value3.Y, value4.Y, amount);
133 result.X =
Clamp(value1.X, min.X, max.X);
134 result.Y =
Clamp(value1.Y, min.Y, max.Y);
139 double num3 = value1.X - value2.
X;
140 double num2 = value1.Y - value2.
Y;
141 return Math.
Sqrt(num3 * num3 + num2 * num2);
146 double num = value1.X - value2.X;
147 double num2 = value1.Y - value2.Y;
148 result =
Math.
Sqrt(num * num + num2 * num2);
153 double num3 = value1.X - value2.
X;
154 double num2 = value1.Y - value2.
Y;
155 return num3 * num3 + num2 * num2;
160 double num = value1.X - value2.X;
161 double num2 = value1.Y - value2.Y;
162 result = num * num + num2 * num2;
167 value1.X /= value2.
X;
168 value1.Y /= value2.
Y;
174 result.X = value1.X / value2.X;
175 result.Y = value1.Y / value2.Y;
180 double num = 1.0 / divider;
188 double num = 1.0 / divider;
189 result.X = value1.X * num;
190 result.Y = value1.Y * num;
195 return value1.X * value2.X + value1.Y * value2.
Y;
200 result = value1.X * value2.X + value1.Y * value2.Y;
206 Hermite(ref value1, ref tangent1, ref value2, ref tangent2, amount, out result);
212 result.X =
Hermite(value1.X, tangent1.X, value2.X, tangent2.X, amount);
213 result.Y =
Hermite(value1.Y, tangent1.Y, value2.Y, tangent2.Y, amount);
223 result.X =
Lerp(value1.X, value2.X, amount);
224 result.Y =
Lerp(value1.Y, value2.Y, amount);
229 return new Vector2D((value1.
X > value2.
X) ? value1.
X : value2.
X, (value1.Y > value2.
Y) ? value1.
Y : value2.
Y);
234 result.X = ((value1.X > value2.X) ? value1.X : value2.X);
235 result.Y = ((value1.Y > value2.Y) ? value1.Y : value2.Y);
240 return new Vector2D((value1.
X < value2.
X) ? value1.
X : value2.
X, (value1.Y < value2.
Y) ? value1.
Y : value2.
Y);
245 result.X = ((value1.X < value2.X) ? value1.X : value2.X);
246 result.Y = ((value1.Y < value2.Y) ? value1.Y : value2.Y);
251 value1.X *= value2.
X;
252 value1.Y *= value2.
Y;
258 value1.X *= scaleFactor;
259 value1.Y *= scaleFactor;
265 result.X = value1.X * scaleFactor;
266 result.Y = value1.Y * scaleFactor;
271 result.X = value1.X * value2.X;
272 result.Y = value1.Y * value2.Y;
277 value.X = 0.0 -
value.X;
278 value.Y = 0.0 -
value.Y;
284 result.X = 0.0 -
value.X;
285 result.Y = 0.0 -
value.Y;
299 result.X = value.X * num;
300 result.Y = value.Y * num;
305 double num = 2.0 * (vector.X * normal.X + vector.Y * normal.
Y);
307 result.X = vector.X - normal.X * num;
308 result.Y = vector.Y - normal.Y * num;
314 double num = 2.0 * (vector.X * normal.X + vector.Y * normal.Y);
315 result.X = vector.X - normal.X * num;
316 result.Y = vector.Y - normal.Y * num;
326 result.X =
SmoothStep(value1.X, value2.X, amount);
327 result.Y =
SmoothStep(value1.Y, value2.Y, amount);
332 value1.X -= value2.
X;
333 value1.Y -= value2.
Y;
339 result.X = value1.X - value2.X;
340 result.Y = value1.Y - value2.Y;
345 value.X = 0.0 -
value.X;
346 value.Y = 0.0 -
value.Y;
352 if (value1.
X == value2.
X)
354 return value1.Y == value2.
Y;
361 return !(value1 == value2);
366 value1.X += value2.
X;
367 value1.Y += value2.
Y;
373 value1.X -= value2.
X;
374 value1.Y -= value2.
Y;
380 value1.X *= value2.
X;
381 value1.Y *= value2.
Y;
387 value.X *= scaleFactor;
388 value.Y *= scaleFactor;
394 value.X *= scaleFactor;
395 value.Y *= scaleFactor;
401 value1.X /= value2.
X;
402 value1.Y /= value2.
Y;
408 double num = 1.0 / divider;
414 public static double Clamp(
double value,
double min,
double max)
421 public static double Lerp(
double value1,
double value2,
double amount)
423 return value1 + (value2 - value1) * amount;
426 public static double SmoothStep(
double value1,
double value2,
double amount)
428 double amount2 =
Clamp(amount, 0.0, 1.0);
429 return Hermite(value1, 0.0, value2, 0.0, amount2);
432 public static double Hermite(
double value1,
double tangent1,
double value2,
double tangent2,
double amount)
434 double num = amount * amount * amount;
435 double num2 = amount * amount;
444 return (2.0 * value1 - 2.0 * value2 + tangent2 + tangent1) * num + (3.0 * value2 - 3.0 * value1 - 2.0 * tangent1 - tangent2) * num2 + tangent1 * amount + value1;
447 public static double Barycentric(
double value1,
double value2,
double value3,
double amount1,
double amount2)
449 return value1 + (value2 - value1) * amount1 + (value3 - value1) * amount2;
452 public static double CatmullRom(
double value1,
double value2,
double value3,
double value4,
double amount)
454 double num = amount * amount;
455 double num2 = num * amount;
456 return 0.5 * (2.0 * value2 + (value3 - value1) * amount + (2.0 * value1 - 5.0 * value2 + 4.0 * value3 - value4) * num + (3.0 * value2 - value1 - 3.0 * value3 + value4) * num2);
static double Sqrt(double d)
static double Pow(double x, double y)
static double Abs(double value)
static double Barycentric(double value1, double value2, double value3, double amount1, double amount2)
static void Subtract(ref Vector2D value1, ref Vector2D value2, out Vector2D result)
Vector2D(double x, double y)
static void Reflect(ref Vector2D vector, ref Vector2D normal, out Vector2D result)
static void Multiply(ref Vector2D value1, ref Vector2D value2, out Vector2D result)
static void Min(ref Vector2D value1, ref Vector2D value2, out Vector2D result)
static Vector2D SmoothStep(Vector2D value1, Vector2D value2, double amount)
static Vector2D Subtract(Vector2D value1, Vector2D value2)
override string ToString()
static Vector2D Multiply(Vector2D value1, double scaleFactor)
static void Max(ref Vector2D value1, ref Vector2D value2, out Vector2D result)
override int GetHashCode()
static double Clamp(double value, double min, double max)
static Vector2D operator+(Vector2D value1, Vector2D value2)
static void DistanceSquared(ref Vector2D value1, ref Vector2D value2, out double result)
static void Dot(ref Vector2D value1, ref Vector2D value2, out double result)
static void Barycentric(ref Vector2D value1, ref Vector2D value2, ref Vector2D value3, double amount1, double amount2, out Vector2D result)
static Vector2D operator-(Vector2D value)
static Vector2D Barycentric(Vector2D value1, Vector2D value2, Vector2D value3, double amount1, double amount2)
static void Add(ref Vector2D value1, ref Vector2D value2, out Vector2D result)
static double Hermite(double value1, double tangent1, double value2, double tangent2, double amount)
static void SmoothStep(ref Vector2D value1, ref Vector2D value2, double amount, out Vector2D result)
bool Equals(Vector2D other)
static void Normalize(ref Vector2D value, out Vector2D result)
static Vector2D Divide(Vector2D value1, double divider)
static Vector2D unitXVector
static Vector2D zeroVector
static void Clamp(ref Vector2D value1, ref Vector2D min, ref Vector2D max, out Vector2D result)
static void Divide(ref Vector2D value1, double divider, out Vector2D result)
static Vector2D Normalize(Vector2D value)
static void Multiply(ref Vector2D value1, double scaleFactor, out Vector2D result)
static Vector2D operator/(Vector2D value1, Vector2D value2)
static double SmoothStep(double value1, double value2, double amount)
static void CatmullRom(ref Vector2D value1, ref Vector2D value2, ref Vector2D value3, ref Vector2D value4, double amount, out Vector2D result)
static void Negate(ref Vector2D value, out Vector2D result)
string DebugDisplayString
static void Lerp(ref Vector2D value1, ref Vector2D value2, double amount, out Vector2D result)
static double Distance(Vector2D value1, Vector2D value2)
static double Lerp(double value1, double value2, double amount)
static Vector2D Add(Vector2D value1, Vector2D value2)
static void Hermite(ref Vector2D value1, ref Vector2D tangent1, ref Vector2D value2, ref Vector2D tangent2, double amount, out Vector2D result)
static Vector2D Hermite(Vector2D value1, Vector2D tangent1, Vector2D value2, Vector2D tangent2, double amount)
static Vector2D CatmullRom(Vector2D value1, Vector2D value2, Vector2D value3, Vector2D value4, double amount)
static readonly double DoubleEpsilon
static Vector2D Reflect(Vector2D vector, Vector2D normal)
static bool operator==(Vector2D value1, Vector2D value2)
override bool Equals(object obj)
static Vector2D unitVector
static Vector2D Negate(Vector2D value)
static Vector2D operator*(Vector2D value1, Vector2D value2)
static Vector2D Multiply(Vector2D value1, Vector2D value2)
static Vector2D Max(Vector2D value1, Vector2D value2)
static double DistanceSquared(Vector2D value1, Vector2D value2)
static Vector2D Clamp(Vector2D value1, Vector2D min, Vector2D max)
static Vector2D Divide(Vector2D value1, Vector2D value2)
static Vector2D Lerp(Vector2D value1, Vector2D value2, double amount)
static Vector2D unitYVector
static void Divide(ref Vector2D value1, ref Vector2D value2, out Vector2D result)
static double CatmullRom(double value1, double value2, double value3, double value4, double amount)
static Vector2D Min(Vector2D value1, Vector2D value2)
static void Distance(ref Vector2D value1, ref Vector2D value2, out double result)
static double Dot(Vector2D value1, Vector2D value2)
static bool operator!=(Vector2D value1, Vector2D value2)