I am creating simulator for cnc milling machine using g-codes and m-codes etc.How to calculate circular interpolation and linear interpolations? I am using unity and C#.
Mathf.Lerp → Linear interpolation for a single float. Example:
Mathf.Lerp(currentValue, targetValue, lerpAmount);
Mathf.Slerp → Same, except will give you spherical interpolation.
For vectors (positions and directions), use Vector3.Lerp and Vector3.Slerp, and for rotations use Quaternion.Lerp and Quaternion.Slerp