00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef OLENA_CORE_DPOINT3D_HXX
00029 # define OLENA_CORE_DPOINT3D_HXX
00030
00031 # include <oln/core/point3d.hh>
00032 # include <iostream>
00033
00034 namespace oln {
00035
00036 inline coord
00037 dpoint3d::slice() const
00038 {
00039 return nth(0);
00040 }
00041
00042 inline coord&
00043 dpoint3d::slice()
00044 {
00045 return nth(0);
00046 }
00047
00048 inline coord
00049 dpoint3d::row() const
00050 {
00051 return nth(1);
00052 }
00053
00054 inline coord&
00055 dpoint3d::row()
00056 {
00057 return nth(1);
00058 }
00059
00060 inline coord
00061 dpoint3d::col() const
00062 {
00063 return nth(2);
00064 }
00065
00066 inline coord&
00067 dpoint3d::col()
00068 {
00069 return nth(2);
00070 }
00071
00072 inline
00073 dpoint3d::dpoint3d()
00074 {
00075 slice() = 0;
00076 row() = 0;
00077 col() = 0;
00078 }
00079
00080 inline
00081 dpoint3d::dpoint3d(coord s, coord r, coord c)
00082 {
00083 slice() = s;
00084 row() = r;
00085 col() = c;
00086 }
00087
00088 inline
00089 dpoint3d::dpoint3d(const point3d& p) : super_type(p)
00090 {
00091 }
00092
00093 inline dpoint3d
00094 dpoint3d::minus() const
00095 {
00096 dpoint3d dp(-slice(), -row(), -col());
00097 return dp;
00098 }
00099
00100 inline dpoint3d&
00101 dpoint3d::plus_assign_dp(const dpoint3d& dp)
00102 {
00103 slice() += dp.slice();
00104 row() += dp.row();
00105 col() += dp.col();
00106 return *this;
00107 }
00108
00109 inline dpoint3d&
00110 dpoint3d::minus_assign_dp(const dpoint3d& dp)
00111 {
00112 slice() -= dp.slice();
00113 row() -= dp.row();
00114 col() -= dp.col();
00115 return *this;
00116 }
00117
00118 inline dpoint3d
00119 dpoint3d::plus_dp(const dpoint3d& dp) const
00120 {
00121 dpoint3d tmp = *this;
00122 tmp += dp;
00123 return tmp;
00124 }
00125
00126 inline dpoint3d
00127 dpoint3d::minus_dp(const dpoint3d& dp) const
00128 {
00129 dpoint3d tmp = *this;
00130 tmp -= dp;
00131 return tmp;
00132 }
00133
00134 }
00135
00136 inline std::ostream&
00137 operator<<(std::ostream& o, const oln::dpoint3d& dp)
00138 {
00139 return o << '(' << dp.slice() << ',' << dp.row() << ',' << dp.col() << ')';
00140 }
00141
00142 #endif // ! OLENA_CORE_DPOINT3D_HXX