Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3541 in orxonox.OLD for orxonox/trunk/src/lib


Ignore:
Timestamp:
Mar 14, 2005, 12:39:30 AM (20 years ago)
Author:
bensch
Message:

orxonox/trunk: debug information for class vector and quaternion

Location:
orxonox/trunk/src/lib/math
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/math/vector.cc

    r3473 r3541  
    2121
    2222#include "vector.h"
    23 
     23#include "debug.h"
    2424
    2525using namespace std;
     
    201201}
    202202
    203 
    204203/**
    205204   \brief calculate the angle between two vectors in radiances
     
    225224  f = acos( v1 * v2 / (v1.len() * v2.len()));
    226225  return f * 180 / PI;
     226}
     227
     228
     229/**
     230   \brief Outputs the values of the Vector
     231*/
     232void Vector::debug(void)
     233{
     234  PRINT(0)("Vector Debug information\n");
     235  PRINT(0)("x: %f; y: %f; z: %f", x, y, z);
     236  PRINT(3)(" lenght: %f", len());
     237  PRINT(0)("\n");
    227238}
    228239
     
    581592
    582593/**
     594   \brief outputs some nice formated debug information about this quaternion
     595*/
     596void Quaternion::debug(void)
     597{
     598  PRINT(0)("Quaternion Debug Information\n");
     599  PRINT(0)("real a=%f; imag: x=%f y=%f z=%f\n", w, v.x, v.y, v.z);
     600}
     601
     602/**
    583603   \brief create a rotation from a vector
    584604   \param v: a vector
  • orxonox/trunk/src/lib/math/vector.h

    r3473 r3541  
    4141  Vector* getNormalized();
    4242  Vector abs();
     43
     44  void debug();
    4345};
    4446
     
    5355{
    5456 public:
    55         Vector v;       //!< Imaginary Vector
    56         float w;        //!< Real part of the number
    57 
    58         Quaternion ();
    59         Quaternion (float m[4][4]);
    60         Quaternion (float angle, const Vector& axis);
    61         Quaternion (const Vector& dir, const Vector& up);
    62         Quaternion (float roll, float pitch, float yaw);
    63        
    64         Quaternion operator/ (const float& f) const;
    65         Quaternion operator* (const float& f) const;
    66         Quaternion operator* (const Quaternion& q) const;
    67         Quaternion operator+ (const Quaternion& q) const;
    68         Quaternion operator- (const Quaternion& q) const;
    69         Quaternion conjugate () const;
    70         Quaternion inverse () const;
    71         Vector apply (Vector& f) const;
    72         float norm () const;
    73         void matrix (float m[4][4]) const;
    74         void quatSlerp(const Quaternion* from, const Quaternion* to, const float t, Quaternion* res);
    75 
     57  Vector v;     //!< Imaginary Vector
     58  float w;        //!< Real part of the number
     59 
     60  Quaternion ();
     61  Quaternion (float m[4][4]);
     62  Quaternion (float angle, const Vector& axis);
     63  Quaternion (const Vector& dir, const Vector& up);
     64  Quaternion (float roll, float pitch, float yaw);
     65 
     66  Quaternion operator/ (const float& f) const;
     67  Quaternion operator* (const float& f) const;
     68  Quaternion operator* (const Quaternion& q) const;
     69  Quaternion operator+ (const Quaternion& q) const;
     70  Quaternion operator- (const Quaternion& q) const;
     71  Quaternion conjugate () const;
     72  Quaternion inverse () const;
     73  Vector apply (Vector& f) const;
     74  float norm () const;
     75  void matrix (float m[4][4]) const;
     76  void quatSlerp(const Quaternion* from, const Quaternion* to, const float t, Quaternion* res);
     77 
     78  void debug();
    7679 private:
    77         float DELTA;      //!< resolution of calculation
     80  float DELTA;      //!< resolution of calculation
    7881
    7982};
Note: See TracChangeset for help on using the changeset viewer.