Project Math problems with RPOS and RVEL

Albinon

Addon Developer
Addon Developer
Joined
Dec 21, 2008
Messages
46
Reaction score
0
Points
0
Location
Sacramento
I'm not sure, but I think you are confusing semi-minor axis with periapsis and semi-major axis with apoapsis.
You're right, I misspoke when I said r was semi-minor. I meant to say semi-major as it is both the periapsis and on one end of the semi-major assuming RPOS = (r,0,0) and RVEL = (0,0,v)

mat.mmul is two matrices multiplicated, mat.mul is a matrix multiplicated with a vector and mat.tmul is the transposed matrix multiplicated with a vector.
Great, more math home work... I was hoping to have the week-end free ;)

---------- Post added at 03:35 PM ---------- Previous post was at 09:21 AM ----------

mat.mmul is two matrices multiplicated, mat.mul is a matrix multiplicated with a vector and mat.tmul is the transposed matrix multiplicated with a vector.

Just a question: Why are your rotating around the X axis instead of the Z axis in your script? or does it matter?

Next question:
Using MMUL, TMUL and MUL, which is the 1st matrix (horizontal operator) and which is the second (vertical operator)?
 
Last edited:

indy91

Addon Developer
Addon Developer
Joined
Oct 26, 2011
Messages
1,226
Reaction score
592
Points
128
Hmm, not sure I understand your questions. There are a few rotations around different axes in the script and they all have to be like they are, I think.

For the multiplications here a function I used until I discovered that mat.mmul exists:

Code:
function matrixmult(a,b)
	local c = {	m11=a.m11*b.m11+a.m12*b.m21+a.m13*b.m31, m12=a.m11*b.m12+a.m12*b.m22+a.m13*b.m32, m13=a.m11*b.m13+a.m12*b.m23+a.m13*b.m33,
                        m21=a.m21*b.m11+a.m22*b.m21+a.m23*b.m31, m22=a.m21*b.m12+a.m22*b.m22+a.m23*b.m32, m23=a.m21*b.m13+a.m22*b.m23+a.m23*b.m33,
                        m31=a.m31*b.m11+a.m32*b.m21+a.m33*b.m31, m32=a.m31*b.m12+a.m32*b.m22+a.m33*b.m32, m33=a.m31*b.m13+a.m32*b.m23+a.m33*b.m33}
	return c
end

The numbers behind the m is the usual notation, that means the first number is the row and the second the column.

Of course the order matters, as it does in the matrix-vector product. So it is just the usual way to multiplicate matrices, respectively matrix with vector.
 

Albinon

Addon Developer
Addon Developer
Joined
Dec 21, 2008
Messages
46
Reaction score
0
Points
0
Location
Sacramento
Hmm, not sure I understand your questions.

Hard to explain with out a picture or a similar set of vocabulary ( I don't speak math or German- your English is very good, and your math is way beyond me), but I will try with the following; Which is the horizontal parameter in the MMUL statement- R2 or R3_W?

Horizontal - (x, y, z)

Vertical
x
y
z

Just re-read your posted code snippet and figured it out. Thanks!
 
Last edited:

indy91

Addon Developer
Addon Developer
Joined
Oct 26, 2011
Messages
1,226
Reaction score
592
Points
128
Once the masters of logic decided, that there is one right way to multiplicate matrices. When it says "mat.mmul(R2,R3_W)" the R2 is the first matrix, and R3_W is the second. In the function I posted earlier R2 would be a and R3_W would be b. So each element of the resulting matrix is calculated by using the corresponding horizontal elements of R2 and the vertical elements of R3_W.

The calculation does this: the velocity vector (v,0,0) with the desired velocity of a circular orbit is rotated three times: first around the true anomaly (the velocity vector is directly written in this form, so one matrix less is needed) then the longitude of the ascending node and then the inclination.

Edit: I saw too late that you have figured it out. Maybe my explanation is still helpful ;)
 

Albinon

Addon Developer
Addon Developer
Joined
Dec 21, 2008
Messages
46
Reaction score
0
Points
0
Location
Sacramento
Edit: I saw too late that you have figured it out. Maybe my explanation is still helpful ;)


Not a problem It just re-affirms the process. It is helpful as well. I'm still getting "sideways" with this matrix math....:confused: However you're helping me get it. I wish I had you and ADSWNJ as teachers back in the 70's when I was taking math.
 
Top