Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

math/point.cpp

Go to the documentation of this file.
00001 #include "point.h"
00002 
00007 #include "matrix4.h"
00008 
00009 Point::Point()
00010 : Vector(Vector0), _normal(Vector0), _texture(Vector0)
00011 {
00012 }
00013 
00014 Point::Point(const Vector &pos,const Vector &normal)
00015 : Vector(pos), _normal(normal), _texture(Vector0)
00016 {
00017 }
00018 
00019 Point::Point(const Vector &pos,const Vector &normal,const Vector &texture)
00020 : Vector(pos), _normal(normal), _texture(texture)
00021 {
00022 }
00023 
00024 Point::Point(const double &x,const double &y,const double &z)
00025 : Vector(x,y,z), _normal(Vector0), _texture(Vector0)
00026 {
00027 }
00028 
00029       Vector &Point::position()       { return *this; }
00030 const Vector &Point::position() const { return *this; }
00031 
00032       Vector &Point::normal()         { return _normal; }
00033 const Vector &Point::normal() const   { return _normal; }
00034 
00035       Vector &Point::texture()        { return _texture; }
00036 const Vector &Point::texture() const  { return _texture; }
00037 
00038 bool 
00039 Point::operator==(const Point &vector) const
00040 {
00041     if (this==&vector)
00042         return true;
00043 
00044     return 
00045         Vector::operator==(vector) && 
00046         _normal ==vector._normal   &&
00047         _texture==vector._texture;
00048 }
00049 
00050 bool 
00051 Point::operator!=(const Point &vector) const
00052 {
00053     if (this==&vector)
00054         return false;
00055 
00056     return 
00057         Vector::operator!=(vector) || 
00058         _texture!=vector._texture  ||
00059         _normal!=vector._normal;
00060 }
00061 
00062 
00063 void
00064 Point::transform(const Matrix &trans)
00065 {
00066     position() = trans * position();
00067     normal()  = trans * normal() - trans * Vector0;
00068 }

Generated on Tue Nov 5 11:11:04 2002 for GLT by doxygen1.2.18