Curve: difference between getPoint and getPointAt methods

Reading through the documentation here, I am struggling to understand the difference between the getPoint and getPointAt methods. If I understand correctly, getPointAt returns the position on the curve with respect to the curve’s total length as if it were a piece of string stretched out into a straight line. But then what does the getPoint method do? What is the difference between the parameters t and u?

1 Like

A curve is always sampled with values between 0 and 1. If you divide a curve into let’s say ten segments, you would sample the curve with 0.1, 0.2, 0.3 and so on. These are your t values.

Depending on the curve, the resulting curve segments can vary in their length since the gap between points might be very different. This becomes clear at the following example where the slope of the curve is high: see https://jsfiddle.net/a4jLs6rm/1/

image

To avoid this you can consider the actual length of the curve during the sampling. The u value is nothing else than a corrected version of t that will ensure equi-distant curve segments. https://jsfiddle.net/a4jLs6rm/2/

image

3 Likes

Very useful thank you.