Advanced Question Rotating docking port (spacecraft3)

Cizurator

Whooooosh!
Addon Developer
Joined
Jun 25, 2008
Messages
308
Reaction score
1
Points
0
Location
Velke Hamry, Czech Republic
Hi, I've encountered with an unexpected problem when i was setting docking ports on a new spacedock for United Systems Fleet.

The station is planned to have many docking ports around it's lower part.
The problem is, that none of them should be aimed exactly by X,Y or Z axis
like this:

[DOCK_0] ; dock1
DIR=(0,0,1)
ROT=(0,1,0)
POS=(150,-2600,960)


I need them to be aimed some angle to the right and left (rotated by Y axis around the station). For example the first docking port should be 9 degrees to the left. First I tried to change the DIR like this:

[DOCK_0] ; dock1
DIR=(-0.1,0,1)
ROT=(0,1,0)
POS=(150,-2600,960)

and many other combinations... but the docked ship sometimes gets deformed very strange way.

Would anybody be so kind to tell me how to rotate the docking port by Y axis, and - possibly - post an example for the 9 degree case ?

Thanks
 

martins

Orbiter Founder
Orbiter Founder
Joined
Mar 31, 2008
Messages
2,448
Reaction score
462
Points
83
Website
orbit.medphys.ucl.ac.uk
Look up the relationship between Euler angles and rotation matrices. Also look up Givens rotations in 3 dimensions, for a general idea about building rotation matrices around the principal axes.
 

Cizurator

Whooooosh!
Addon Developer
Joined
Jun 25, 2008
Messages
308
Reaction score
1
Points
0
Location
Velke Hamry, Czech Republic
In case my previous answer was too terse, here is one I answered earlier:

http://www.orbiter-forum.com/showthread.php?p=275376&postcount=9

For a rotation around y you want the last of the three rotation matrices (R3).


Unfortunately, this looks too complicated for me. My mathematical knowledge ends not very far behind (+-*/); those numbers in square brackets are looking quite scary (that's exactly why I chose to study history).

Of course I'm not asking straightly you, mr.Schweiger, but would ANYBODY be so kind to translate several angles into spacecraft3 docking ports?

If Orbiter gives limitation of 16 docking ports, it would be following eight:

X0° Y9° Z0°
X0° Y63° Z0°
X0° Y117° Z0°
X0° Y153° Z0°

X0° Y-27° Z0°
X0° Y-81° Z0°
X0° Y-135° Z0°
X0° Y-171° Z0°

They are intended to be flat in XZ and rotated by Y.

This is my last hope of creating those docking ports in hangars for USF ships...:cry: Who helps me with translating, will be surely written in credits!:facts:. (Mr. Schweiger will be there automatically:hailprobe:)
 

martins

Orbiter Founder
Orbiter Founder
Joined
Mar 31, 2008
Messages
2,448
Reaction score
462
Points
83
Website
orbit.medphys.ucl.ac.uk
Here is the translation into +-*/ (and sine/cosine, I'm afraid):

You want to rotate the "DIR" vector from d=(0,0,1) by some angle a around y to give a rotated vector d':

[math] d' = \left[\begin{array}{ccc} \cos a & 0 & -\sin a \\ 0 & 1 & 0 \\ \sin a & 0 & \cos a \end{array}\right] \left[\begin{array}{c} 0 \\ 0 \\ 1 \end{array}\right] = \left[\begin{array}{c} -\sin a \\ 0 \\ \cos a \end{array}\right] [/math]So for your first case (a = 9° = 0.15708 rad) you get your modified DIR vector as d'=(-0.1564,0,0.9877)
The other angles can be calculated accordingly.

Notes:
  • If you find that the rotation goes the wrong way, change the sign of the first component of your rotated DIR vector
  • The ROT vector remains unchanged at (0,1,0), since a vector pointing in y-direction is invariant against a rotation around y.
 
Top