My question is similar to How to Make a Point Orbit a Line, 3D but the answer there didn't seem to solve my problem. And what I am looking for is a general solution.
For the record I am trying to solve an issue in OpenGL ES (Java/Android).
I have a circle with a 3D point for its center, a radius, and a 3D vector specifying the normal to the plane the circle lies in.
I need to find the 3D point representing the point on the circumference at a given angle from the 'rotated' X-axis (rotated according to the normal vector).
I already have an implementation in a Circle
class of a member function, pointAt
, which works under limited circumstances. Specifically, in my current implementation I assume the circle lies in the X-Y plane and return a point accordingly and then, since I know the circle is actually lying in the X-Z plane I simply swap the Y and Z values in the returned point and it works. However, this is not a general solution and that is what I am going to need.
When I tried the algorithm given in How to Make a Point Orbit a Line, 3D, I got points pretty far removed from where they should have been.
So, how, can I calculate a point on the circumference of such a circle?
[Edit]
I guess my explanation wasn't sufficient. My assumption is that a circle is 'normally' in the X-Y plane with a normal vector of (0, 0, 1) - 1 in the Z direction. If a point on the circumference is needed the point is defined by:
x = R*cos(a) + Cx
y = R*sin(a) + Cy
where R
is the radius, Cx
and Cy
are the X
and Y
coordinates of the center of the circle, and a
is the angle from a vector through the circle's center point and parallel with the X-axis.
Now, if the circle doesn't have a normal vector pointing along the Z-axis but, instead, is some arbitrary (x, y, z) vector, how do I find that same point?
See Question&Answers more detail:
os