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
00029
00030
00031
00032
00033
00034
00035 #ifndef pointHit_H
00036 #define pointHit_H
00037
00038 #include "bool.H"
00039 #include "point.H"
00040 #include "token.H"
00041
00042
00043
00044 namespace Foam
00045 {
00046
00047
00048
00049
00050
00051 class pointHit
00052 {
00053
00054
00055
00056 bool hit_;
00057
00058
00059 point hitPoint_;
00060
00061
00062 scalar distance_;
00063
00064
00065 bool eligibleMiss_;
00066
00067
00068 public:
00069
00070
00071
00072
00073 pointHit
00074 (
00075 const bool hit,
00076 const point& p,
00077 const scalar dist,
00078 const bool eligibleMiss
00079 )
00080 :
00081 hit_(hit),
00082 hitPoint_(p),
00083 distance_(dist),
00084 eligibleMiss_(eligibleMiss)
00085 {}
00086
00087
00088 pointHit(const point& p)
00089 :
00090 hit_(false),
00091 hitPoint_(p),
00092 distance_(GREAT),
00093 eligibleMiss_(false)
00094 {}
00095
00096
00097
00098
00099
00100 bool hit() const
00101 {
00102 return hit_;
00103 }
00104
00105
00106 const point& hitPoint() const
00107 {
00108 if (!hit_)
00109 {
00110 FatalErrorIn("const point& pointHit::hitPoint() const")
00111 << "requested a hit point for a miss"
00112 << abort(FatalError);
00113 }
00114
00115 return hitPoint_;
00116 }
00117
00118
00119 scalar distance() const
00120 {
00121 return distance_;
00122 }
00123
00124
00125 const point& missPoint() const
00126 {
00127 if (hit_)
00128 {
00129 FatalErrorIn("const point& pointHit::missPoint() const")
00130 << "requested a miss point for a hit"
00131 << abort(FatalError);
00132 }
00133
00134 return hitPoint_;
00135 }
00136
00137
00138 const point& rawPoint() const
00139 {
00140 return hitPoint_;
00141 }
00142
00143
00144 bool eligibleMiss() const
00145 {
00146 return eligibleMiss_;
00147 }
00148
00149 void setHit()
00150 {
00151 hit_ = true;
00152 eligibleMiss_ = false;
00153 }
00154
00155 void setMiss(const bool eligible)
00156 {
00157 hit_ = false;
00158 eligibleMiss_ = eligible;
00159 }
00160
00161 void setPoint(const point& p)
00162 {
00163 hitPoint_ = p;
00164 }
00165
00166 void setDistance(const scalar d)
00167 {
00168 distance_ = d;
00169 }
00170
00171
00172
00173
00174 friend Ostream& operator<<(Ostream& os, const pointHit& b)
00175 {
00176 os << b.hit() << token::SPACE
00177 << b.rawPoint() << token::SPACE
00178 << b.distance() << token::SPACE
00179 << b.eligibleMiss();
00180
00181 return os;
00182 }
00183 };
00184
00185
00186
00187
00188 }
00189
00190
00191
00192 #endif
00193
00194