public Vector4 GetUniformMeshPoint(float timeX, float timeY) { List <Vector4> pw = new List <Vector4>(); for (int y = 0; y < cpHeight; y++) { pw.Add(curves[y].GetUniformSplinePoint(timeX)); } // calculationally extraspensive argg. finalMeshCurve = new Curve_ForMeshBWTPrimitive(pw.ToArray(), _numOfCurvatureSegmentPoints, _closedControlPoints, _uniformedCurve, _numberOfIntigrationStepsPerSegment); return(finalMeshCurve.GetUniformSplinePoint(timeY)); }
private void CreateSpline(Vector4[] controlPoints) { cps = controlPoints; curves = new Curve_ForMeshBWTPrimitive[cpHeight]; for (int y = 0; y < cpHeight; y++) { List <Vector4> pw = new List <Vector4>(); for (int x = 0; x < cpWidth; x++) { var v = controlPoints[GetCpIndex(x, y)]; pw.Add(v); } curves[y] = new Curve_ForMeshBWTPrimitive(pw.ToArray(), _numOfCurvatureSegmentPoints, _closedControlPoints, _uniformedCurve, _numberOfIntigrationStepsPerSegment); } curveLinePoints = new Vector3[_numOfCurvatureSegmentPoints * _numOfCurvatureSegmentPoints]; var loopCount = _numOfCurvatureSegmentPoints; var divisor = loopCount - 1; // Create the curve either uniformed or non uniformed. if (_uniformedCurve) { for (int y = 0; y < loopCount; y++) { float ty = (float)(y) / (float)(divisor); for (int x = 0; x < loopCount; x++) { float tx = (float)(x) / (float)(divisor); int index = loopCount * y + x; curveLinePoints[index] = ToVector3(GetUniformMeshPoint(tx, ty)); } } } else { for (int y = 0; y < loopCount; y++) { float ty = (float)(y) / (float)(divisor); for (int x = 0; x < loopCount; x++) { float tx = (float)(x) / (float)(divisor); int index = loopCount * y + x; curveLinePoints[index] = ToVector3(GetNonUniformMeshPoint(tx, ty)); } } } }