/// <summary> /// Get point on helix at around radian. /// </summary> /// <param name="topEllipse">Top ellipse args of curve.</param> /// <param name="bottomEllipse">Bottom ellipse args of curve.</param> /// <param name="maxRadian">Max around radian of helix.</param> /// <param name="radian">Around radian of helix.</param> /// <returns>The point on helix at around radian.</returns> public static Vector3 GetPointAt(EllipseArgs topEllipse, EllipseArgs bottomEllipse, float maxRadian, float radian) { if (maxRadian == 0) { maxRadian = Mathf.Epsilon; } return(Vector3.Lerp(EllipseCurve.GetPointAt(bottomEllipse, radian), EllipseCurve.GetPointAt(topEllipse, radian), radian / maxRadian)); }
/// <summary> /// Constructor. /// </summary> public EllipseCurve() { args = new EllipseArgs(); }
/// <summary> /// Get point on ellipse at around radian. /// </summary> /// <param name="args">Args of ellipse curve.</param> /// <param name="radian">Around radian of ellipse.</param> /// <returns>The point on ellipse at around radian.</returns> public static Vector3 GetPointAt(EllipseArgs args, float radian) { return(args.center + new Vector3(args.semiMinorAxis * Mathf.Cos(radian), 0, args.semiMajorAxis * Mathf.Sin(radian))); }
/// <summary> /// Constructor. /// </summary> /// <param name="args">Args of ellipse curve.</param> public EllipseCurve(EllipseArgs args) { this.args = args; }
/// <summary> /// Constructor. /// </summary> /// <param name="topEllipse">Top ellipse args of curve.</param> /// <param name="bottomEllipse">Bottom ellipse args of curve.</param> public HelixCurve(EllipseArgs topEllipse, EllipseArgs bottomEllipse) { this.topEllipse = topEllipse; this.bottomEllipse = bottomEllipse; }
/// <summary> /// Constructor. /// </summary> public HelixCurve() { topEllipse = new EllipseArgs(); bottomEllipse = new EllipseArgs(); }