The basic lerp part was fine, P(t) = (1-t)*P0 + t*P1, done in like two minutes.
Start by writing the simple linear interpolation function for two points, then systematically extend it to a polyline by mapping the global parameter t to the correct segment and local parameter. Discuss edge cases like t outside [0,1] (clamping vs. extrapolation) and numerical precision issues (floating-point errors, epsilon comparisons), emphasizing robustness and clarity.
Pro tip: Demonstrate awareness of real-world ML applications: interpolation is used in animation, trajectory prediction, and data augmentation, so mention how your implementation handles edge cases to avoid silent failures in production.
Write a function that takes two 3D points and a parameter t, returning the point (1-t)*P0 + t*P1. Use vector operations for clarity and efficiency.
For a polyline of N points (N-1 segments), map the global t to a segment index and local t. If t is in [0,1], compute the scaled position along the total length or uniformly per segment, then interpolate within that segment.
Decide whether to clamp t to [0,1] (common for animation) or allow extrapolation (e.g., for prediction). Explain the trade-offs and implement accordingly, ensuring the function behaves predictably.
Use epsilon comparisons when checking t bounds or segment indices to avoid floating-point errors. Consider using double precision and stable formulas to minimize error accumulation.
Mention alternative parameterizations (e.g., by arc length vs. uniform segments) and their impact on interpolation quality. Highlight when to use each based on application needs.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.