Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

jMatrixStack Class Reference

#include <jMatrix.hpp>

List of all members.

Public Methods

 jMatrixStack ()
void push ()
void pop ()
jMatrix getTop ()
void setTop (jMatrix obj)
void tform (vect3f &point)
void tform (vect3f *point)
void trans (float x, float y, float z)
void rotxrad (float angle)
void rotxdeg (float angle)
void rotyrad (float angle)
void rotydeg (float angle)
void rotzrad (float angle)
void rotzdeg (float angle)
void rotallrad (float x, float y, float z)
void rotalldeg (float x, float y, float z)
void scale (float x, float y, float z)

Protected Attributes

vector< jMatrixstk
vector< jMatrix >::iterator iter
jMatrix mult


Constructor & Destructor Documentation

jMatrixStack::jMatrixStack  
 

Definition at line 333 of file jMatrix.hpp.

00334 {
00335   jMatrix ident;
00336   ident.identity();
00337   
00338   stk.push_back(ident);
00339   iter = stk.begin();
00340 }


Member Function Documentation

jMatrix jMatrixStack::getTop   [inline]
 

Definition at line 307 of file jMatrix.hpp.

00307 { return *iter; }

void jMatrixStack::pop  
 

Definition at line 353 of file jMatrix.hpp.

00354 {
00355   if (stk.size() > 1){
00356     stk.pop_back();
00357     iter = stk.end() - 1;
00358   }
00359   else
00360     (*iter).identity();
00361 }

void jMatrixStack::push  
 

Definition at line 344 of file jMatrix.hpp.

00345 {
00346   mult = *iter;
00347   stk.push_back(mult);
00348   iter = stk.end() - 1;
00349 }

void jMatrixStack::rotalldeg float    x,
float    y,
float    z
 

Definition at line 495 of file jMatrix.hpp.

00496 {
00497   if (x != 0)
00498     rotxdeg(x);
00499   if (y != 0)
00500     rotydeg(y);
00501   if (z != 0)
00502     rotzdeg(z);
00503 }

void jMatrixStack::rotallrad float    x,
float    y,
float    z
 

Definition at line 483 of file jMatrix.hpp.

00484 {
00485   if (x != 0)
00486     rotxrad(x);
00487   if (y != 0)
00488     rotyrad(y);
00489   if (z != 0)
00490     rotzrad(z);
00491 }

void jMatrixStack::rotxdeg float    angle
 

Definition at line 406 of file jMatrix.hpp.

Referenced by rotalldeg().

00407 {
00408   mult.identity();
00409   
00410   angle *= pi / 180;
00411   
00412   mult.m[1][1] = cos(angle);
00413   mult.m[2][2] = cos(angle);
00414   mult.m[1][2] = -sin(angle);
00415   mult.m[2][1] = sin(angle);
00416   
00417   (*iter).mult(mult);
00418 }

void jMatrixStack::rotxrad float    angle
 

Definition at line 392 of file jMatrix.hpp.

Referenced by rotallrad().

00393 {
00394   mult.identity();
00395   
00396   mult.m[1][1] = cos(angle);
00397   mult.m[2][2] = cos(angle);
00398   mult.m[1][2] = -sin(angle);
00399   mult.m[2][1] = sin(angle);
00400   
00401   (*iter).mult(mult);
00402 }

void jMatrixStack::rotydeg float    angle
 

Definition at line 436 of file jMatrix.hpp.

Referenced by rotalldeg().

00437 {
00438   mult.identity();
00439   
00440   angle *= pi / 180;
00441   
00442   mult.m[0][0] = cos(angle);
00443   mult.m[2][2] = cos(angle);
00444   mult.m[0][2] = sin(angle);
00445   mult.m[2][0] = -sin(angle);
00446   
00447   (*iter).mult(mult);
00448 }

void jMatrixStack::rotyrad float    angle
 

Definition at line 422 of file jMatrix.hpp.

Referenced by rotallrad().

00423 {
00424   mult.identity();
00425   
00426   mult.m[0][0] = cos(angle);
00427   mult.m[2][2] = cos(angle);
00428   mult.m[0][2] = sin(angle);
00429   mult.m[2][0] = -sin(angle);
00430   
00431   (*iter).mult(mult);
00432 }

void jMatrixStack::rotzdeg float    angle
 

Definition at line 467 of file jMatrix.hpp.

Referenced by rotalldeg().

00468 {
00469   mult.identity();
00470   
00471   angle *= pi / 180;
00472   
00473   mult.m[0][0] = cos(angle);
00474   mult.m[1][1] = cos(angle);
00475   mult.m[0][1] = -sin(angle);
00476   mult.m[1][0] = sin(angle);
00477   
00478   (*iter).mult(mult);
00479 }

void jMatrixStack::rotzrad float    angle
 

Definition at line 453 of file jMatrix.hpp.

Referenced by rotallrad().

00454 {
00455   mult.identity();
00456   
00457   mult.m[0][0] = cos(angle);
00458   mult.m[1][1] = cos(angle);
00459   mult.m[0][1] = -sin(angle);
00460   mult.m[1][0] = sin(angle);
00461   
00462   (*iter).mult(mult);
00463 }

void jMatrixStack::scale float    x,
float    y,
float    z
 

Definition at line 507 of file jMatrix.hpp.

00508 {
00509   mult.identity();
00510   
00511   mult.m[0][0] = x;
00512   mult.m[1][1] = y;
00513   mult.m[2][2] = z;
00514   
00515   (*iter).mult(mult);
00516 }

void jMatrixStack::setTop jMatrix    obj [inline]
 

Definition at line 308 of file jMatrix.hpp.

00308 { *iter = obj; }

void jMatrixStack::tform vect3f *    point
 

Definition at line 372 of file jMatrix.hpp.

00373 {
00374   (*iter).tform(point);
00375 }

void jMatrixStack::tform vect3f &    point
 

Definition at line 365 of file jMatrix.hpp.

00366 {
00367   (*iter).tform(point);
00368 }

void jMatrixStack::trans float    x,
float    y,
float    z
 

Definition at line 379 of file jMatrix.hpp.

00380 {
00381   mult.identity();
00382   
00383   mult.m[0][3] = x;
00384   mult.m[1][3] = y;
00385   mult.m[2][3] = z;
00386   
00387   (*iter).mult(mult);
00388 }


Member Data Documentation

vector<jMatrix>::iterator jMatrixStack::iter [protected]
 

Definition at line 294 of file jMatrix.hpp.

jMatrix jMatrixStack::mult [protected]
 

Definition at line 295 of file jMatrix.hpp.

vector<jMatrix> jMatrixStack::stk [protected]
 

Definition at line 293 of file jMatrix.hpp.


The documentation for this class was generated from the following file:
Generated on Sun Oct 14 18:48:52 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001