sample method

List<Vector3> sample(
  1. int count, {
  2. bool evenlySpaced = false,
})

Returns count points along the curve.

With evenlySpaced the points are spaced by equal arc length; otherwise they are spaced by equal natural parameter. count must be at least two.

Implementation

List<Vector3> sample(int count, {bool evenlySpaced = false}) {
  if (count < 2) {
    throw ArgumentError.value(count, 'count', 'must be at least two');
  }
  final total = length;
  return <Vector3>[
    for (var i = 0; i < count; i++)
      if (evenlySpaced)
        positionAtDistance(i / (count - 1) * total)
      else
        positionAt(i / (count - 1)),
  ];
}