public static List <Point3D> GetBezierPoint(int index) { float acc = 0.0001f; Point3D p1 = new Point3D(); Point3D p2 = new Point3D(); Point3D p3 = new Point3D(); Point3D p4 = new Point3D(); if (index == 0) { p1 = Helix3dSim.movePaths[index].ptCurve[0].point; } else if (index == 1) { p1 = Helix3dSim.movePaths[index - 1].ptCurve[1].point; } else { p1 = Helix3dSim.movePaths[index - 1].ptCurve[0].point; } p2 = Helix3dSim.movePaths[index].ptAdjust[0].point; p3 = Helix3dSim.movePaths[index].ptAdjust[1].point; if (index == 0) { p4 = Helix3dSim.movePaths[index].ptCurve[1].point; } else { p4 = Helix3dSim.movePaths[index].ptCurve[0].point; } Point3D last_spawn = Bezier3D.GetPoint(p1, p2, p3, p4, 0); List <Point3D> allPoints = new List <Point3D>(); allPoints.Add(last_spawn); for (float t = acc; t <= 1.0f; t += acc) { Point3D trial = Bezier3D.GetPoint(p1, p2, p3, p4, t); if (GetDistance(trial, last_spawn) >= spacing) { last_spawn = trial; allPoints.Add(trial); } } return(allPoints); }
public static Point3D GetBezierPoint(int index, float t) { if (t >= 1f) { t = 1f; } if (t < 0) { t = 0; } Point3D p1 = new Point3D(); Point3D p2 = new Point3D(); Point3D p3 = new Point3D(); Point3D p4 = new Point3D(); if (index == 0) { p1 = Helix3dSim.movePaths[index].ptCurve[0].point; } else if (index == 1) { p1 = Helix3dSim.movePaths[index - 1].ptCurve[1].point; } else { p1 = Helix3dSim.movePaths[index - 1].ptCurve[0].point; } p2 = Helix3dSim.movePaths[index].ptAdjust[0].point; p3 = Helix3dSim.movePaths[index].ptAdjust[1].point; if (index == 0) { p4 = Helix3dSim.movePaths[index].ptCurve[1].point; } else { p4 = Helix3dSim.movePaths[index].ptCurve[0].point; } Point3D pt = new Point3D(); pt = Bezier3D.GetPoint(p1, p2, p3, p4, t); return(pt); }