1
0
Fork 0

Use already calculated LaRCsim values to create the roll/pitch/yaw

transformation matrix (we call it LOCAL)
This commit is contained in:
curt 1998-04-25 22:04:53 +00:00
parent e42e007619
commit d4c9d9cbb3

View file

@ -83,27 +83,53 @@ void fgViewUpdate(fgFLIGHT *f, struct fgVIEW *v, fgLIGHT *l) {
v->view_pos.x, v->view_pos.y, v->view_pos.z); v->view_pos.x, v->view_pos.y, v->view_pos.z);
// Derive the LOCAL aircraft rotation matrix (roll, pitch, yaw) // Derive the LOCAL aircraft rotation matrix (roll, pitch, yaw)
MAT3_SET_VEC(vec, 0.0, 0.0, 1.0); // from FG_T_local_to_body[3][3]
MAT3rotate(R, vec, FG_Phi);
// printf("Roll matrix\n");
// MAT3print(R, stdout);
MAT3_SET_VEC(vec, 0.0, 1.0, 0.0); // Question: Why is the LaRCsim matrix arranged so differently
// MAT3mult_vec(vec, vec, R); // than the one we need???
MAT3rotate(TMP, vec, FG_Theta); LOCAL[0][0] = FG_T_local_to_body_33;
// printf("Pitch matrix\n"); LOCAL[0][1] = -FG_T_local_to_body_32;
// MAT3print(TMP, stdout); LOCAL[0][2] = -FG_T_local_to_body_31;
MAT3mult(R, R, TMP); LOCAL[0][3] = 0.0;
LOCAL[1][0] = -FG_T_local_to_body_23;
LOCAL[1][1] = FG_T_local_to_body_22;
LOCAL[1][2] = FG_T_local_to_body_21;
LOCAL[1][3] = 0.0;
LOCAL[2][0] = -FG_T_local_to_body_13;
LOCAL[2][1] = FG_T_local_to_body_12;
LOCAL[2][2] = FG_T_local_to_body_11;
LOCAL[2][3] = 0.0;
LOCAL[3][0] = LOCAL[3][1] = LOCAL[3][2] = LOCAL[3][3] = 0.0;
LOCAL[3][3] = 1.0;
printf("LaRCsim LOCAL matrix\n");
MAT3print(LOCAL, stdout);
MAT3_SET_VEC(vec, 1.0, 0.0, 0.0); #ifdef OLD_LOCAL_TO_BODY_CODE
// MAT3mult_vec(vec, vec, R); // old code to calculate LOCAL matrix calculated from Phi,
// MAT3rotate(TMP, vec, FG_Psi - FG_PI_2); // Theta, and Psi (roll, pitch, yaw)
MAT3rotate(TMP, vec, -FG_Psi);
// printf("Yaw matrix\n"); MAT3_SET_VEC(vec, 0.0, 0.0, 1.0);
// MAT3print(TMP, stdout); MAT3rotate(R, vec, FG_Phi);
MAT3mult(LOCAL, R, TMP); /* printf("Roll matrix\n"); */
// printf("LOCAL matrix\n"); /* MAT3print(R, stdout); */
// MAT3print(LOCAL, stdout);
MAT3_SET_VEC(vec, 0.0, 1.0, 0.0);
/* MAT3mult_vec(vec, vec, R); */
MAT3rotate(TMP, vec, FG_Theta);
/* printf("Pitch matrix\n"); */
/* MAT3print(TMP, stdout); */
MAT3mult(R, R, TMP);
MAT3_SET_VEC(vec, 1.0, 0.0, 0.0);
/* MAT3mult_vec(vec, vec, R); */
/* MAT3rotate(TMP, vec, FG_Psi - FG_PI_2); */
MAT3rotate(TMP, vec, -FG_Psi);
/* printf("Yaw matrix\n");
MAT3print(TMP, stdout); */
MAT3mult(LOCAL, R, TMP);
printf("FG derived LOCAL matrix\n");
MAT3print(LOCAL, stdout);
#endif // OLD_LOCAL_TO_BODY_CODE
// Derive the local UP transformation matrix based on *geodetic* // Derive the local UP transformation matrix based on *geodetic*
// coordinates // coordinates
@ -174,6 +200,10 @@ void fgViewUpdate(fgFLIGHT *f, struct fgVIEW *v, fgLIGHT *l) {
// $Log$ // $Log$
// Revision 1.4 1998/04/25 22:04:53 curt
// Use already calculated LaRCsim values to create the roll/pitch/yaw
// transformation matrix (we call it LOCAL)
//
// Revision 1.3 1998/04/25 20:24:02 curt // Revision 1.3 1998/04/25 20:24:02 curt
// Cleaned up initialization sequence to eliminate interdependencies // Cleaned up initialization sequence to eliminate interdependencies
// between sun position, lighting, and view position. This creates a // between sun position, lighting, and view position. This creates a
@ -205,7 +235,7 @@ void fgViewUpdate(fgFLIGHT *f, struct fgVIEW *v, fgLIGHT *l) {
// Added a view record field for absolute x, y, z position. // Added a view record field for absolute x, y, z position.
// //
// Revision 1.11 1998/01/27 00:47:58 curt // Revision 1.11 1998/01/27 00:47:58 curt
// Incorporated Paul Bleisch's <bleisch@chromatic.com> new debug message // Incorporated Paul Bleisch's <pbleisch@acm.org> new debug message
// system and commandline/config file processing code. // system and commandline/config file processing code.
// //
// Revision 1.10 1998/01/19 19:27:09 curt // Revision 1.10 1998/01/19 19:27:09 curt