removed a few emtpy Vector x; statements
git-svn-id: svn://anubis/fart/trunk@309 7f9b0f55-74a9-4bce-be96-3c2cd072584d
This commit is contained in:
parent
835a0c968f
commit
9fd9c5774e
@ -24,11 +24,10 @@ class Ray
|
|||||||
*/
|
*/
|
||||||
Vector getPositionAt(double dist) const
|
Vector getPositionAt(double dist) const
|
||||||
{
|
{
|
||||||
Vector v;
|
return Vector(
|
||||||
v[0] = m_origin[0] + dist * m_direction[0];
|
m_origin[0] + dist * m_direction[0],
|
||||||
v[1] = m_origin[1] + dist * m_direction[1];
|
m_origin[1] + dist * m_direction[1],
|
||||||
v[2] = m_origin[2] + dist * m_direction[2];
|
m_origin[2] + dist * m_direction[2]);
|
||||||
return v;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ray shift(double amt)
|
Ray shift(double amt)
|
||||||
|
@ -79,29 +79,26 @@ class Vector
|
|||||||
|
|
||||||
Vector mult(const Vector & v2) const
|
Vector mult(const Vector & v2) const
|
||||||
{
|
{
|
||||||
Vector result;
|
return Vector(
|
||||||
result[0] = m_array[0] * v2.m_array[0];
|
m_array[0] * v2.m_array[0],
|
||||||
result[1] = m_array[1] * v2.m_array[1];
|
m_array[1] * v2.m_array[1],
|
||||||
result[2] = m_array[2] * v2.m_array[2];
|
m_array[2] * v2.m_array[2]);
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector div(const Vector & v2) const
|
Vector div(const Vector & v2) const
|
||||||
{
|
{
|
||||||
Vector result;
|
return Vector(
|
||||||
result[0] = m_array[0] / v2.m_array[0];
|
m_array[0] / v2.m_array[0],
|
||||||
result[1] = m_array[1] / v2.m_array[1];
|
m_array[1] / v2.m_array[1],
|
||||||
result[2] = m_array[2] / v2.m_array[2];
|
m_array[2] / v2.m_array[2]);
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector operator-() const
|
Vector operator-() const
|
||||||
{
|
{
|
||||||
Vector result;
|
return Vector(
|
||||||
result[0] = -m_array[0];
|
-m_array[0],
|
||||||
result[1] = -m_array[1];
|
-m_array[1],
|
||||||
result[2] = -m_array[2];
|
-m_array[2]);
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compute the dot-product of two vectors */
|
/* Compute the dot-product of two vectors */
|
||||||
@ -115,47 +112,42 @@ class Vector
|
|||||||
/* Compute the cross-product of two vectors */
|
/* Compute the cross-product of two vectors */
|
||||||
Vector operator*(const Vector & v2) const
|
Vector operator*(const Vector & v2) const
|
||||||
{
|
{
|
||||||
Vector result;
|
return Vector(
|
||||||
result[0] = m_array[1] * v2.m_array[2] - m_array[2] * v2.m_array[1];
|
m_array[1] * v2.m_array[2] - m_array[2] * v2.m_array[1],
|
||||||
result[1] = m_array[2] * v2.m_array[0] - m_array[0] * v2.m_array[2];
|
m_array[2] * v2.m_array[0] - m_array[0] * v2.m_array[2],
|
||||||
result[2] = m_array[0] * v2.m_array[1] - m_array[1] * v2.m_array[0];
|
m_array[0] * v2.m_array[1] - m_array[1] * v2.m_array[0]);
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector operator+(const Vector & v2) const
|
Vector operator+(const Vector & v2) const
|
||||||
{
|
{
|
||||||
Vector result;
|
return Vector(
|
||||||
result[0] = m_array[0] + v2.m_array[0];
|
m_array[0] + v2.m_array[0],
|
||||||
result[1] = m_array[1] + v2.m_array[1];
|
m_array[1] + v2.m_array[1],
|
||||||
result[2] = m_array[2] + v2.m_array[2];
|
m_array[2] + v2.m_array[2]);
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector operator-(const Vector & v2) const
|
Vector operator-(const Vector & v2) const
|
||||||
{
|
{
|
||||||
Vector result;
|
return Vector(
|
||||||
result[0] = m_array[0] - v2.m_array[0];
|
m_array[0] - v2.m_array[0],
|
||||||
result[1] = m_array[1] - v2.m_array[1];
|
m_array[1] - v2.m_array[1],
|
||||||
result[2] = m_array[2] - v2.m_array[2];
|
m_array[2] - v2.m_array[2]);
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector operator*(double scale) const
|
Vector operator*(double scale) const
|
||||||
{
|
{
|
||||||
Vector result;
|
return Vector(
|
||||||
result[0] = m_array[0] * scale;
|
m_array[0] * scale,
|
||||||
result[1] = m_array[1] * scale;
|
m_array[1] * scale,
|
||||||
result[2] = m_array[2] * scale;
|
m_array[2] * scale);
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector operator/(double scale) const
|
Vector operator/(double scale) const
|
||||||
{
|
{
|
||||||
Vector result;
|
return Vector(
|
||||||
result[0] = m_array[0] / scale;
|
m_array[0] / scale,
|
||||||
result[1] = m_array[0] / scale;
|
m_array[0] / scale,
|
||||||
result[2] = m_array[0] / scale;
|
m_array[0] / scale);
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector & operator+=(const Vector & v2)
|
Vector & operator+=(const Vector & v2)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user