[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 264: mysqli_fetch_assoc(): Couldn't fetch mysqli_result
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/mysqli.php on line 326: mysqli_free_result(): Couldn't fetch mysqli_result
Pete's QBASIC Site Discuss QBasic, Freebasic, QB64 and more 2005-12-04T12:19:41-05:00 http://www.petesqbsite.com/phpBB3/app.php/feed/topic/1224 2005-12-04T12:19:41-05:00 2005-12-04T12:19:41-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=9819#p9819 <![CDATA[Some help with rotations.]]>
http://rel.betterwebber.com/index.php?a ... =Tutorials

-The Awakened

Statistics: Posted by The Awakened — Sun Dec 04, 2005 12:19 pm


]]>
2005-12-04T05:51:02-05:00 2005-12-04T05:51:02-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=9815#p9815 <![CDATA[Some help with rotations.]]>
Your confusing yourself. Rotations are very easy to do when you just use the formulae... Take a look at the HAW (3D the Half Assed Way) tutorial on this site for an idiot proof tutorial :D , it covers simple rotations of wireframe models.

matt

Statistics: Posted by matt2jones — Sun Dec 04, 2005 5:51 am


]]>
2005-12-04T03:36:11-05:00 2005-12-04T03:36:11-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=9814#p9814 <![CDATA[Some help with rotations.]]>
Taking a look at this article over here:

http://www.delphi3d.net/articles/viewar ... iewing.htm

There are a few things I still need know.

In Fig. 2 in that article, first matrix on the 4th column, do I have to worry about the -x -y -z stuff? Also

Also on the 4th row and coloumn on two matrix which both equals 1, do I leave that alone?

On the second matrix, does the Rx, Ux, Vx etc mean R * x, U * x, V * x?

Last question, with the final rotate feature, which part on the second matrix do I use?

Sorry for the excessive amount of newbie questions.

Statistics: Posted by Guest — Sun Dec 04, 2005 3:36 am


]]>
2005-12-03T14:56:33-05:00 2005-12-03T14:56:33-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=9790#p9790 <![CDATA[Some help with rotations.]]> Statistics: Posted by Guest — Sat Dec 03, 2005 2:56 pm


]]>
2005-12-03T08:45:24-05:00 2005-12-03T08:45:24-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=9782#p9782 <![CDATA[Some help with rotations.]]>
You say it's "stuck in first person mode", what I think you mean by this is when you try and rotate the ship it moves off one side of the screen, goes behind you, and comes out the other side.

If that's the case, visualise this:

Code:

                                     *--------*           [Camera points->          | Ship   |                                         *--------*   
Now, when you rotate the ship 90 degress, what happens is:

Code:

                     *-*                     |p|                     |i|                     |h|                                         |S|                     *-*            [Camera points->                                                       
So the ship is rotating AROUND the camera, because the camera is at coords (0,0,0), the origin.

Almost all rotation formulae only work for rotating around the origin.

So, if you want the ship to revolve around the middle of itself, you have to move it so that the origin is in the middle of it. This is really easy, just find the coordinates of the middle of the ship, and subtract them from all the other points in the ship.

Then do your rotations. Now the ship will be rotated about it's middle, but it will look like this:

Code:

                       *-----------------*                         | p               |                       | i               |                       | h    [CAM]->    |                       | S               |                       *-----------------*  So you'll now be looking at the rotated ship from the inside.  You have to move it back to where is was originally to get the correct rotated view of it.  Doing that is easy, just add back to the coords of every point in the ship the values you subtracted from them in the first step.Recap:* Pick point to rotate around* Translate ship model so that point is a origin* Rotate Ship about origin* Translate ship model so that the middle point is back where it was* Draw the model.I hope this helps,matt

Statistics: Posted by matt2jones — Sat Dec 03, 2005 8:45 am


]]>
2005-12-03T01:08:26-05:00 2005-12-03T01:08:26-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=9778#p9778 <![CDATA[Some help with rotations.]]>
First one I posted this topic in the wrong sector.

Second one is that I forgot to tell that you need freebasic to use this code.

Statistics: Posted by Guest — Sat Dec 03, 2005 1:08 am


]]>
2005-12-03T01:06:01-05:00 2005-12-03T01:06:01-05:00 http://www.petesqbsite.com/phpBB3/viewtopic.php?p=9777#p9777 <![CDATA[Some help with rotations.]]>
Arrow Keys to X and Y rotate the ship.
E and Q rotates the model by Z axis.

The current problem I am facing atm is, the ship rolls as its either facing down or up. Making me assume that it's stuck in first person mode. What I wanted to do is, get the ship to be able to pitch up and down, turn left and right, and roll reguardless of what angle its at.

I tried Faster 3D Rotation by Eclipzer but it was a no go.

Heres the code:

Code:

