58 return (right - left) * amount + left;
62 result = (right - left) * amount + left;
67 Scalar amountSq = amount * amount;
68 Scalar amountCu = amountSq * amount;
70 0.5f * ((2 * value2) +
71 (-value1 + value3) * amount +
72 (2 * value1 - 5 * value2 + 4 * value3 - value4) * amountSq +
73 (-value1 + 3 * value2 - 3 * value3 + value4) * amountCu);
77 Scalar amountSq = amount * amount;
78 Scalar amountCu = amountSq * amount;
80 0.5f * ((2 * value2) +
81 (-value1 + value3) * amount +
82 (2 * value1 - 5 * value2 + 4 * value3 - value4) * amountSq +
83 (-value1 + 3 * value2 - 3 * value3 + value4) * amountCu);
88 Scalar wf2 = amount * amount;
92 h1 = wf3t2 - wf2t3 + 1;
94 h3 = wf3 - 2 * wf2 + amount;
100 Hermite(ref value1, ref tangent1, ref value2, ref tangent2, amount, out result);
107 result = h1 * value1 + h2 * value2 + h3 * tangent1 + h4 * tangent2;
113 return (value < min) ? (min) : ((value > max) ? (max) : (value));
117 result = (value < min) ? (min) : ((value > max) ? (max) : (value));
145 if (min <= value && value < max) {
return value; }
146 Scalar rem = (value - min) % (max - min);
147 return rem + ((rem < 0) ? (max) : (min));
158 if (min <= value && value < max) { result = value;
return; }
159 Scalar rem = (value - min) % (max - min);
160 result = rem + ((rem < 0) ? (max) : (min));
166 if (-
Pi <= angle && angle <
Pi) {
return angle; }
168 return rem + ((rem < 0) ? (
Pi) : (-
Pi));
172 if (-
Pi <= angle && angle <
Pi) {
return; }
174 angle = rem + ((rem < 0) ? (
Pi) : (-
Pi));
178 if (-
Pi <= angle && angle <
Pi) { result = angle;
return; }
180 result = rem + ((rem < 0) ? (
Pi) : (-
Pi));
189 result = angle1 - angle2;
210 c = (b * b) - (4 * a * c);
215 plus = ((c - b) * a);
216 minus = ((-c - b) * a);
225 return 1 /
Sqrt(number);
230 if (vals ==
null) {
throw new ArgumentNullException(
"vals"); }
231 if (vals.Length == 0) {
throw new ArgumentException(
"There must be at least one value to compare",
"vals"); }
233 if (
Scalar.IsNaN(max)) {
return max; }
234 for (
int i = 1; i < vals.Length; i++)
237 if (val > max) { max = val; }
238 else if (
Scalar.IsNaN(val)) {
return val; }
244 if (vals ==
null) {
throw new ArgumentNullException(
"vals"); }
245 if (vals.Length == 0) {
throw new ArgumentException(
"There must be at least one value to compare",
"vals"); }
247 if (
Scalar.IsNaN(min)) {
return min; }
248 for (
int i = 1; i < vals.Length; i++)
251 if (val < min) { min = val; }
252 else if (
Scalar.IsNaN(val)) {
return val; }
264 bool bClockwise = temp >= 0;
268 if (temp < 0 ^ bClockwise) {
return true; }
272 return temp < 0 ^ bClockwise;
296 #region System.Math Methods
static void Hermite(ref Scalar value1, ref Scalar tangent1, ref Scalar value2, ref Scalar tangent2, Scalar amount, out Scalar result)
static Scalar Clamp(Scalar value, Scalar min, Scalar max)
static bool PointInTri2D(Vector2D point, Vector2D a, Vector2D b, Vector2D c)
static void CatmullRom(ref Scalar value1, ref Scalar value2, ref Scalar value3, ref Scalar value4, Scalar amount, out Scalar result)
static Scalar Cosh(Scalar value)
static Scalar Acos(Scalar d)
static Scalar Cos(Scalar d)
static Scalar Atan2(Scalar y, Scalar x)
static Scalar Pow(Scalar x, Scalar y)
static Scalar Tanh(Scalar value)
static Scalar Floor(Scalar d)
static void WrapClamp(ref Scalar value, ref Scalar min, ref Scalar max, out Scalar result)
Clamps a value between 2 values, but wraps the value around. So that one plus max would result in one...
static Scalar Ceiling(Scalar a)
static Scalar Max(params Scalar[] vals)
static bool TrySolveQuadratic(Scalar a, Scalar b, Scalar c, out Scalar plus, out Scalar minus)
Trys to Solve for x in the equation: (a * (x * x) + b * x + c == 0)
static Scalar Hermite(Scalar value1, Scalar tangent1, Scalar value2, Scalar tangent2, Scalar amount)
static Scalar AngleSubtract(Scalar angle1, Scalar angle2)
static void Sort(Scalar value1, Scalar value2, out Scalar max, out Scalar min)
static Scalar Sin(Scalar a)
static Scalar Lerp(Scalar left, Scalar right, Scalar amount)
static void ClampAngle(ref Scalar angle, out Scalar result)
static Scalar Min(params Scalar[] vals)
static Scalar Atan(Scalar d)
static Scalar Round(Scalar a)
static void Lerp(ref Scalar left, ref Scalar right, ref Scalar amount, out Scalar result)
static void ClampAngle(ref Scalar angle)
static Scalar Sinh(Scalar value)
static Scalar ToRadians(Scalar degrees)
Converts degrees to radians.
static Scalar Log(Scalar d)
static Scalar InvSqrt(Scalar number)
static Scalar Round(Scalar value, int digits)
static Scalar Tan(Scalar a)
static Scalar CatmullRom(Scalar value1, Scalar value2, Scalar value3, Scalar value4, Scalar amount)
static Scalar Sqrt(Scalar d)
static void Clamp(ref Scalar value, ref Scalar min, ref Scalar max, out Scalar result)
static Scalar Log10(Scalar d)
const Scalar RadiansPerDegree
static Scalar ToDegrees(Scalar radians)
Converts radians to degrees.
static void HermiteHelper(Scalar amount, out Scalar h1, out Scalar h2, out Scalar h3, out Scalar h4)
static Scalar IEEERemainder(Scalar x, Scalar y)
const Scalar ThreePiOver2
const Scalar DegreesPerRadian
static Scalar ClampAngle(Scalar angle)
static Scalar Asin(Scalar d)
static Scalar WrapClamp(Scalar value, Scalar min, Scalar max)
Clamps a value between 2 values, but wraps the value around. So that one plus max would result in one...
static void AngleSubtract(ref Scalar angle1, ref Scalar angle2, out Scalar result)
static Scalar Exp(Scalar d)
This is the Vector Class.
static Vector2D Subtract(Vector2D left, Vector2D right)
Subtracts 2 Vector2Ds.
static Scalar ZCross(Vector2D left, Vector2D right)
Does a "2D" Cross Product also know as an Outer Product.