Thread: [Opal-commits] opal/src Mass.h,1.1,1.2 Point3r.h,1.15,1.16 Quaternion.h,1.12,1.13 Vec3r.cpp,1.3,1.4
Status: Inactive
Brought to you by:
tylerstreeter
|
From: Olex <ole...@us...> - 2005-12-04 03:27:20
|
Update of /cvsroot/opal/opal/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31572/src Modified Files: Mass.h Point3r.h Quaternion.h Vec3r.cpp Vec3r.h testQuaternion.cpp testVec3r.cpp Log Message: Updated vc8 project files. MSVC fixes. Index: Vec3r.h =================================================================== RCS file: /cvsroot/opal/opal/src/Vec3r.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Vec3r.h 30 Nov 2005 06:28:12 -0000 1.18 --- Vec3r.h 4 Dec 2005 03:27:11 -0000 1.19 *************** *** 31,34 **** --- 31,35 ---- // project headers #include "OpalMath.h" + #include "Portability.h" // system headers *************** *** 63,67 **** /// Returns true if the two vectors are roughly collinear. ! bool areCollinear( const Vec3r& u, const Vec3r& v ); /// Prints the Vec3r to the given output stream. --- 64,68 ---- /// Returns true if the two vectors are roughly collinear. ! inline bool areCollinear( const Vec3r& u, const Vec3r& v ); /// Prints the Vec3r to the given output stream. *************** *** 81,125 **** /// default - (0,0,0) ! Vec3r(); ! Vec3r( const Vec3r & src ); ! Vec3r( real xx, real yy, real zz ); ! Vec3r( const real * data ); ! void set( real xx, real yy, real zz ); ! void set( real * data ); ! real & operator[] ( unsigned int i ); ! const real & operator[] ( unsigned int i ) const; ! real lengthSquared() const; ! real length() const; ! void normalize(); ! Vec3r unit() const; ! void operator+=( const Vec3r & v ); ! void operator-=( const Vec3r & v ); ! void operator*=( const Vec3r & v ); ! void operator*=( real scalar ); ! void operator/=( real scalar ); ! void operator/=( const Vec3r & v ); ! bool operator==( const Vec3r & v ); ! bool operator!=( const Vec3r & v ); ! void operator=( const Vec3r & v ); }; --- 82,126 ---- /// default - (0,0,0) ! OPAL_DECL Vec3r(); ! OPAL_DECL Vec3r( const Vec3r & src ); ! OPAL_DECL Vec3r( real xx, real yy, real zz ); ! OPAL_DECL Vec3r( const real * data ); ! OPAL_DECL void OPAL_CALL set( real xx, real yy, real zz ); ! OPAL_DECL void OPAL_CALL set( real * data ); ! OPAL_DECL real & OPAL_CALL operator[] ( unsigned int i ); ! OPAL_DECL const real & OPAL_CALL operator[] ( unsigned int i ) const; ! OPAL_DECL real OPAL_CALL lengthSquared() const; ! OPAL_DECL real OPAL_CALL length() const; ! OPAL_DECL void OPAL_CALL normalize(); ! OPAL_DECL Vec3r OPAL_CALL unit() const; ! OPAL_DECL void OPAL_CALL operator+=( const Vec3r & v ); ! OPAL_DECL void OPAL_CALL operator-=( const Vec3r & v ); ! OPAL_DECL void OPAL_CALL operator*=( const Vec3r & v ); ! OPAL_DECL void OPAL_CALL operator*=( real scalar ); ! OPAL_DECL void OPAL_CALL operator/=( real scalar ); ! OPAL_DECL void OPAL_CALL operator/=( const Vec3r & v ); ! OPAL_DECL bool OPAL_CALL operator==( const Vec3r & v ); ! OPAL_DECL bool OPAL_CALL operator!=( const Vec3r & v ); ! OPAL_DECL void OPAL_CALL operator=( const Vec3r & v ); }; *************** *** 212,215 **** --- 213,230 ---- { return o << "[" << v.x << " " << v.y << " " << v.z << "]"; + } + + bool areCollinear( const Vec3r & u, const Vec3r & v ) + { + Vec3r a = u, b = v; + a.normalize(); + b.normalize(); + + if ( areEqual( a.x, b.x ) && areEqual( a.y, b.y ) && areEqual( a.z, b.z ) ) + return true; + if ( areEqual( a.x, -b.x ) && areEqual( a.y, -b.y ) && areEqual( a.z, -b.z ) ) + return true; + + return false; } } Index: Vec3r.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/Vec3r.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Vec3r.cpp 2 Dec 2005 05:47:21 -0000 1.3 --- Vec3r.cpp 4 Dec 2005 03:27:11 -0000 1.4 *************** *** 191,207 **** return ( !areEqual( x, v.x ) || !areEqual( y , v.y ) || !areEqual( z , v.z ) ); } - - bool areCollinear( const Vec3r & u, const Vec3r & v ) - { - Vec3r a = u, b = v; - a.normalize(); - b.normalize(); - - if ( areEqual( a.x, b.x ) && areEqual( a.y, b.y ) && areEqual( a.z, b.z ) ) - return true; - if ( areEqual( a.x, -b.x ) && areEqual( a.y, -b.y ) && areEqual( a.z, -b.z ) ) - return true; - - return false; - } } --- 191,193 ---- Index: testQuaternion.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/testQuaternion.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** testQuaternion.cpp 1 Dec 2005 23:55:21 -0000 1.3 --- testQuaternion.cpp 4 Dec 2005 03:27:11 -0000 1.4 *************** *** 148,154 **** QT_CHECK_CLOSE( Quaternion( 0, 0, 0, 0 ).length(), 0 ); QT_CHECK_CLOSE( Quaternion( 1, 0, 0, 0 ).length(), 1 ); ! QT_CHECK_CLOSE( Quaternion( 1, 2, 0, 0 ).length(), sqrt( 5 ) ); ! QT_CHECK_CLOSE( Quaternion( 1, 2, 3, 0 ).length(), sqrt( 14 ) ); ! QT_CHECK_CLOSE( Quaternion( 1, 2, 3, 4 ).length(), sqrt( 30 ) ); } --- 148,154 ---- QT_CHECK_CLOSE( Quaternion( 0, 0, 0, 0 ).length(), 0 ); QT_CHECK_CLOSE( Quaternion( 1, 0, 0, 0 ).length(), 1 ); ! QT_CHECK_CLOSE( Quaternion( 1, 2, 0, 0 ).length(), sqrt( 5.0 ) ); ! QT_CHECK_CLOSE( Quaternion( 1, 2, 3, 0 ).length(), sqrt( 14.0 ) ); ! QT_CHECK_CLOSE( Quaternion( 1, 2, 3, 4 ).length(), sqrt( 30.0 ) ); } *************** *** 169,173 **** q.set( 1, 0, 0, 1 ); q.normalize(); ! QT_CHECK_EQUAL( q, Quaternion( sqrt( 2 ) / 2.0, 0, 0, sqrt( 2 ) / 2.0 ) ); } --- 169,173 ---- q.set( 1, 0, 0, 1 ); q.normalize(); ! QT_CHECK_EQUAL( q, Quaternion( sqrt( 2.0 ) / 2.0, 0, 0, sqrt( 2.0 ) / 2.0 ) ); } Index: Mass.h =================================================================== RCS file: /cvsroot/opal/opal/src/Mass.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Mass.h 1 Dec 2005 02:04:54 -0000 1.1 --- Mass.h 4 Dec 2005 03:27:11 -0000 1.2 *************** *** 46,52 **** center = Vec3r( 0, 0, 0 ); inertia.makeIdentity(); ! inertia[ 0 ] = 1 / 6.0; ! inertia[ 5 ] = 1 / 6.0; ! inertia[ 10 ] = 1 / 6.0; } --- 46,52 ---- center = Vec3r( 0, 0, 0 ); inertia.makeIdentity(); ! inertia[ 0 ] = static_cast<real>( 1 / 6.0 ); ! inertia[ 5 ] = static_cast<real>( 1 / 6.0 ); ! inertia[ 10 ] = static_cast<real>( 1 / 6.0 ); } Index: Quaternion.h =================================================================== RCS file: /cvsroot/opal/opal/src/Quaternion.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Quaternion.h 1 Dec 2005 23:55:21 -0000 1.12 --- Quaternion.h 4 Dec 2005 03:27:11 -0000 1.13 *************** *** 31,34 **** --- 31,35 ---- // project headers #include "OpalMath.h" + #include "Portability.h" // system headers *************** *** 47,86 **** real z; ! Quaternion(); ! Quaternion( real ww, real xx, real yy, real zz ); ! Quaternion( const Quaternion& src ); ! void set( real ww, real xx, real yy, real zz ); ! real lengthSquared() const; ! real length() const; ! void normalize(); ! void getAngleAxis( real& angle, Vec3r& axis ) const; ! real getRoll() const; ! real getPitch() const; ! real getYaw() const ; ! real & operator[] ( unsigned int i ); ! const real & operator[] ( unsigned int i ) const; }; ! Quaternion operator+( const Quaternion &q1, const Quaternion &q2 ); ! Quaternion operator-( const Quaternion &q1, const Quaternion &q2 ); ! Quaternion operator*( const Quaternion& q, real scalar ); ! Quaternion operator*( real scalar, const Quaternion& q ); ! bool operator==( const Quaternion &q1, const Quaternion &q2 ); ! bool operator!=( const Quaternion &q1, const Quaternion &q2 ); /// Prints the Quaternion to the given output stream. ! std::ostream & operator<<( std::ostream& o, const Quaternion& q ); } --- 48,87 ---- real z; ! OPAL_DECL Quaternion(); ! OPAL_DECL Quaternion( real ww, real xx, real yy, real zz ); ! OPAL_DECL Quaternion( const Quaternion& src ); ! OPAL_DECL void OPAL_CALL set( real ww, real xx, real yy, real zz ); ! OPAL_DECL real OPAL_CALL lengthSquared() const; ! OPAL_DECL real OPAL_CALL length() const; ! OPAL_DECL void OPAL_CALL normalize(); ! OPAL_DECL void OPAL_CALL getAngleAxis( real& angle, Vec3r& axis ) const; ! OPAL_DECL real OPAL_CALL getRoll() const; ! OPAL_DECL real OPAL_CALL getPitch() const; ! OPAL_DECL real OPAL_CALL getYaw() const; ! OPAL_DECL real & OPAL_CALL operator[] ( unsigned int i ); ! OPAL_DECL const real & OPAL_CALL operator[] ( unsigned int i ) const; }; ! OPAL_DECL Quaternion operator+( const Quaternion &q1, const Quaternion &q2 ); ! OPAL_DECL Quaternion operator-( const Quaternion &q1, const Quaternion &q2 ); ! OPAL_DECL Quaternion operator*( const Quaternion& q, real scalar ); ! OPAL_DECL Quaternion operator*( real scalar, const Quaternion& q ); ! OPAL_DECL bool operator==( const Quaternion &q1, const Quaternion &q2 ); ! OPAL_DECL bool operator!=( const Quaternion &q1, const Quaternion &q2 ); /// Prints the Quaternion to the given output stream. ! OPAL_DECL std::ostream & operator<<( std::ostream& o, const Quaternion& q ); } Index: Point3r.h =================================================================== RCS file: /cvsroot/opal/opal/src/Point3r.h,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Point3r.h 1 Dec 2005 02:04:54 -0000 1.15 --- Point3r.h 4 Dec 2005 03:27:11 -0000 1.16 *************** *** 29,35 **** --- 29,39 ---- #define OPAL_POINT3R_H + // project headers #include "OpalMath.h" #include "Vec3r.h" + // systeam headers + #include <cassert> + namespace opal { Index: testVec3r.cpp =================================================================== RCS file: /cvsroot/opal/opal/src/testVec3r.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** testVec3r.cpp 2 Dec 2005 05:47:21 -0000 1.3 --- testVec3r.cpp 4 Dec 2005 03:27:11 -0000 1.4 *************** *** 123,127 **** { Vec3r v( 1, 2, 3 ); ! QT_CHECK_CLOSE( v.length(), sqrt( 1 + 4 + 9 ) ); } --- 123,127 ---- { Vec3r v( 1, 2, 3 ); ! QT_CHECK_CLOSE( v.length(), sqrt( 1 + 4 + 9.0 ) ); } *************** *** 129,133 **** { Vec3r v( -1, -2, -3 ); ! QT_CHECK_CLOSE( v.length(), sqrt( 1 + 4 + 9 ) ); } --- 129,133 ---- { Vec3r v( -1, -2, -3 ); ! QT_CHECK_CLOSE( v.length(), sqrt( 1 + 4 + 9.0 ) ); } |