#include <Vector3f.h>
Public Member Functions | |
Vector3f (void) | |
Standard constructor. | |
Vector3f (float x, float y, float z) | |
Vector3f (float v[3]) | |
Vector3f (const Vector3f ©) | |
Vector3f (const Vector4f &vec) | |
~Vector3f (void) | |
Destructor. | |
Vector3f | add (const Vector3f &v) |
Adds vector v to this and returns new vector. | |
Vector3f | add (float c) |
Adds the constant c to this vector and returns a new vector. | |
Vector3f | subtract (const Vector3f &v) |
Vector3f | subtract (float c) |
Vector3f | divide (const Vector3f &v) |
Vector3f | divide (float c) |
Vector3f | multiply (const Vector3f &v) |
Vector3f | multiply (float c) |
float | sqrMagnitude (void) |
Returns the squared magnitude. | |
float | magnitude (void) |
Returns the magnitude. | |
float | dotProduct (const Vector3f &v) |
Returns the dot product of this and the vector v. | |
void | normalize (void) |
Normalize this vector. | |
Vector3f | crossProduct (const Vector3f &v) |
Calculate the cross product. | |
float | angle (Vector3f v) |
Returns the angle between this and the vector v. | |
float | sqrDistance (const Vector3f &v) |
Returns the squared distance between this and the vector v. | |
float | distance (const Vector3f &v) |
Returns the distance between this and the vector v. | |
bool | isNullVector (void) |
bool | equals (const Vector3f &v) |
Returns 1 if the components of the vector euqal. | |
Vector3f | closestPointOnLine (Vector3f lineStart, Vector3f lineEnd) |
Vector3f | createNormal (Vector3f a, Vector3f b, Vector3f c) |
std::string | toString (void) |
Debug print the components of the vector. | |
Vector3f | operator+ (const Vector3f &v) |
Vector3f | operator- (const Vector3f &v) |
Vector3f | operator * (const Vector3f &v) |
Vector3f | operator * (float f) |
Data Fields | |
float | m_v [3] |
|
Standard constructor.
Definition at line 16 of file Vector3f.cpp. References m_v. Referenced by add(), crossProduct(), divide(), multiply(), and subtract().
|
|
Definition at line 28 of file Vector3f.cpp. References m_v.
|
|
Definition at line 40 of file Vector3f.cpp. References m_v.
|
|
Definition at line 52 of file Vector3f.cpp. References m_v.
|
|
Definition at line 64 of file Vector3f.cpp. References pge::Vector4f::m_v, and m_v.
|
|
Destructor.
Definition at line 76 of file Vector3f.cpp.
00076 { 00077 } |
|
Adds the constant c to this vector and returns a new vector.
Definition at line 96 of file Vector3f.cpp. References m_v, and Vector3f().
|
Here is the call graph for this function:
|
Adds vector v to this and returns new vector.
Definition at line 85 of file Vector3f.cpp. References m_v, and Vector3f(). Referenced by pge::Camera::applyCameraView(), pge::Camera::backward(), closestPointOnLine(), pge::Camera::down(), pge::Camera::forward(), operator+(), pge::Sprite::render(), pge::ParticleSystem::render(), pge::MeshModel::setBottomCenter(), pge::Camera::slideLeft(), pge::Camera::slideRight(), pge::Camera::up(), and pge::Camera::updatePhysics().
|
Here is the call graph for this function:
|
Returns the angle between this and the vector v.
Definition at line 232 of file Vector3f.cpp. References dotProduct(), magnitude(), and PIOVER180.
00232 { 00233 return ((float)acos(dotProduct(v) / (magnitude() * v.magnitude())) / (float)PIOVER180); 00234 } |
Here is the call graph for this function:
|
Definition at line 296 of file Vector3f.cpp. References add(), distance(), dotProduct(), multiply(), normalize(), and subtract().
00296 { 00297 Vector3f c = this->subtract(lineStart); 00298 Vector3f V = lineEnd.subtract(lineStart); 00299 00300 00301 V.normalize(); 00302 float d = lineStart.distance(lineEnd); 00303 float t = V.dotProduct(c); 00304 00305 // Check to see if t is beyond the extents of the line segment. 00306 if(t < 0.0f) { 00307 return lineStart; 00308 } 00309 if(t > d){ 00310 return lineEnd; 00311 } 00312 // Return the point between a and b. 00313 // Set length of V to t. 00314 V = V.multiply(t); 00315 00316 return lineStart.add(V); 00317 } |
Here is the call graph for this function:
|
Definition at line 325 of file Vector3f.cpp. References crossProduct(), normalize(), and subtract().
|
Here is the call graph for this function:
|
Calculate the cross product.
Definition at line 220 of file Vector3f.cpp. References m_v, and Vector3f(). Referenced by createNormal(), pge::Plane::Plane(), and pge::triangle::sameSide().
|
Here is the call graph for this function:
|
Returns the distance between this and the vector v.
Definition at line 254 of file Vector3f.cpp. References m_v. Referenced by closestPointOnLine(), and pge::SingleTexturedMesh::render().
00254 { 00255 return ((float)(sqrt(((m_v[0] - v.m_v[0]) * (m_v[0] - v.m_v[0])) + 00256 ((m_v[1] - v.m_v[1]) * (m_v[1] - v.m_v[1])) + 00257 ((m_v[2] - v.m_v[2]) * (m_v[2] - v.m_v[2])) 00258 ))); 00259 } |
|
Definition at line 140 of file Vector3f.cpp. References m_v, and Vector3f().
|
Here is the call graph for this function:
|
Definition at line 129 of file Vector3f.cpp. References m_v, and Vector3f(). Referenced by pge::Camera::updatePhysics().
|
Here is the call graph for this function:
|
Returns the dot product of this and the vector v.
Definition at line 193 of file Vector3f.cpp. References m_v. Referenced by angle(), closestPointOnLine(), pge::Plane::getDistanceToPoint(), pge::Plane::getFootPoint(), pge::Plane::getIntersectionPoint(), pge::Plane::Plane(), and pge::triangle::sameSide().
|
|
Returns 1 if the components of the vector euqal.
Definition at line 280 of file Vector3f.cpp. References EQUAL_TOLERANCE, and m_v.
00280 { 00281 if(abs(m_v[0] - v.m_v[0]) <= EQUAL_TOLERANCE 00282 && abs(m_v[1] - v.m_v[1]) <= EQUAL_TOLERANCE 00283 && abs(m_v[2] - v.m_v[2]) <= EQUAL_TOLERANCE) { 00284 return true; 00285 } else { 00286 return false; 00287 } 00288 } |
|
Definition at line 267 of file Vector3f.cpp. References m_v.
|
|
Returns the magnitude.
Definition at line 183 of file Vector3f.cpp. References m_v. Referenced by angle(), pge::Mesh::buildBoundingSphere(), pge::Sphere::getDistance(), and normalize().
00183 { 00184 return ((float)sqrt((m_v[0] * m_v[0]) + (m_v[1] * m_v[1]) + (m_v[2] * m_v[2]))); 00185 } |
|
Definition at line 162 of file Vector3f.cpp. References m_v, and Vector3f().
|
Here is the call graph for this function:
|
Definition at line 151 of file Vector3f.cpp. References m_v, and Vector3f(). Referenced by pge::Camera::backward(), closestPointOnLine(), pge::Camera::down(), pge::Camera::forward(), pge::DayNightCycle::getAmbientLight(), pge::Plane::getFootPoint(), operator *(), pge::ParticleSystem::render(), pge::MeshModel::scale(), pge::Camera::slideLeft(), pge::Camera::slideRight(), pge::Camera::up(), and pge::Camera::updatePhysics().
|
Here is the call graph for this function:
|
Normalize this vector.
Definition at line 203 of file Vector3f.cpp. References m_v, and magnitude(). Referenced by closestPointOnLine(), createNormal(), pge::Plane::getIntersectionPoint(), pge::ParticleSystem::ParticleSystem(), pge::Plane::Plane(), pge::ParticleSystem::setDirection(), pge::Camera::slideLeft(), pge::Camera::slideRight(), pge::EffectTest::timer(), and pge::DayNightCycle::update().
|
Here is the call graph for this function:
|
Definition at line 122 of file Vector3f.h. References multiply().
00122 { 00123 return multiply(f); 00124 } |
Here is the call graph for this function:
|
Definition at line 115 of file Vector3f.h. References multiply().
00115 { 00116 return multiply(v); 00117 } |
Here is the call graph for this function:
|
Definition at line 101 of file Vector3f.h. References add().
00101 { 00102 return add(v); 00103 } |
Here is the call graph for this function:
|
Definition at line 108 of file Vector3f.h. References subtract().
00108 { 00109 return subtract(v); 00110 } |
Here is the call graph for this function:
|
Returns the squared distance between this and the vector v.
Definition at line 242 of file Vector3f.cpp. References m_v. Referenced by pge::SingleTexturedMesh::render(), and pge::ParticleSystem::render().
|
|
Returns the squared magnitude.
Definition at line 173 of file Vector3f.cpp. References m_v. Referenced by pge::Sphere::getSquaredDistance().
|
|
Definition at line 118 of file Vector3f.cpp. References m_v, and Vector3f().
|
Here is the call graph for this function:
|
Here is the call graph for this function:
|
Debug print the components of the vector.
Definition at line 345 of file Vector3f.cpp.
00345 { 00346 //return std::string("X: " + m_v[0] + " Y: " + m_v[1] + " Z: " + m_v[2]); 00347 return std::string("TODO"); 00348 } |
|