Linear Transformation

For posts concerning the documentation, errors, ommissions, general comments, etc.

Moderators: silvia, selimgunay, Moderators

Post Reply
m12s12sa
Posts: 25
Joined: Mon Mar 05, 2012 1:49 pm
Location: Padova

Linear Transformation

Post by m12s12sa » Mon Mar 24, 2014 3:13 am

I found two slight differences between what I see in the source code and what is documented in the Wiki concerning Linear Transformation. Here is an excerpt from the Wiki (http://opensees.berkeley.edu/wiki/index ... sformation):
The x-axis along with the vecxz Vector define the xz plane. The local y-axis is defined by taking the cross product of the x-axis vector and the vecxz vector (Vy = Vx X Vxz). The local z-axis is then found simply by taking the cross product of the y-axis and x-axis vectors (Vz = Vy X Vx).

Here is the source code ( http://opensees.berkeley.edu/WebSVN/fil ... ansf3d.cpp ):
LinearCrdTransf3d::getLocalAxes(Vector &XAxis, Vector &YAxis, Vector &ZAxis)
{
// Compute y = v cross x
// Note: v(i) is stored in R[2][i]
static Vector vAxis(3);
vAxis(0) = R[2][0]; vAxis(1) = R[2][1]; vAxis(2) = R[2][2];

static Vector xAxis(3);
xAxis(0) = R[0][0]; xAxis(1) = R[0][1]; xAxis(2) = R[0][2];
XAxis(0) = xAxis(0); XAxis(1) = xAxis(1); XAxis(2) = xAxis(2);

static Vector yAxis(3);
yAxis(0) = vAxis(1)*xAxis(2) - vAxis(2)*xAxis(1);
yAxis(1) = vAxis(2)*xAxis(0) - vAxis(0)*xAxis(2);
yAxis(2) = vAxis(0)*xAxis(1) - vAxis(1)*xAxis(0);

double ynorm = yAxis.Norm();

if (ynorm == 0) {
opserr << "\nLinearCrdTransf3d::getLocalAxes";
opserr << "\nvector v that defines plane xz is parallel to x axis\n";
return -3;
}

yAxis /= ynorm;

YAxis(0) = yAxis(0); YAxis(1) = yAxis(1); YAxis(2) = yAxis(2);

// Compute z = x cross y
static Vector zAxis(3);

zAxis(0) = xAxis(1)*yAxis(2) - xAxis(2)*yAxis(1);
zAxis(1) = xAxis(2)*yAxis(0) - xAxis(0)*yAxis(2);
zAxis(2) = xAxis(0)*yAxis(1) - xAxis(1)*yAxis(0);
ZAxis(0) = zAxis(0); ZAxis(1) = zAxis(1); ZAxis(2) = zAxis(2);

// Fill in transformation matrix
R[1][0] = yAxis(0);
R[1][1] = yAxis(1);
R[1][2] = yAxis(2);

R[2][0] = zAxis(0);
R[2][1] = zAxis(1);
R[2][2] = zAxis(2);

return 0;
}

So it appears to me (but I may be wrong) that the wiki inverts the vectors in the two operations (and by inverting both of them the result is still somewhat correct, but that's not the point - it would be clearer if the wiki says exactly what the source code does):
1) the local y-axis is defined by taking the cross product of the vecxz vector and the x-axis vector (Vy = Vxz X Vx)
2) the local z-axis is then found simply by taking the cross product of the x-axis and y-axis vectors (Vz = Vx X Vz)
This interpretation would make much more sense also in consideration of standard the right-hand rule (Vz is indeed given by Vx cross Vy , etc.).

If my observation is correct you could simply edit the wiki page (I would do it myself, provided that what I said is correct, but I am not enabled to edit the Wiki).

Kind regards,
FL
m12s12sa
-FL-

m12s12sa
Posts: 25
Joined: Mon Mar 05, 2012 1:49 pm
Location: Padova

Re: Linear Transformation

Post by m12s12sa » Tue Jul 01, 2014 5:46 am

To anyone who might read my previous comment, the article has been corrected in the wiki.
Regards,
FL
m12s12sa
-FL-

auneng
Posts: 5
Joined: Sat Nov 08, 2014 1:50 am
Contact:

Re: Linear Transformation

Post by auneng » Wed Nov 12, 2014 2:46 am

i noticed that

Post Reply