2
$\begingroup$

I'm trying to find 2 vectors in a given circle (not a sphere). This circle can be at a random position, rotation.

Given the position, rotation, and radius of the circle, where the center position of the circle is (x, y, z) (where the center position is not the origin), and a rotation of (rx, ry, rz).

I'm able to find 3 points on the circle by using the following equation:

 xPos = x + radius * cos(angle);
 yPos = y + radius * sin(angle);
 zPos = z;

but this is only when the circle is flat on the ground (not rotated). So I'll need to rotate the circle using the equations given here. So I'll find 3 points, multiply them each element to their corresponding rotation matrix. And I can create 2 vectors given the 3 positions. I was wondering if my thought process was correct, or if I am missing something.

$\endgroup$
1
$\begingroup$

Your process will work, but it's not a very good way to do the calculation nor to think about the problem.

Here is an alternative: Multiply the three rotation matrices to get a single rotation matrix $\mathbf R$. Let $\mathbf u$ and $\mathbf v$ be the first and second columns of $\mathbf R$ respectively. Then $\mathbf u$ and $\mathbf v$ are the "local" $x$ and $y$ axes of the circle. So if the center of the circle is at the point $\mathbf c$, you can calculate points on the circle using: $$ \mathbf x(\theta) = \mathbf c + (r\cos\theta)\mathbf u + (r\sin\theta)\mathbf v $$ Depending on what convention you use for doing matrix multiplication to rotate points (pre-multiplication or post-multiplication), you may have to let $\mathbf u$ and $\mathbf v$ be the first and second rows of $\mathbf R$, instead of columns. Try both; one of them will work.

Here is a similar question about ellipses.

$\endgroup$
  • $\begingroup$ Why is my process not good? Is it because I'm doing additional calculations that I dont really need to? $\endgroup$ – dwnenr Nov 10 '15 at 2:56
  • $\begingroup$ Because multiplying by matrices requires far more computation than simple vector arithmetic, and it hides the geometry of the situation. $\endgroup$ – bubba Nov 10 '15 at 12:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.