Reputation: 1024
If I have three points, let's say:
start: (14.5, 10.1, 2.8)
end: (-12.3, 6.4, 7.7)
center: (0, 0, 0)
And the following additional information that has been determined:
Radius: 15
Center Angle: 109 degrees
Arc (from Pt A - Pt B): 29
How can I approach finding points along the arc between the starting and ending points?
Upvotes: 2
Views: 4119
Reputation: 882
UPDATE: Vectors are marked with a °.
The normal n° of the plane p in which the circle (or the arc) lies is
n° = cross product of start°, end°
p contains all points X° satisfying the equation
dot product of n° and X° = 0
// ^^^ This is only for completeness, you needn't calculate it.
Now we want two orthogonal unit vectors X°, Y° lying in p:
X° = start° / norm(start°)
Y° = cross_prod(n°, start°) / norm(cross_prod(n°, start°))
(where norm(X°) is sqrt(x[1]^2 + x[2]^2 + x[3]^2),
and by dividing a vector V° by a scalar S I mean dividing each vector component by S:
V° / S := (V°[1]/S, V°[2]/S, V°[3]/S)
)
In 2d coordinates, we could draw a circle with the parametrization
t -> 15*(cos(t), sin(t)) = 15*cos(t) * X° + 15*sin(t) * Y°
where X° = (1, 0) and Y° = (0, 1).
Now in 3d in plane p, having two orthogonal unit vectors X° and Y°, we can analogically do
t -> 15*cos(t) * X° + 15*sin(t) * Y°
where X°, Y° as defined before, and t goes from 0 to 109 degrees.
For t=0, we get point start°. For t=109, we should get end°. If that goes wrong, change Y° to -Y°. For t between 0 and 109, we get the arc between start° and end°.
Depending on your sin/cos implementation, you need to specify the angles in radians, not degrees.
Upvotes: 2