Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Point.h

Go to the documentation of this file.
00001 
00007 /***************************************************************************
00008  *   Copyright (C) 2005 by Hari sundar   *
00009  *   hsundar@seas.upenn.edu   *
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  *   This program is distributed in the hope that it will be useful,       *
00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00019  *   GNU General Public License for more details.                          *
00020  *                                                                         *
00021  *   You should have received a copy of the GNU General Public License     *
00022  *   along with this program; if not, write to the                         *
00023  *   Free Software Foundation, Inc.,                                       *
00024  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00025 ***************************************************************************/
00026 #ifndef __POINT_H
00027 #define __POINT_H
00028 
00029 #include  <cmath>
00030 
00035 class Point{
00036   public:
00037 
00040     Point();
00041     virtual ~Point();
00042 
00043     Point(double newx, double newy, double newz);
00044     Point(int newx, int newy, int newz);
00045     Point(unsigned int newx, unsigned int newy, unsigned int newz);
00046     Point(const Point &newpoint);
00048 
00051     double& x() {return _x; };
00052     double& y() {return _y; };
00053     double& z() {return _z; };
00054 
00055     int xint() const {return static_cast<int>(_x); };
00056     int yint() const {return static_cast<int>(_y); };
00057     int zint() const {return static_cast<int>(_z); };
00059 
00062     Point operator-() const;
00063 
00064     void operator += (const Point &other);
00065     void operator /= (const int divisor);
00066     void operator /= (const double divisor);
00067     void operator *= (const int factor);
00068     void operator *= (const double factor);
00069 
00070     Point& operator=(const Point &other);
00071     Point  operator+(const Point &other);
00072     Point  operator-(const Point &other);
00073     Point  operator-(const Point &other) const;
00074 
00075     Point  operator/(const double divisor);
00076     Point  operator*(const double factor);
00077 
00078     inline bool operator != (const Point &other) { return ( (xint() != other.xint() ) || (yint() != other.yint()) || (zint() != other.zint())); };
00079 
00080     inline bool operator == (const Point &other) { return ( ( xint() == other.xint() ) && ( yint() == other.yint()) && ( zint() == other.zint())); };
00082 
00083     inline double dot(Point Other) { 
00084       return  (_x*Other._x+_y*Other._y+_z*Other._z);
00085     };                          
00086 
00087     inline Point cross(Point  Other){
00088       return  Point(_y*Other._z-Other._y*_z, _z*Other._x-_x*Other._z, 
00089           _x*Other._y-_y*Other._x); 
00090     };
00091 
00092     inline double abs(){
00093       return sqrt(_x*_x+_y*_y+_z*_z); 
00094     };
00095 
00096     void normalize();
00097 
00098     static Point TransMatMultiply( double* transMat, Point inPoint);
00099   protected:
00100     double _x;
00101     double _y;
00102     double _z;
00103 };
00104 
00105 #endif // POINT_H

Generated on Tue Mar 24 16:14:03 2009 for DENDRO by  doxygen 1.3.9.1