#define SC_UP     &h48#define SC_LEFT   &h4B#define SC_RIGHT  &h4D#define SC_DOWN   &h50#define SC_Q &h10#define SC_E &h12#define pi  3.1415926535897932TYPE V3D    X as Single    Y as Single    Z as SingleEND TYPETYPE SimpleEnt    Rot as V3D    Coor as V3DEND TYPEType Edges    PointA as V3D    PointB as V3DEND TYPEDeclare SUB rotpt (x1!, y1!, z1!, rotx!, roty!, rotz!, nx!, ny!, nz!)Declare SUB Point3D (xA!, yA!, zA!, xP, yP, DST)CONST LENS = 384CONST CenterX=320CONST CenterY=240Dim ToyLine(36) as EdgesDim ToyVert(16) as V3DDim TempX, TempY, TempZ, RotPY, RotPX, RotPZ as SingleDim Dist, ProjX(2), ProjY(2), PrevX, PrevY as IntegerDIM TOM, EEE as IntegerFOR TOM=1 to 16    READ ToyVert(TOM).X    READ ToyVert(TOM).Z    READ ToyVert(TOM).Y    ToyVert(TOM).Z=-ToyVert(TOM).Z    ToyVert(TOM).Y=-ToyVert(TOM).YNEXT TOMFor TOM =1 to 36    READ StartPNT    READ EndPNT    ToyLine(TOM).PointA.X=ToyVert(StartPNT+1).X    ToyLine(TOM).PointA.Y=ToyVert(StartPNT+1).Y    ToyLine(TOM).PointA.Z=ToyVert(StartPNT+1).Z        ToyLine(TOM).PointB.X=ToyVert(EndPNT+1).X    ToyLine(TOM).PointB.Y=ToyVert(EndPNT+1).Y    ToyLine(TOM).PointB.Z=ToyVert(EndPNT+1).ZNext TOM    Screen 18RotPY!=0RotPX!=0RotPZ!=0 DOFOR EEE = 1 to 36    rotpt ToyLine(EEE).PointA.X,ToyLine(EEE).PointA.Y,ToyLine(EEE).PointA.Z,RotPX!,RotPY!,RotPZ!,TempX!,TempY!,TempZ!        Point3D TempX!, TempY!, TempZ!, ProjX(1), ProjY(1), Dist        rotpt ToyLine(EEE).PointB.X,ToyLine(EEE).PointB.Y,ToyLine(EEE).PointB.Z,RotPX!,RotPY!,RotPZ!,TempX!,TempY!,TempZ!        Point3D TempX!, TempY!, TempZ!, ProjX(2), ProjY(2), Dist        If Dist>0 Then        LINE (ProjX(1),ProjY(1))-(ProjX(2),ProjY(2)),15            END IF    NEXT EEESLEEP 1CLSLocate 5,5:Print "3D Wireframe Ship Test"if multikey(SC_LEFT) then        RotPY!=RotPY!+.005end ifif multikey(SC_Right) then        RotPY!=RotPY!-.005end ifif multikey(SC_UP) then        RotPX!=RotPX!-.005end ifif multikey(SC_Down) then        RotPX!=RotPX!+.005end ifif multikey(SC_Q) then        RotPZ!=RotPZ!-.005end ifif multikey(SC_E) then        RotPZ!=RotPZ!+.005end ifLocate 1,1:Print RotPX!Locate 2,1:Print RotPY!Locate 3,1:Print RotPZ!Loop Until Inkey$=" "ENDSUB Point3D (xA!, yA!, zA!, xP, yP, DST)    DST = (LENS - zA!)    xP=CenterX+(LENS * xA! / DST)    yP=CenterY+(LENS * yA! / DST)END SUBSUB rotpt (x1!, y1!, z1!, rotx!, roty!, rotz!, nx!, ny!, nz!)    DIM AS SINGLE rx,ry,rz    rx = rotx!    ry = roty!+90    rz = rotz!+90    'xrot    nx1! = x1!    ny1! = z1! * SIN(pi * rx) + y1! * COS(pi * rx)    nz1! = z1! * COS(pi * rx) - y1! * SIN(pi * rx)   'yrot    nx2! = nx1! * COS(pi * ry) - nz1! * SIN(pi * ry)    ny2! = ny1!    nz2! = nx1! * SIN(pi * ry) + nz1! * COS(pi * ry)    'zrot    nx! = nx2! * COS(pi * rz) - ny2! * SIN(pi * rz)    ny! = nx2! * SIN(pi * rz) + ny2! * COS(pi * rz)    nz! = nz2!   END SUBData -22,-203,-3Data  22,-203,-3Data -53,162,43Data  53,162,43Data  118,129,-19Data  154,162,-3Data -154,162,-3Data -118,129,-19Data -18,-142,10Data  18,-142,10Data  38,-51,11Data -38,-51,11Data  20,-51,43Data -20,-51,43Data  53,162,-3Data -53,162,-3Data 8,13Data 8,11Data 8,9Data 9,12Data 9,10Data 0,11Data 0,8Data 0,7Data 0,6Data 0,1Data 1,10Data 1,9Data 1,5Data 1,4Data 2,15Data 2,13Data 2,11Data 2,6Data 2,3Data 3,14Data 3,12Data 3,10Data 3,5Data 4,14Data 4,7Data 4,5Data 5,14Data 5,10Data 6,15Data 6,11Data 6,7Data 7,15Data 10,12Data 11,13Data 12,13Data 14,15
I thought the solution for this should be a no brainer mainly because there should be a sub that quadrates the raw axes rotations to the actual pitch yaw and roll angles.
Something like this:

'In the EEE loop:

GetPitchYawRoll RotX,RotY,RotZ,RealAngleX,RealAngleY,RealAngleZ
rotpt CoordX,CoordY,CoordZ,RealAngleX.RealAngleY.RealAngleZ,TempX,TempY,TempZ
'Where RealAngleX..Z get's their real rotation angle axis, and where TempX..Z gets a coordination of the offsetted rotational axises.

Really, how hard is this to solve?

Statistics: Posted by Guest — Sat Dec 03, 2005 1:06 am


]]>