You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// <summary>The degree of the polynomial</summary>
15
+
publicintDegree{get;}
16
+
17
+
/// <summary>Returns the component polynomial of the given axis/dimension</summary>
18
+
/// <param name="i">Index of axis/dimension. 0 = x. 1 = y, etc</param>
19
+
publicPolynomialthis[inti]{get;set;}
20
+
21
+
/// <summary>Gets the coefficient of the given degree</summary>
22
+
/// <param name="degree">The degree of the coefficient you want to get. For example, 0 will return the constant coefficient, 3 will return the cubic coefficient</param>
23
+
VGetCoefficient(intdegree);
24
+
25
+
/// <summary>Sets the coefficient of the given degree</summary>
26
+
/// <param name="degree">The degree of the coefficient you want to set. For example, 0 will return the constant coefficient, 3 will return the cubic coefficient</param>
27
+
/// <param name="value">The value to set it to</param>
28
+
publicvoidSetCoefficient(intdegree,Vvalue);
29
+
30
+
/// <summary>Evaluates the polynomial at the given value <c>t</c></summary>
31
+
/// <param name="t">The value to sample at</param>
32
+
publicVEval(floatt);
33
+
34
+
/// <summary>Evaluates the <c>n</c>:th derivative of the polynomial at the given value <c>t</c></summary>
35
+
/// <param name="t">The value to sample at</param>
36
+
/// <param name="n">The derivative to evaluate</param>
37
+
publicVEval(floatt,intn);
38
+
39
+
/// <summary>Differentiates this function, returning the n-th derivative of this polynomial</summary>
40
+
/// <param name="n">The number of times to differentiate this function. 0 returns the function itself, 1 returns the first derivative</param>
41
+
publicPDifferentiate(intn=1);
42
+
43
+
/// <summary>Scales the parameter space by a factor. For example, the output of the polynomial in the input interval [0 to 1] will now be in the range [0 to factor]</summary>
44
+
/// <param name="factor">The factor to scale the input parameters by</param>
45
+
publicPScaleParameterSpace(floatfactor);
46
+
47
+
/// <summary>Given an inner function g(x), returns f(g(x))</summary>
48
+
/// <param name="g0">The constant coefficient of the inner function g(x)</param>
49
+
/// <param name="g1">The linear coefficient of the inner function g(x)</param>
/// <summary>Get or set the coefficient of the given degree</summary>
35
-
/// <param name="degree">The degree of the coefficient you want to get/set. For example, 0 will return the constant coefficient, 3 will return the cubic coefficient</param>
36
-
publicfloatthis[intdegree]{
37
-
get=>
38
-
degreeswitch{
39
-
0=>c0,
40
-
1=>c1,
41
-
2=>c2,
42
-
3=>c3,
43
-
_ =>thrownewIndexOutOfRangeException("Polynomial coefficient degree/index has to be between 0 and 3")
44
-
};
45
-
set{
46
-
_=degreeswitch{
47
-
0=>c0=value,
48
-
1=>c1=value,
49
-
2=>c2=value,
50
-
3=>c3=value,
51
-
_ =>thrownewIndexOutOfRangeException("Polynomial coefficient degree/index has to be between 0 and 3")
/// <summary>Scales the parameter space by a factor. For example, the output in the interval [0 to 1] will now be in the range [0 to factor]</summary>
206
-
/// <param name="factor">The factor to scale the input parameters by</param>
207
-
publicPolynomialScaleParameterSpace(floatfactor){
208
-
// ReSharper disable once CompareOfFloatsByEqualityOperator
209
-
if(factor==1f)
210
-
returnthis;
211
-
floatfactor2=factor*factor;
212
-
floatfactor3=factor2*factor;
213
-
returnnewPolynomial(
214
-
c0,
215
-
c1/factor,
216
-
c2/factor2,
217
-
c3/factor3
218
-
);
219
-
}
220
234
221
235
/// <summary>Splits the 0-1 range into two distinct polynomials at the given parameter value u, where both new curves cover the same total range with their individual 0-1 ranges</summary>
222
236
/// <param name="u">The parameter value to split at</param>
@@ -482,15 +496,15 @@ public override string ToString() {
0 commit comments