Find Evenly Spaced Samples Over An Aribtrary Arc

I would like to create a fan located at a specific vector and point at another vector. Then a number of samples should scatter evenly spaced and evenly distributed over that arc. How do I find these samples? I know all paramters (length of the cone, angle, source vector and target, and number of samples).

Any help/hint would be greatly appreciated.

1 Answer

1
  1. Create two vectors going from the point of the fan to each end of the fan.

  2. Use Vector2.Angle() to figure out the angle between the two vectors.

  3. Calculate the angle of rotation to place each item. If you have n items to place, your delta angle will be total angle divided by n-1.

  4. Figure out the axis of rotation. If the two vectors are arbitrary, you can use Vector3.Cross() to calculate the axis.

  5. Create a rotation representing the delta_angle rotation around using Quaternon.AngleAxis() using the axis from step 4.

  6. To actually place the items, start with the first vector from step 1 and in a loop:

    pos = fan_point + qRot * v3Start;

…where ‘fan_point’ is the point of the fan, qRot is the rotation calculated in step 5, and v3Start the first vector from step 1,

Thank you for the sample code. I will use it to solve this issue.