protected IEnumerable <MarkupStyleDash> CalculateSolid(Bezier3 trajectory, int depth, Func <Bezier3, IEnumerable <MarkupStyleDash> > calculateDashes) { var deltaAngle = trajectory.DeltaAngle(); var direction = trajectory.d - trajectory.a; var length = direction.magnitude; if (depth < 5 && (deltaAngle > AngleDelta || length > MaxLength) && length >= MinLength) { trajectory.Divide(out Bezier3 first, out Bezier3 second); foreach (var dash in CalculateSolid(first, depth + 1, calculateDashes)) { yield return(dash); } foreach (var dash in CalculateSolid(second, depth + 1, calculateDashes)) { yield return(dash); } } else { foreach (var dash in calculateDashes(trajectory)) { yield return(dash); } } }
public BezierTrajectory(Bezier3 trajectory) { Trajectory = trajectory; Magnitude = (Trajectory.d - Trajectory.a).magnitude; DeltaAngle = Trajectory.DeltaAngle(); Direction = (Trajectory.d - Trajectory.a).normalized; StartDirection = (Trajectory.b - Trajectory.a).normalized; EndDirection = (Trajectory.c - Trajectory.d).normalized; }