Jump to content

x-alberto

Members
  • Posts

    41
  • Joined

  • Last visited

About x-alberto

  • Birthday 09/30/1969

Profile Information

  • Gender
    Male
  • Location
    Italy

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

x-alberto's Achievements

Newbie

Newbie (1/14)

  • Reacting Well Rare
  • Week One Done
  • One Month Later
  • One Year In

Recent Badges

1

Reputation

  1. I can confirm that. Within FreeTrackNoIR main window, select "Fake TrackIR" in the Game protocol combo. Then install Sandy Barbours' Pilot view and enable Track IR support. You will get a nice and smooth handling of all 6 degrees of freedom for you point of view.
  2. >The only shortcoming seems to be that FaceTrackNoIR cannot do sideways movement. Typical example when landing K&A's T-28 on the Nimitz as mentioned in Chip&Simon's blog, you need to be able to move sideways so you can see along the side of the nose. I haven't found a way to get FaceTrackNoIR to do this. Even though it has a "Roll" axis this is far from easy to get any satisfactory results from, and I've left Roll axis disabled. I really have to check that again (I am not currently on my gaming pc) but as far as I can remember you get the most out of FTNoIR by simulating the Track IR protocol and coupling it with Sandy's Pilot view.
  3. Hi I am currently using visual c for win, x-code for mac and gcc for lin. (I definitely see a point in using gizmo instead!) For my ongoing projects the number of transforms per frame is very limited so I will not probably move from my current implementation. In the near future, however, optimisation might matter and, moreover, learning new tricks is cool. I will follow your advice and will post my findings. Ciao Alberto
  4. Hi PhM, thank you for your comments and for the code. I will try to build a function using both your suggestions and the compound rotation matrix. I will investigate using SSE - do I understand corretly that this will require a small ASM fragment? Cheers Alberto
  5. transformed_x,transformed_y,transformed_z = matrix.transform3D( x,y,z, p,r,h ) I agree, one can easily apply the final translation in his own code...
  6. If you prefer a more compact code (possibly less readable), here is the resulting transformation matrix managing the three rotations in one single step: const double Myxz[3][3] = { { cos_H*cos_R + sin_H*sin_P*sin_R, -cos_H*sin_R + sin_H*sin_P*cos_R, sin_H*cos_P}, { cos_P*sin_R, cos_P*cos_R, -sin_P}, {-sin_H*cos_R + cos_H*sin_P*sin_R, sin_H*sin_R + cos_H*sin_P*cos_R, cos_H*cos_P}, };
  7. Hi Nik, you here? Actually Indi's job is (still) a few miles ahead of mine....
  8. glad to be helpful :-)
  9. Sometimes you need to perform cumbersome math just to to put an object into the right 3D place or, as for my specific case, to get the right relative position of two objects (from two different aircrafts). Suppose you need to know the coordinates of a point of a given aircraft (e.g.because you are actually going to draw an object in that precise point) What you have is the aircraft position (it's geometric center in x-plane local coordinates + heading, roll and pitch) and the offset of your point in aircraft coordinates. what you need is the point position (x,y,z in x-plane local coordinates) Transform3D (code below) will take as input: inLocalCoords: the offest of your object in acf coordinates inMap: the coordinates and angles of the aircraft and will pop out: outCoords: the coordinates of your object in x.plane "local" coordinates (Bottom line: Unless it's already there, this should really go into Gizmo) void Transform3D(const double inLocalCoords[3], /*acf coordinates*/ const double inMap[6], /*x, y, z, heading, pitch, roll (X-Plane has angles in degrees)*/ double outCoords[3]){ //http://en.wikipedia.org/wiki/Rotation_matrix //http://inside.mines.edu/~gmurray/ArbitraryAxisRotation/ArbitraryAxisRotation.html //Make constants easier to handle. //Put angles into radians. const double H_rad = -inMap[3]*DEG2RAD; //heading const double P_rad = inMap[4]*DEG2RAD; //pitch const double R_rad = -inMap[5]*DEG2RAD; //roll const double cos_H = cos(H_rad); const double sin_H = sin(H_rad); const double cos_P = cos(P_rad); const double sin_P = sin(P_rad); const double cos_R = cos(R_rad); const double sin_R = sin(R_rad); //Pitch rotation matrix const double Mx[3][3] = { { 1, 0, 0 }, { 0, cos_P, -sin_P }, { 0, sin_P, cos_P } }; //Heading rotation matrix const double My[3][3] = { { cos_H, 0, sin_H }, { 0, 1, 0 }, { -sin_H, 0, cos_H } }; //Roll rotation matrix const double Mz[3][3] = { { cos_R, -sin_R, 0 }, { sin_R, cos_R, 0 }, { 0, 0, 1 } }; //What we want is out = [Mx*My*Mz] * in //We will use three consequent multiplications //The _only_ correcy sequence is //Mz //Mx //My //otherwise you get garbage (see multiplication rules for matrices...) double step1[3]; double step2[3]; // step1 = Mz * in mmult(inLocalCoords, Mz, step1); // step2 = Mx * step1 mmult(step1, Mx, step2); // out = My * step2 mmult(step2, My, outCoords); /*Finally, apply translation*/ for(int i=0; i<3; i++) outCoords[i]+=inMap[i]; /* X, Y, Z*/ } void mmult(const double inX[3], const double R[3][3], double outX[3]){ for(int n=0; n<3; n++) outX[n]=0; for(int i=0; i<3; i++) for(int j=0; j<3; j++) outX[i] += R[i][j] * inX[j]; } edited: using the code tag a few missing indices just popped out again
×
×
  • Create New...