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

vppoint3d.cpp

Go to the documentation of this file.
00001 //deprecated
00005 
00006 // Change log:
00007 // Sep 30/2004 - Bruno de Oliveira Schneider
00008 // - Added "const" to identify constant methods.
00009 // - Minor changes to DoxyGen documentation.
00010 // - Methods vp(Get|Set)(X|Y|Z) are no longer inline, because this would prevent
00011 //   step-by-step compilation. Implementation could be moved to header file, though.
00012 // Sep 15/2004 - Bruno de Oliveira Schneider
00013 // - Files have been replaced with the docs files (including DoxyGen comments)
00014 // - Code typing has been cleaned (tabs replaced by spaces, excessive spaces
00015 // - removed, etc.) in the headers file because tabs and spaces were mixed together.
00016 // April 18/2001 Isabel Harb Manssour
00017 // - Change of attributes.
00018 // August 10/2000 Isabel Harb Manssour
00019 // - Classes and new methods declaration.
00020 // January 20/2000 Isabel Harb Manssour
00021 // - New overload methods declaration.
00022 
00023 
00024 #include <cmath>
00025 #include <vppoint3d.h>
00026 
00027 VPPoint3D::VPPoint3D () {
00028     x = 0.0;
00029     y = 0.0;
00030     z = 0.0;
00031 }
00032 
00033 VPPoint3D::VPPoint3D (float xi, float yi, float zi) {
00034     x = xi;
00035     y = yi;
00036     z = zi;
00037 }
00038 
00039 float VPPoint3D::vpGetX() const {
00040     return x;
00041 }
00042 
00043 float VPPoint3D::vpGetY() const {
00044     return y;
00045 }
00046 
00047 float VPPoint3D::vpGetZ() const {
00048     return z;
00049 }
00050 
00051 void VPPoint3D::vpGetXY(float &xx, float &yy) const {
00052     xx = x;
00053     yy = y;
00054 }
00055 
00056 void VPPoint3D::vpGetXZ(float &xx, float &zz) const {
00057     xx = x;
00058     zz = z;
00059 }
00060 
00061 void VPPoint3D::vpGetYZ(float &yy, float &zz) const {
00062     yy = y;
00063     zz = z;
00064 }
00065 
00066 void VPPoint3D::vpGetXYZ(float &xx, float &yy, float &zz) const {
00067     xx = x; 
00068     yy = y;
00069     zz = z;
00070 }
00071 
00072 VPPoint3D VPPoint3D::vpGetPoint3D(void) const {
00073     return *this;
00074 }
00075 
00076 float* VPPoint3D::vpGetPointAsArray( void ) const
00077 {
00078     float* array = new float[3]; 
00079     array[0] = x; 
00080     array[1] = y; 
00081     array[2] = z; 
00082     return array;
00083 }
00084 
00085 void VPPoint3D::vpGetPoint(float v[]) const
00086 {
00087     v[0] = x;
00088     v[1] = y;
00089     v[2] = z;
00090 }
00091 
00092 void VPPoint3D::vpSetX(float xx) {
00093     x = xx;
00094 }
00095     
00096 void VPPoint3D::vpSetY(float yy) {
00097     y = yy;
00098 }
00099 
00100 void VPPoint3D::vpSetZ(float zz) {
00101     z = zz;
00102 }
00103 
00104 void VPPoint3D::vpSetXY(float xx, float yy) {
00105     x = xx;
00106     y = yy;
00107 }
00108 
00109 void VPPoint3D::vpSetXZ(float xx, float zz) {
00110     x = xx;
00111     z = zz;
00112 }
00113 
00114 void VPPoint3D::vpSetYZ(float yy, float zz) {
00115     y = yy;
00116     z = zz;
00117 }
00118 
00119 void VPPoint3D::vpSetXYZ(float xx, float yy, float zz) {
00120     x = xx;
00121     y = yy;
00122     z = zz;
00123 }
00124 
00125 VPPoint3D VPPoint3D::operator- (const VPPoint3D& p) const {
00126  VPPoint3D vv(x-p.x, y-p.y, z-p.z);
00127  return ( vv ) ;
00128 } 
00129 
00130 VPPoint3D VPPoint3D::operator+ (const VPPoint3D& p) const {
00131  VPPoint3D vv(x+p.x, y+p.y, z+p.z);
00132  return ( vv ) ;
00133 } 
00134 
00135 VPPoint3D VPPoint3D::operator= (VPPoint3D p) {
00136     x = p.x;
00137     y = p.y;
00138     z = p.z;
00139     return *this;
00140 }
00141 
00142 VPPoint3D VPPoint3D::operator-= (int num) 
00143 {
00144  x -= num;
00145  y -= num;
00146  z -= num;
00147  return *this;
00148 }
00149 
00150 VPPoint3D VPPoint3D::operator* (float num) 
00151 {
00152  x *= num;
00153  y *= num;
00154  z *= num;
00155  return *this;
00156 }
00157 
00158 bool VPPoint3D::operator!= (const VPPoint3D& p) const
00159 {
00160     if ( (x!=p.x) || (y!=p.y) || (z!=p.z) )
00161         return true;
00162     else
00163         return false;
00164 }
00165 
00166 bool VPPoint3D::operator== (const VPPoint3D& p) const
00167 {
00168     if ( (x==p.x) && (y==p.y) && (z==p.z) )
00169         return true;
00170     else
00171         return false;
00172 }
00173 
00174 bool VPPoint3D::operator<= (const VPPoint3D& p) const
00175 {
00176     if ( (x<=p.x) && (y<=p.y) && (z<=p.z) )
00177         return true;
00178     else
00179         return false;
00180 }
00181 
00182 bool VPPoint3D::operator< (const VPPoint3D& p) const
00183 {
00184     if ( (x<p.x) && (y<p.y) && (z<p.z) )
00185         return true;
00186     else
00187         return false;
00188 }
00189 
00190 bool VPPoint3D::operator>= (const VPPoint3D& p) const
00191 {
00192     if ( (x>=p.x) && (y>=p.y) && (z>=p.z) )
00193         return true;
00194     else
00195         return false;
00196 }
00197 
00198 bool VPPoint3D::operator> (const VPPoint3D& p) const {
00199     if ( (x>p.x) && (y>p.y) && (z>p.z) )
00200         return true;
00201     else
00202         return false;
00203 }
00204 
00205 float VPPoint3D::vpDistance(VPPoint3D p1) const {
00206     float d;
00207     d = (float)sqrt((x-p1.x)*(x-p1.x) +
00208              (y-p1.y)*(y-p1.y) +
00209              (z-p1.z)*(z-p1.z));
00210     return d;
00211 }

Generated on Tue Sep 6 10:00:05 2005 for VPAT by  doxygen 1.4.4