TorsionImpulseCurve MakeTorsionImpulseCurve(List <float> impulses, List <float> arcPoints, List <float> curvatureList, List <float> torsionList) { Debug.Log("Arc length of DC = " + ArcLength); Vector3 startingNormal = Vector3.Cross(startingBinormal, startingTangent); OrthonormalFrame startFrame = new OrthonormalFrame(startingTangent, startingNormal, startingBinormal); List <float> arcSteps = new List <float>(); for (int i = 0; i < arcPoints.Count - 1; i++) { arcSteps.Add(arcPoints[i + 1] - arcPoints[i]); } GameObject obj = new GameObject(); obj.name = "TorsionApproxCurve"; TorsionImpulseCurve impulseCurve = obj.AddComponent <TorsionImpulseCurve>(); impulseCurve.InitFromData(impulses, arcSteps, curvatureList, torsionList, startFrame, StartingPoint); impulseCurve.SetMaterial(lineRender.material); return(impulseCurve); }
TorsionImpulseCurve MakeTorsionImpulseCurve(List <float> impulses, List <float> arcPoints, float constTorsion) { float averageCurvature = AverageCurvature(); Vector3 startingNormal = Vector3.Cross(startingBinormal, startingTangent); OrthonormalFrame startFrame = new OrthonormalFrame(startingTangent, startingNormal, startingBinormal); List <float> arcSteps = new List <float>(); for (int i = 0; i < arcPoints.Count - 1; i++) { arcSteps.Add(arcPoints[i + 1] - arcPoints[i]); } GameObject obj = new GameObject(); obj.name = "TorsionApproxCurve"; TorsionImpulseCurve impulseCurve = obj.AddComponent <TorsionImpulseCurve>(); impulseCurve.InitFromData(impulses, arcSteps, averageCurvature, constTorsion, startFrame, StartingPoint); impulseCurve.SetMaterial(lineRender.material); impulseCurve.BulbShrinkRatio = ActualShrinkRatio; return(impulseCurve); }