Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to calculate cylinder "top" circle center, given the angles of rotation?

I have a cylinder of 2f length, and the data for RotX and RotZ, given by user. I also know that the "bottom" of my cylinder is at (0,0,0) (the center of the circle forming the "bottom")

What I need is to calculate the "top" point (the center of the circle at the other end) having the data exposed in the upper lines.

In my second image, the A point is calculated as follows (sin(zAngle),cos(zAngle),sin(xAngle) with zAngle=PI/4 (alpha angle) and xAngle=0.
Point B is calculated as (sin(xAngle),cos(xAngle),sin(zAngle)) with xAngle=PI/4 (beta angle) and zAngle=0;
C point is the "top" of a cylinder with xAngle=PI/4 and zAngle=PI/4.
I need to find an algorithm to determine the "top" point for any given xAngle and zAngle.

I'd be extremly thankful if anyone could help me.

RotZ and RotX explainedExample

like image 433
Mihai Bujanca Avatar asked Nov 03 '12 13:11

Mihai Bujanca


People also ask

What is the formula for angle of rotation?

The angle of rotation is the amount of rotation and is the angular analog of distance. The angle of rotation Δθ is the arc length divided by the radius of curvature. Δθ=Δsr. The angle of rotation is often measured by using a unit called the radian. (

What is the center of rotation?

The center of rotation is a point about which a plane figure rotates. This point does not move during the rotation.


1 Answers

Before your rotations, the top is at 2f*(0,1,0).

After you rotate the cylinder around the z axis by angle alpha, the top is at 2f*(sin alpha, cos alpha, 0).

If you now rotate the cylinder by angle beta around the x axis, the top goes to 2f*(sin alpha, cos alpha*cos beta, cos alpha*sin beta).

like image 166
nasenbohrer Avatar answered Nov 04 '22 01:11

nasenbohrer