21 new float[] {-1f/6f, 1f/2.0f, -1f/2f, 1f/6f},
22 new float[] { 1f/2f, -1f, 1f/2f, 0f},
23 new float[] {-1f/2f, 0f, 1f/2f, 0f},
24 new float[] { 1f/6f, 2f/3f, 1f/6f, 0f}
30 new int[] {1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
31 new int[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10},
32 new int[] {0, 1, 3, 6, 10, 15, 21, 28, 36, 45},
33 new int[] {0, 0, 1, 4, 10, 20, 35, 56, 84, 120},
34 new int[] {0, 0, 0, 1, 5, 15, 35, 70, 126, 210},
35 new int[] {0, 0, 0, 0, 1, 6, 21, 56, 126, 252},
36 new int[] {0, 0, 0, 0, 0, 1, 7, 28, 84, 210},
37 new int[] {0, 0, 0, 0, 0, 0, 1, 8, 36, 120},
38 new int[] {0, 0, 0, 0, 0, 0, 0, 1, 9, 45},
39 new int[] {0, 0, 0, 0, 0, 0, 0, 0, 1, 10},
40 new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 1}
46 new float[] { 0f, 0f, 0f, 1f},
47 new float[] {0.001f, 0.01f, 0.1f, 1f},
48 new float[] {0.008f, 0.04f, 0.2f, 1f},
49 new float[] {0.027f, 0.09f, 0.3f, 1f},
50 new float[] {0.064f, 0.16f, 0.4f, 1f},
51 new float[] {0.125f, 0.25f, 0.5f, 1f},
52 new float[] {0.216f, 0.36f, 0.6f, 1f},
53 new float[] {0.343f, 0.49f, 0.7f, 1f},
54 new float[] {0.512f, 0.64f, 0.8f, 1f},
55 new float[] {0.729f, 0.81f, 0.9f, 1f},
56 new float[] { 1f, 1f, 1f, 1f}
66 new float[] { 0f, 0f, 1f, 0f},
67 new float[] {0.03f, 0.2f, 1f, 0f},
68 new float[] {0.12f, 0.4f, 1f, 0f},
69 new float[] {0.27f, 0.6f, 1f, 0f},
70 new float[] {0.48f, 0.8f, 1f, 0f},
71 new float[] {0.75f, 1.0f, 1f, 0f},
72 new float[] {1.08f, 1.2f, 1f, 0f},
73 new float[] {1.47f, 1.4f, 1f, 0f},
74 new float[] {1.92f, 1.6f, 1f, 0f},
75 new float[] {2.43f, 1.8f, 1f, 0f},
76 new float[] { 3f, 2f, 1f, 0f}
88 if((i <= MAX_BEZIER_ORDER) && (n <= MAX_BEZIER_ORDER))
89 return BinomialCoefTable[i][n-1];
96 return BinomialCoef(i,n) * Mathf.Pow(u,i) * Mathf.Pow(1-u, n-i);
105 s1 = i * Mathf.Pow(u, i-1) * Mathf.Pow(1-u, n-i);
110 s2 = -(n-i) * Mathf.Pow(u,i) * Mathf.Pow(1-u, n-i-1);
116 TVector =
new float[4];
117 DTVector =
new float[4];
122 bSplineCPoints =
new float[4][];
123 for(
int i=0; i<4; i++)
124 bSplineCPoints[i] =
new float[3];
127 for(
int i=0; i<4; i++)
128 m3[i] =
new float[3];
147 s += BSplineMatrix[i][k] * bSplineCPoints[k][j];
155 bSplineCPoints[n][0] = p.x;
156 bSplineCPoints[n][1] = p.y;
157 bSplineCPoints[n][2] = p.z;
163 p.x = bSplineCPoints[n][0];
164 p.y = bSplineCPoints[n][1];
165 p.z = bSplineCPoints[n][2];
171 for (
int i=0; i<3; i++) {
172 bSplineCPoints[0][i] = bSplineCPoints[1][i];
173 bSplineCPoints[1][i] = bSplineCPoints[2][i];
174 bSplineCPoints[2][i] = bSplineCPoints[3][i];
182 for (
int i=0; i<3; i++)
183 bSplineCPoints[n_dest][i] = bSplineCPoints[n_source][i];
195 s += TVectorTable[t][k] * m3[k][j];
209 TVector[i] = Mathf.Pow(t, 3-i);
214 s += TVector[k] * m3[k][j];
227 DTVector[i] = (3 - i) * Mathf.Pow(t, 2-i);
235 s += DTVector[k] * m3[k][j];
249 s += DTVectorTable[t][k] * m3[k][j];
271 public void Feval(
float t, out Vector3 p) {
278 public void Feval2(
float t, out Vector3 p) {
280 p.x = Mathf.Pow((1-t), 3)*m3[0][0] + (3*t*Mathf.Pow((1-t),2)*m3[1][0]) + (3*Mathf.Pow(t,2)*((1-t) *m3[2][0])) + (Mathf.Pow(t,3)*m3[3][0]);
281 p.y = Mathf.Pow((1-t), 3)*m3[0][1] + (3*t*Mathf.Pow((1-t),2)*m3[1][1]) + (3*Mathf.Pow(t,2)*((1-t) *m3[2][1])) + (Mathf.Pow(t,3)*m3[3][1]);
282 p.z = Mathf.Pow((1-t), 3)*m3[0][2] + (3*t*Mathf.Pow((1-t),2)*m3[1][2]) + (3*Mathf.Pow(t,2)*((1-t) *m3[2][2])) + (Mathf.Pow(t,3)*m3[3][2]);
286 public void Deval(
float t, out Vector3 d) {
void ShiftBSplineCPoints()
static int[][] BinomialCoefTable
void GetCPoint(int n, out Vector3 p)
void Deval(float t, out Vector3 d)
void BSplinePointI(int t)
static int MAX_BEZIER_ORDER
void CopyCPoints(int n_source, int n_dest)
int BinomialCoef(int i, int n)
void BSplineTangentI(int t)
float BersteinPol(int i, int n, float u)
static float[][] BSplineMatrix
void Feval2(float t, out Vector3 p)
void EvalTangent(float t)
static float[][] TVectorTable
void BSplinePoint(float t)
float DBersteinPol(int i, int n, float u)
void BSplineTangent(float t)
void InitParameters(bool t)
void SetCPoint(int n, Vector3 p)
void Feval(float t, out Vector3 p)
static float[][] DTVectorTable