- Cal3D 0.9 API Reference -

Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

vector.h

00001 //****************************************************************************//
00002 // vector.h                                                                   //
00003 // Copyright (C) 2001, 2002 Bruno 'Beosil' Heidelberger                       //
00004 //****************************************************************************//
00005 // This library is free software; you can redistribute it and/or modify it    //
00006 // under the terms of the GNU Lesser General Public License as published by   //
00007 // the Free Software Foundation; either version 2.1 of the License, or (at    //
00008 // your option) any later version.                                            //
00009 //****************************************************************************//
00010 
00011 #ifndef CAL_VECTOR_H
00012 #define CAL_VECTOR_H
00013 
00014 //****************************************************************************//
00015 // Includes                                                                   //
00016 //****************************************************************************//
00017 
00018 #include "cal3d/global.h"
00019 
00020 //****************************************************************************//
00021 // Forward declarations                                                       //
00022 //****************************************************************************//
00023 
00024 class CalQuaternion;
00025 class CalMatrix;
00026 
00027 //****************************************************************************//
00028 // Class declaration                                                          //
00029 //****************************************************************************//
00030 
00031  /*****************************************************************************/
00035 class CAL3D_API CalVector
00036 {
00037 // member variables
00038 public:
00039   float x;
00040   float y;
00041   float z;
00042 
00043 // constructors/destructor
00044 public:
00045   CalVector();
00046   CalVector(const CalVector& v);
00047   CalVector(float vx, float vy, float vz);
00048   ~CalVector();
00049 
00050 // member functions
00051 public:
00052   float& operator[](unsigned int i);
00053   const float& operator[](unsigned int i) const;
00054   void operator=(const CalVector& v);
00055   void operator+=(const CalVector& v);
00056   void operator-=(const CalVector& v);
00057   void operator*=(const float d);
00058   void operator*=(const CalQuaternion& q);
00059   void operator*=(const CalMatrix &m);
00060   void operator/=(const float d);
00061   bool operator==(const CalVector& v);
00062   friend CAL3D_API CalVector operator+(const CalVector& v, const CalVector& u);
00063   friend CAL3D_API CalVector operator-(const CalVector& v, const CalVector& u);
00064   friend CAL3D_API CalVector operator*(const CalVector& v, const float d);
00065   friend CAL3D_API CalVector operator*(const float d, const CalVector& v);
00066   friend CAL3D_API CalVector operator/(const CalVector& v, const float d);
00067   friend CAL3D_API float operator*(const CalVector& v, const CalVector& u);
00068   friend CAL3D_API CalVector operator%(const CalVector& v, const CalVector& u);
00069   void blend(float d, const CalVector& v);
00070   void clear();
00071   float length();
00072   float normalize();
00073   void set(float vx, float vy, float vz);
00074 };
00075 
00076  /*****************************************************************************/
00081 class CAL3D_API CalPlane
00082 {
00083    public:
00084       float a,b,c,d;
00085       
00086       // These methods are made only to calculate the bounding boxes,
00087       // don't use them in you program
00088       
00089       float eval(CalVector &p);
00090       void setPosition(CalVector &p);
00091       void setNormal(CalVector &p);
00092 };
00093 
00094  /*****************************************************************************/
00099 class CAL3D_API CalBoundingBox
00100 {
00101    public:
00102      CalPlane plane[6];
00103      
00104      void computePoints(CalVector *p);
00105    
00106 };
00107 
00108 
00109 
00110 #endif
00111 
00112 //****************************************************************************//

Generated at Sun Oct 12 18:38:48 2003 by The Cal3D Team with doxygen 1.2.14 © 1997-2001 Dimitri van Heesch