Public Member Functions | |
float & | operator[] (int i) |
const float & | operator[] (int i) const |
const float * | array () const |
Vector3 (const float v[3]) | |
Vector3 (const double v[3]) | |
Vector3 (float a, float b, float c) | |
void | set (float a, float b, float c) |
Vector3 | operator* (float d) const |
Vector3 & | operator*= (float d) |
Vector3 | operator* (double d) const |
Vector3 & | operator*= (double d) |
Vector3 | operator/ (float d) const |
Vector3 & | operator/= (float d) |
Vector3 | operator* (const Vector3 &v) const |
Vector3 & | operator*= (const Vector3 &v) |
Vector3 | operator/ (const Vector3 &v) const |
Vector3 & | operator/= (const Vector3 &v) |
Vector3 | operator+ (const Vector3 &v) const |
Vector3 & | operator+= (const Vector3 &v) |
Vector3 | operator- (const Vector3 &v) const |
Vector3 & | operator-= (const Vector3 &v) |
Vector3 | operator- () const |
bool | operator== (const Vector3 &v) const |
bool | operator!= (const Vector3 &v) const |
bool | operator== (float d) const |
bool | operator!= (float d) const |
bool | operator< (const Vector3 &v) const |
Fairly arbitrary operator so you can store these in ordered arrays. | |
float | length () const |
float | lengthSquared () const |
Same as this dot this, length() squared. | |
float | distanceBetween (const Vector3 &v) const |
float | distanceSquared (const Vector3 &v) const |
float | dot (const Vector3 &v) const |
Vector3 | cross (const Vector3 &v) const |
float | normalize () |
float | fast_normalize () |
void | negate () |
float | distanceFromPlane (float A, float B, float C, float D) const |
Vector3 | reflect (const Vector3 &N) |
Vector3 | minimum (const Vector3 &a) const |
Vector3 | maximum (const Vector3 &a) const |
void | append (Hash &) const |
Public Attributes | |
float | x |
float | y |
float | z |
Friends | |
std::ostream & | operator<< (std::ostream &o, const Vector3 &) |
3-component vector, used to represent a point or distance in 3D space.
This object is in general compatible with the SbVec3 template in the Inventor library. However it allows direct access to the x,y,z members, which imho makes math using this much easier to read.
DD::Image::Vector3::Vector3 | ( | const float | v[3] | ) | [inline] |
Constructor from an array of numbers.
DD::Image::Vector3::Vector3 | ( | const double | v[3] | ) | [inline] |
Constructor from an array of numbers.
DD::Image::Vector3::Vector3 | ( | float | a, |
float | b, | ||
float | c | ||
) | [inline] |
Constructor that sets all 4 numbers
float& DD::Image::Vector3::operator[] | ( | int | i | ) | [inline] |
vector[0] is x, vector[1] is y, vector[2] is z.
const float& DD::Image::Vector3::operator[] | ( | int | i | ) | const [inline] |
vector[0] is x, vector[1] is y, vector[2] is z.
const float* DD::Image::Vector3::array | ( | ) | const [inline] |
Returns a ponter that can be passed to OpenGL
Referenced by DD::Image::Primitive::draw_normal(), DD::Image::Triangle::draw_solid_face(), DD::Image::Primitive::draw_solid_face(), DD::Image::Primitive::draw_solid_vertex(), and DD::Image::Primitive::draw_wireframe_vertex().
void DD::Image::Vector3::set | ( | float | a, |
float | b, | ||
float | c | ||
) | [inline] |
Change all of xyz.
Referenced by DD::Image::Material::engine(), DD::Image::Scene::Scene(), and DD::Image::Mesh::validate().
Vector3 DD::Image::Vector3::operator* | ( | float | d | ) | const [inline] |
Multiplies all 3 numbers. This will scale the length().
Vector3 DD::Image::Vector3::operator/ | ( | float | d | ) | const [inline] |
Divides all 3 numbers. This will scale the length().
Component-wise multiplication, useful for colors.
Component-wise division, useful for colors.
float DD::Image::Vector3::length | ( | ) | const [inline] |
Also known as the absolute value or magnitude of the vector.
Referenced by DD::Image::Matrix4::extractAndRemoveScalingAndShear(), DD::Image::Quaternion::Quaternion(), DD::Image::Random::randomUnitVector(), DD::Image::Random::randomUnitVectorXY(), and DD::Image::Random::randomVector().
float DD::Image::Vector3::distanceBetween | ( | const Vector3 & | v | ) | const [inline] |
Same as (this-v).length()
float DD::Image::Vector3::distanceSquared | ( | const Vector3 & | v | ) | const [inline] |
Same as (this-v).lengthSquared()
float DD::Image::Vector3::dot | ( | const Vector3 & | v | ) | const [inline] |
Dot product. Twice the area of the triangle between the vectors.
Referenced by DD::Image::Matrix4::extractAndRemoveScalingAndShear(), DD::Image::ComplexLightOp::get_color(), DD::Image::LightOp::get_shadowing(), DD::Image::Plane::Plane(), and DD::Image::Quaternion::Quaternion().
Cross product. This is a vector at right angles to the vectors with a length equal to the product of the lengths.
Referenced by DD::Image::Plane::Plane(), and DD::Image::Quaternion::Quaternion().
float DD::Image::Vector3::normalize | ( | ) | [inline] |
Change the vector to be unit length. Returns the original length.
Referenced by DD::Image::Mesh::get_face_normal(), DD::Image::LightOp::get_L_vector(), DD::Image::ComplexLightOp::get_L_vector(), DD::Image::LightOp::get_shadowing(), DD::Image::Plane::Plane(), DD::Image::Quaternion::Quaternion(), DD::Image::Triangle::validate(), and DD::Image::Mesh::vertex_normal().
float DD::Image::Vector3::fast_normalize | ( | ) | [inline] |
Uwe Behrens' fast-normalize method. Approximate normalization, returns approximate length.
Referenced by DD::Image::Primitive::draw_normal(), DD::Image::LightOp::get_L_vector(), DD::Image::ComplexLightOp::get_L_vector(), and DD::Image::Mesh::validate().
void DD::Image::Vector3::negate | ( | ) | [inline] |
Modifies it in-place, does not return the new value.
std::ostream& operator<< | ( | std::ostream & | o, |
const Vector3 & | |||
) | [friend] |
Writes it in nuke/tcl notation, with nested curly braces