Jpp  16.0.2
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Attributes | Friends | List of all members
JGEOMETRY3D::JCylinder3D Class Reference

Cylinder object. More...

#include <JCylinder3D.hh>

Inheritance diagram for JGEOMETRY3D::JCylinder3D:
JGEOMETRY2D::JCircle2D JGEOMETRY2D::JPosition2D JGEOMETRY2D::JVector2D JMATH::JMath< JFirst_t, JSecond_t >

Public Types

typedef std::pair< double, double > intersection_type
 Type definition of intersection. More...
 

Public Member Functions

 JCylinder3D ()
 Default constructor. More...
 
 JCylinder3D (const JCircle2D &circle, const double zmin, const double zmax)
 Constructor. More...
 
template<class T >
 JCylinder3D (T __begin, T __end, const double precision=std::numeric_limits< double >::epsilon())
 Constructor. More...
 
double getZmin () const
 Get minimal z position. More...
 
double getZmax () const
 Get maximal z position. More...
 
void setZmin (const double zmin)
 Set minimal z position. More...
 
void setZmax (const double zmax)
 Set maximal z position. More...
 
JCylinder3Dadd (const JVector3D &pos)
 Add position. More...
 
void addMargin (const double D)
 Add (safety) margin. More...
 
double getVolume () const
 Get volume. More...
 
JPosition3D getCenter () const
 Get centre. More...
 
bool is_inside (const JVector3D &pos) const
 Check whether given point is inside cylinder. More...
 
double getDistance (const JVector3D &pos) const
 Get distance between cylinder wall and given position. More...
 
double getDistanceSquared (const JVector3D &pos) const
 Get square of distance between cylinder wall and given position. More...
 
intersection_type getIntersection (const JAxis3D &axis) const
 Get intersection points of axis with cylinder. More...
 
double getRadius () const
 Get radius. More...
 
void set (const JVector2D &p0, const JVector2D &p1)
 Set circle. More...
 
void set (const JVector2D &p0, const JVector2D &p1, const JVector2D &p2, const double precision=std::numeric_limits< double >::epsilon())
 Set circle. More...
 
template<class T >
void set (T __begin, T __end, const double precision=std::numeric_limits< double >::epsilon())
 Set circle. More...
 
bool is_inside (const JVector2D &pos, const double precision=std::numeric_limits< double >::min()) const
 Check whether given point is inside circle. More...
 
const JPosition2DgetPosition () const
 Get position. More...
 
JPosition2DgetPosition ()
 Get position. More...
 
void setPosition (const JVector2D &pos)
 Set position. More...
 
 operator JAngle2D () const
 Type conversion operator. More...
 
 operator JVersor2D () const
 Type conversion operator. More...
 
JPosition2Drotate (const JRotation2D &R)
 Rotate. More...
 
JPosition2Drotate_back (const JRotation2D &R)
 Rotate back. More...
 
double getDot (const JAngle2D &angle) const
 Get dot product. More...
 
double getDot (const JVersor2D &versor) const
 Get dot product. More...
 
double getDot (const JVector2D &point) const
 Get dot product. More...
 
double getPerpDot (const JAngle2D &angle) const
 Get perpendicular dot product. More...
 
double getPerpDot (const JVersor2D &dir) const
 Get perpendicular dot product. More...
 
double getPerpDot (const JVector2D &point) const
 Get perpendicular dot product. More...
 
double getX () const
 Get x position. More...
 
double getY () const
 Get y position. More...
 
JVector2Dnegate ()
 Negate vector. More...
 
JVector2Dadd (const JVector2D &vector)
 Add vector. More...
 
JVector2Dsub (const JVector2D &vector)
 Subtract vector. More...
 
JVector2Dmul (const double factor)
 Scale vector. More...
 
JFirst_t & mul (const JSecond_t &object)
 Multiply with object. More...
 
JVector2Ddiv (const double factor)
 Scale vector. More...
 
JVector2Dtransform (const JMatrix2D &T)
 Transform. More...
 
bool equals (const JVector2D &vector, const double precision=std::numeric_limits< double >::min()) const
 Check equality. More...
 
double getLengthSquared () const
 Get length squared. More...
 
double getLength () const
 Get length. More...
 
double getDistanceSquared (const JVector2D &point) const
 Get squared of distance to point. More...
 
double getDistance (const JVector2D &point) const
 Get distance to point. More...
 

Protected Attributes

double zmin
 
double zmax
 
double __r
 
double __x
 
double __y
 

Friends

std::istream & operator>> (std::istream &in, JCylinder3D &cylinder)
 Read cylinder from input stream. More...
 
std::ostream & operator<< (std::ostream &out, const JCylinder3D &cylinder)
 Write cylinder to output stream. More...
 
JReaderoperator>> (JReader &in, JCylinder3D &cylinder)
 Read cylinder from input. More...
 
JWriteroperator<< (JWriter &out, const JCylinder3D &cylinder)
 Write cylinder to output. More...
 

Detailed Description

Cylinder object.

The cylinder consists of a 2D circle in the (x,y) plane and a range in z (i.e. axis of cylinder is parallel to the z-axis).

Definition at line 39 of file JCylinder3D.hh.

Member Typedef Documentation

Type definition of intersection.

Definition at line 46 of file JCylinder3D.hh.

Constructor & Destructor Documentation

JGEOMETRY3D::JCylinder3D::JCylinder3D ( )
inline

Default constructor.

Definition at line 52 of file JCylinder3D.hh.

52  :
53  JCircle2D(),
54  zmin(0.0),
55  zmax(0.0)
56  {}
JCircle2D()
Default constructor.
Definition: JCircle2D.hh:40
JGEOMETRY3D::JCylinder3D::JCylinder3D ( const JCircle2D circle,
const double  zmin,
const double  zmax 
)
inline

Constructor.

Parameters
circle2D circle in (x,y)
zminminimal z
zmaxmaximal z

Definition at line 66 of file JCylinder3D.hh.

68  :
69  JCircle2D(circle)
70  {
71  this->zmin = zmin;
72  this->zmax = zmax;
73  }
JCircle2D()
Default constructor.
Definition: JCircle2D.hh:40
template<class T >
JGEOMETRY3D::JCylinder3D::JCylinder3D ( T  __begin,
T  __end,
const double  precision = std::numeric_limits<double>::epsilon() 
)
inline

Constructor.

Determines smallest enclosing cylinder for any number of points.

Parameters
__beginbegin of data
__endend of data
precisionprecision

Definition at line 86 of file JCylinder3D.hh.

88  :
89  JCircle2D(__begin, __end, precision),
90  zmin(0.0),
91  zmax(0.0)
92  {
93  if (__begin != __end) {
94 
95  zmin = std::numeric_limits<double>::max();
96  zmax = std::numeric_limits<double>::lowest();
97 
98  for (T i = __begin; i != __end; ++i) {
99  if (i->getZ() < zmin) zmin = i->getZ();
100  if (i->getZ() > zmax) zmax = i->getZ();
101  }
102  }
103  }
JCircle2D()
Default constructor.
Definition: JCircle2D.hh:40
do set_variable OUTPUT_DIRECTORY $WORKDIR T

Member Function Documentation

double JGEOMETRY3D::JCylinder3D::getZmin ( ) const
inline

Get minimal z position.

Returns
minimal z position

Definition at line 111 of file JCylinder3D.hh.

112  {
113  return zmin;
114  }
double JGEOMETRY3D::JCylinder3D::getZmax ( ) const
inline

Get maximal z position.

Returns
maximal z position

Definition at line 122 of file JCylinder3D.hh.

123  {
124  return zmax;
125  }
void JGEOMETRY3D::JCylinder3D::setZmin ( const double  zmin)
inline

Set minimal z position.

Parameters
zminminimal z position

Definition at line 133 of file JCylinder3D.hh.

134  {
135  this->zmin = zmin;
136  }
void JGEOMETRY3D::JCylinder3D::setZmax ( const double  zmax)
inline

Set maximal z position.

Parameters
zmaxmaximal z position

Definition at line 144 of file JCylinder3D.hh.

145  {
146  this->zmax = zmax;
147  }
JCylinder3D& JGEOMETRY3D::JCylinder3D::add ( const JVector3D pos)
inline

Add position.

Parameters
posposition
Returns
this cylinder

Definition at line 156 of file JCylinder3D.hh.

157  {
158  static_cast<JPosition2D&>(*this).add(JPosition2D(pos.getX(), pos.getY()));
159 
160  zmin += pos.getZ();
161  zmax += pos.getZ();
162 
163  return *this;
164  }
JPosition2D()
Default constructor.
Definition: JPosition2D.hh:44
double getY() const
Get y position.
Definition: JVector3D.hh:104
double getX() const
Get x position.
Definition: JVector3D.hh:94
double getZ() const
Get z position.
Definition: JVector3D.hh:115
void JGEOMETRY3D::JCylinder3D::addMargin ( const double  D)
inline

Add (safety) margin.

Parameters
Dmargin
Returns
this cylinder

Definition at line 173 of file JCylinder3D.hh.

174  {
175  __r += D;
176  zmin -= D;
177  zmax += D;
178  }
do echo Generating $dir eval D
Definition: JDrawLED.sh:53
double JGEOMETRY3D::JCylinder3D::getVolume ( ) const
inline

Get volume.

Returns
volume

Definition at line 186 of file JCylinder3D.hh.

187  {
188  return (getZmax ()- getZmin()) * JMATH::PI * getRadius() * getRadius();
189  }
double getRadius() const
Get radius.
Definition: JCircle2D.hh:144
double getZmin() const
Get minimal z position.
Definition: JCylinder3D.hh:111
static const double PI
Mathematical constants.
double getZmax() const
Get maximal z position.
Definition: JCylinder3D.hh:122
JPosition3D JGEOMETRY3D::JCylinder3D::getCenter ( ) const
inline

Get centre.

Returns
centre

Definition at line 197 of file JCylinder3D.hh.

198  {
199  return JPosition3D(getPosition(), (getZmax() - getZmin())/2.0);
200  }
const JPosition2D & getPosition() const
Get position.
Definition: JPosition2D.hh:98
double getZmin() const
Get minimal z position.
Definition: JCylinder3D.hh:111
double getZmax() const
Get maximal z position.
Definition: JCylinder3D.hh:122
Data structure for position in three dimensions.
Definition: JPosition3D.hh:36
bool JGEOMETRY3D::JCylinder3D::is_inside ( const JVector3D pos) const
inline

Check whether given point is inside cylinder.

Parameters
posposition
Returns
true if inside; else false

Definition at line 209 of file JCylinder3D.hh.

210  {
211  return (pos.getZ() >= getZmin() &&
212  pos.getZ() <= getZmax() &&
213  JCircle2D::is_inside(JVector2D(pos.getX(), pos.getY())));
214  }
JVector2D()
Default constructor.
Definition: JVector2D.hh:39
double getZmin() const
Get minimal z position.
Definition: JCylinder3D.hh:111
bool is_inside(const JVector2D &pos, const double precision=std::numeric_limits< double >::min()) const
Check whether given point is inside circle.
Definition: JCircle2D.hh:270
double getY() const
Get y position.
Definition: JVector3D.hh:104
double getZmax() const
Get maximal z position.
Definition: JCylinder3D.hh:122
double getX() const
Get x position.
Definition: JVector3D.hh:94
double getZ() const
Get z position.
Definition: JVector3D.hh:115
double JGEOMETRY3D::JCylinder3D::getDistance ( const JVector3D pos) const
inline

Get distance between cylinder wall and given position.

Parameters
posposition
Returns
distance

Definition at line 223 of file JCylinder3D.hh.

224  {
225  JVector2D D(pos);
226 
227  D.sub(*this);
228 
229  double R = D.getLength();
230 
231  if (R > this->getRadius()) {
232 
233  R -= this->getRadius();
234 
235  double dz = 0.0;
236 
237  if (pos.getZ() > this->getZmax())
238  dz = pos.getZ() - this->getZmax();
239  else if (pos.getZ() < this->getZmin())
240  dz = this->getZmin() - pos.getZ();
241  else
242  return R;
243 
244  return sqrt(R*R + dz*dz);
245 
246  } else {
247 
248  if (pos.getZ() > this->getZmax())
249  return pos.getZ() - this->getZmax();
250  else if (pos.getZ() < this->getZmin())
251  return this->getZmin() - pos.getZ();
252  else
253  return 0.0;
254  }
255  }
double getRadius() const
Get radius.
Definition: JCircle2D.hh:144
JVector2D()
Default constructor.
Definition: JVector2D.hh:39
double getZmin() const
Get minimal z position.
Definition: JCylinder3D.hh:111
then usage $script[distance] fi case set_variable R
Definition: JDrawLED.sh:43
double getZmax() const
Get maximal z position.
Definition: JCylinder3D.hh:122
do echo Generating $dir eval D
Definition: JDrawLED.sh:53
double getZ() const
Get z position.
Definition: JVector3D.hh:115
double JGEOMETRY3D::JCylinder3D::getDistanceSquared ( const JVector3D pos) const
inline

Get square of distance between cylinder wall and given position.

Parameters
posposition
Returns
square of distance

Definition at line 264 of file JCylinder3D.hh.

265  {
266  const double d = getDistance(pos);
267 
268  return d*d;
269  }
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
Definition: JMuonPath.sh:47
double getDistance(const JVector3D &pos) const
Get distance between cylinder wall and given position.
Definition: JCylinder3D.hh:223
intersection_type JGEOMETRY3D::JCylinder3D::getIntersection ( const JAxis3D axis) const
inline

Get intersection points of axis with cylinder.

Parameters
axisaxis
Returns
up and down stream positions along axis

Definition at line 278 of file JCylinder3D.hh.

279  {
280  double path[] = { 0.0, 0.0 };
281 
282  if (fabs(axis.getDZ()) != 0.0) {
283 
284  // intersection with bottom or top surface
285 
286  const double Z[] = {
287  axis.getDZ() > 0 ? this->getZmin() : this->getZmax(),
288  axis.getDZ() > 0 ? this->getZmax() : this->getZmin()
289  };
290 
291  for (int i = 0; i != 2; ++i) {
292 
293  const double u = (Z[i] - axis.getZ()) / axis.getDZ();
294  const double x = axis.getX() + u * axis.getDX() - this->getX();
295  const double y = axis.getY() + u * axis.getDY() - this->getY();
296 
297  if (x*x + y*y <= this->getRadius() * this->getRadius()) {
298  path[i] = u;
299  }
300  }
301  }
302 
303  if (fabs(axis.getDZ()) != 1.0) {
304 
305  // intersection with cylinder wall
306 
307  const double x = axis.getX() - this->getX();
308  const double y = axis.getY() - this->getY();
309  const double dx = axis.getDX();
310  const double dy = axis.getDY();
311  const double R = this->getRadius();
312 
313  const double a = (dx * dx + dy * dy);
314  const double b = 2*(dx * x + dy * y);
315  const double c = (x * x + y * y) - R * R;
316 
317  const double q = b*b - 4*a*c;
318 
319  if (q >= 0) {
320 
321  const double u[] = {
322  (-b - sqrt(q)) / (2*a),
323  (-b + sqrt(q)) / (2*a)
324  };
325 
326  for (int i = 0; i != 2; ++i) {
327 
328  const double z = axis.getZ() + u[i] * axis.getDZ();
329 
330  if (z >= this->getZmin() && z <= this->getZmax()) {
331  path[i] = u[i];
332  }
333  }
334  }
335  }
336 
337  return std::make_pair(path[0], path[1]);
338  }
double getRadius() const
Get radius.
Definition: JCircle2D.hh:144
double getZmin() const
Get minimal z position.
Definition: JCylinder3D.hh:111
then usage $script< detector file >< detectorfile > nIf the range of floors is the first detector file is aligned to the second before the comparison nIn this
double getY() const
Get y position.
Definition: JVector2D.hh:74
double getDY() const
Get y direction.
Definition: JVersor3D.hh:106
double getDX() const
Get x direction.
Definition: JVersor3D.hh:95
double getX() const
Get x position.
Definition: JVector2D.hh:63
double getY() const
Get y position.
Definition: JVector3D.hh:104
$WORKDIR driver txt done cat $WORKDIR driver txt<< EOFprocess ${DATAFILTER}$FILTER_HOST csh-c '(setenv ROOTSYS $ROOTSYS &&source $JPP_DIR/setenv.csh $JPP_DIR &&(JDataFilter-H\$SERVER\$-M\$LOGGER\$-d $DEBUG-u ${DATAFILTER}-P $PORT</dev/null > &/dev/null &))';process ${DATAWRITER}$WRITER_HOST csh-c '(setenv ROOTSYS $ROOTSYS &&source $JPP_DIR/setenv.csh $JPP_DIR &&(JDataWriter-H\$SERVER\$-M\$LOGGER\$-d $DEBUG-u ${DATAWRITER}</dev/null > &/dev/null &))';print enterevent ev_init{RC_CMD}event ev_reset{RC_CMD}event ev_init{RC_CMD}event ev_configure{RC_DFLTR%<$WORKDIR/ev_configure_datafilter.txt > RC_DOM<$WORKDIR/ev_configure_domsimulator.txt > RC_DWRT path
then usage $script[distance] fi case set_variable R
Definition: JDrawLED.sh:43
double getZmax() const
Get maximal z position.
Definition: JCylinder3D.hh:122
then JCalibrateToT a
Definition: JTuneHV.sh:116
double getX() const
Get x position.
Definition: JVector3D.hh:94
do set_variable MODULE getModule a $WORKDIR detector_a datx L $STRING JEditDetector a $WORKDIR detector_a datx M $MODULE setz o $WORKDIR detector_a datx JEditDetector a $WORKDIR detector_b datx M $MODULE setz o $WORKDIR detector_b datx done echo Output stored at $WORKDIR detector_a datx and $WORKDIR tripod_a txt JDrawDetector2D a $WORKDIR detector_a datx a $WORKDIR detector_b datx L BL o detector $FORMAT $BATCH JDrawDetector2D T $WORKDIR tripod_a txt T $WORKDIR tripod_b txt L BL o tripod $FORMAT $BATCH JCompareDetector a $WORKDIR detector_a datx b $WORKDIR detector_b datx o $WORKDIR abc root &dev null for KEY in X Y Z
$WORKDIR ev_configure_domsimulator txt echo process $DOM_SIMULATOR $i $SOURCE_HOST[$index] csh c(setenv ROOTSYS $ROOTSYS &&source $JPP_DIR/setenv.csh $JPP_DIR &&($DOM_SIMULATOR\-u\$NAME\$\-H\$SERVER\$\-M\$LOGGER\$\-d $DEBUG</dev/null > &/dev/null &))'
double u[N+1]
Definition: JPolint.hh:755
double getZ() const
Get z position.
Definition: JVector3D.hh:115
double getDZ() const
Get z direction.
Definition: JVersor3D.hh:117
double JGEOMETRY2D::JCircle2D::getRadius ( ) const
inlineinherited

Get radius.

Returns
radius

Definition at line 144 of file JCircle2D.hh.

145  {
146  return __r;
147  }
void JGEOMETRY2D::JCircle2D::set ( const JVector2D p0,
const JVector2D p1 
)
inlineinherited

Set circle.

Determines circle through two points.

Parameters
p0first point
p1second point

Definition at line 157 of file JCircle2D.hh.

159  {
160  __x = 0.5 * (p0.getX() + p1.getX());
161  __y = 0.5 * (p0.getY() + p1.getY());
162  __r = this->getDistance(p0);
163  }
double getDistance(const JVector2D &point) const
Get distance to point.
Definition: JVector2D.hh:223
double getY() const
Get y position.
Definition: JVector2D.hh:74
double getX() const
Get x position.
Definition: JVector2D.hh:63
void JGEOMETRY2D::JCircle2D::set ( const JVector2D p0,
const JVector2D p1,
const JVector2D p2,
const double  precision = std::numeric_limits<double>::epsilon() 
)
inlineinherited

Set circle.

Determines circle through three points.

Parameters
p0first point
p1second point
p2third point
precisionprecision

Definition at line 175 of file JCircle2D.hh.

179  {
180  const double x0 = p2.getX() - p1.getX();
181  const double x1 = p0.getX() - p2.getX();
182  const double x2 = p1.getX() - p0.getX();
183 
184  const double y0 = p1.getY() - p2.getY();
185  const double y1 = p2.getY() - p0.getY();
186  const double y2 = p0.getY() - p1.getY();
187 
188  const double D = 2.0 * (p0.getX()*y0 + p1.getX()*y1 + p2.getX()*y2);
189 
190  if (fabs(D) > precision) {
191 
192  const double a = p0.getLengthSquared();
193  const double b = p1.getLengthSquared();
194  const double c = p2.getLengthSquared();
195 
196  __x = (a*y0 + b*y1 + c*y2) / D;
197  __y = (a*x0 + b*x1 + c*x2) / D;
198  __r = this->getDistance(p0);
199 
200  } else {
201 
202  set(p0, p1);
203 
204  const JCircle2D c1(p1, p2);
205  const JCircle2D c2(p0, p2);
206 
207  if (c1.getRadius() > this->getRadius()) { *this = c1; }
208  if (c2.getRadius() > this->getRadius()) { *this = c2; }
209  }
210  }
double getLengthSquared() const
Get length squared.
Definition: JVector2D.hh:188
double getRadius() const
Get radius.
Definition: JCircle2D.hh:144
Data structure for circle in two dimensions.
Definition: JCircle2D.hh:33
double getDistance(const JVector2D &point) const
Get distance to point.
Definition: JVector2D.hh:223
double getY() const
Get y position.
Definition: JVector2D.hh:74
double getX() const
Get x position.
Definition: JVector2D.hh:63
TCanvas * c1
Global variables to handle mouse events.
then JCalibrateToT a
Definition: JTuneHV.sh:116
$WORKDIR ev_configure_domsimulator txt echo process $DOM_SIMULATOR $i $SOURCE_HOST[$index] csh c(setenv ROOTSYS $ROOTSYS &&source $JPP_DIR/setenv.csh $JPP_DIR &&($DOM_SIMULATOR\-u\$NAME\$\-H\$SERVER\$\-M\$LOGGER\$\-d $DEBUG</dev/null > &/dev/null &))'
void set(const JVector2D &p0, const JVector2D &p1)
Set circle.
Definition: JCircle2D.hh:157
do echo Generating $dir eval D
Definition: JDrawLED.sh:53
template<class T >
void JGEOMETRY2D::JCircle2D::set ( T  __begin,
T  __end,
const double  precision = std::numeric_limits<double>::epsilon() 
)
inlineinherited

Set circle.

Determines smallest enclosing circle around set of points.

    double getX();   // x coordinate
    double getY();   // y coordinate
Parameters
__beginbegin of data
__endend of data
precisionprecision

Definition at line 226 of file JCircle2D.hh.

229  {
230  if (__begin != __end) {
231 
232  __x = __begin->getX();
233  __y = __begin->getY();
234  __r = 0.0;
235 
236  T i = __begin;
237 
238  const JVector2D p0(i->getX(), i->getY());
239 
240  while (++i != __end && p0.getDistance(JVector2D(i->getX(), i->getY())) <= precision) {}
241 
242  if (i != __end) {
243 
244  const JVector2D p1(i->getX(), i->getY());
245 
246  set(p0, p1);
247 
248  while (++i != __end) {
249 
250  const JVector2D p2(i->getX(), i->getY());
251 
252  if (this->getDistance(p2) > this->getRadius() + precision &&
253  p0.getDistance(p2) > precision &&
254  p1.getDistance(p2) > precision) {
255  configure(__begin, i, p2, precision);
256  }
257  }
258  }
259  }
260  }
Data structure for vector in two dimensions.
Definition: JVector2D.hh:32
double getRadius() const
Get radius.
Definition: JCircle2D.hh:144
TPaveText * p1
double getDistance(const JVector2D &point) const
Get distance to point.
Definition: JVector2D.hh:223
do set_variable OUTPUT_DIRECTORY $WORKDIR T
void configure(T __begin, T __end, const JVector2D &p0, const double precision)
Determine smallest enclosing circle.
Definition: JCircle2D.hh:358
p2
Definition: module-Z:fit.sh:74
void set(const JVector2D &p0, const JVector2D &p1)
Set circle.
Definition: JCircle2D.hh:157
bool JGEOMETRY2D::JCircle2D::is_inside ( const JVector2D pos,
const double  precision = std::numeric_limits<double>::min() 
) const
inlineinherited

Check whether given point is inside circle.

Parameters
posposition
precisionprecision
Returns
true if inside; else false

Definition at line 270 of file JCircle2D.hh.

272  {
273  return (this->getDistance(pos) <= this->getRadius() + precision);
274  }
double getRadius() const
Get radius.
Definition: JCircle2D.hh:144
double getDistance(const JVector2D &point) const
Get distance to point.
Definition: JVector2D.hh:223
const JPosition2D& JGEOMETRY2D::JPosition2D::getPosition ( ) const
inlineinherited

Get position.

Returns
position

Definition at line 98 of file JPosition2D.hh.

99  {
100  return static_cast<const JPosition2D&>(*this);
101  }
Data structure for position in two dimensions.
Definition: JPosition2D.hh:31
JPosition2D& JGEOMETRY2D::JPosition2D::getPosition ( )
inlineinherited

Get position.

Returns
position

Definition at line 109 of file JPosition2D.hh.

110  {
111  return static_cast<JPosition2D&>(*this);
112  }
Data structure for position in two dimensions.
Definition: JPosition2D.hh:31
void JGEOMETRY2D::JPosition2D::setPosition ( const JVector2D pos)
inlineinherited

Set position.

Parameters
posposition

Definition at line 120 of file JPosition2D.hh.

121  {
122  static_cast<JVector2D&>(*this) = pos;
123  }
Data structure for vector in two dimensions.
Definition: JVector2D.hh:32
JGEOMETRY2D::JPosition2D::operator JAngle2D ( ) const
inlineinherited

Type conversion operator.

Returns
angle

Definition at line 131 of file JPosition2D.hh.

132  {
133  return JAngle2D(getX(), getY());
134  }
Data structure for angle in two dimensions.
Definition: JAngle2D.hh:33
double getY() const
Get y position.
Definition: JVector2D.hh:74
double getX() const
Get x position.
Definition: JVector2D.hh:63
JGEOMETRY2D::JPosition2D::operator JVersor2D ( ) const
inlineinherited

Type conversion operator.

Returns
direction

Definition at line 142 of file JPosition2D.hh.

143  {
144  return JVersor2D(getX(), getY());
145  }
double getY() const
Get y position.
Definition: JVector2D.hh:74
Data structure for normalised vector in two dimensions.
Definition: JVersor2D.hh:20
double getX() const
Get x position.
Definition: JVector2D.hh:63
JPosition2D& JGEOMETRY2D::JPosition2D::rotate ( const JRotation2D R)
inlineinherited

Rotate.

Parameters
Rrotation matrix
Returns
this position

Definition at line 154 of file JPosition2D.hh.

155  {
156  R.rotate(__x, __y);
157 
158  return *this;
159  }
void rotate(double &__x, double &__y) const
Rotate.
Definition: JRotation2D.hh:96
JPosition2D& JGEOMETRY2D::JPosition2D::rotate_back ( const JRotation2D R)
inlineinherited

Rotate back.

Parameters
Rrotation matrix
Returns
this position

Definition at line 168 of file JPosition2D.hh.

169  {
170  R.rotate_back(__x, __y);
171 
172  return *this;
173  }
void rotate_back(double &__x, double &__y) const
Rotate back.
Definition: JRotation2D.hh:112
double JGEOMETRY2D::JPosition2D::getDot ( const JAngle2D angle) const
inlineinherited

Get dot product.

Parameters
angleangle
Returns
dot product

Definition at line 182 of file JPosition2D.hh.

183  {
184  return
185  getX() * angle.getDX() +
186  getY() * angle.getDY();
187  }
double getDX() const
Get x direction.
Definition: JAngle2D.hh:83
double getY() const
Get y position.
Definition: JVector2D.hh:74
double getX() const
Get x position.
Definition: JVector2D.hh:63
double getDY() const
Get y direction.
Definition: JAngle2D.hh:94
double JGEOMETRY2D::JPosition2D::getDot ( const JVersor2D versor) const
inlineinherited

Get dot product.

Parameters
versorversor
Returns
dot product

Definition at line 196 of file JPosition2D.hh.

197  {
198  return
199  getX() * versor.getDX() +
200  getY() * versor.getDY();
201  }
double getY() const
Get y position.
Definition: JVector2D.hh:74
double getDX() const
Get x direction.
Definition: JVersor2D.hh:53
double getX() const
Get x position.
Definition: JVector2D.hh:63
double getDY() const
Get y direction.
Definition: JVersor2D.hh:64
double JGEOMETRY2D::JVector2D::getDot ( const JVector2D point) const
inlineinherited

Get dot product.

Parameters
pointvector
Returns
dot product

Definition at line 235 of file JVector2D.hh.

236  {
237  return
238  getX() * point.getX() +
239  getY() * point.getY();
240  }
double getY() const
Get y position.
Definition: JVector2D.hh:74
double getX() const
Get x position.
Definition: JVector2D.hh:63
double JGEOMETRY2D::JPosition2D::getPerpDot ( const JAngle2D angle) const
inlineinherited

Get perpendicular dot product.

Parameters
angleangle
Returns
perpendicular dot product

Definition at line 210 of file JPosition2D.hh.

211  {
212  return
213  getX() * angle.getDY() -
214  getY() * angle.getDX();
215  }
double getDX() const
Get x direction.
Definition: JAngle2D.hh:83
double getY() const
Get y position.
Definition: JVector2D.hh:74
double getX() const
Get x position.
Definition: JVector2D.hh:63
double getDY() const
Get y direction.
Definition: JAngle2D.hh:94
double JGEOMETRY2D::JPosition2D::getPerpDot ( const JVersor2D dir) const
inlineinherited

Get perpendicular dot product.

Parameters
dirdirection
Returns
perpendicular dot product

Definition at line 224 of file JPosition2D.hh.

225  {
226  return
227  getX() * dir.getDY() -
228  getY() * dir.getDX();
229  }
double getY() const
Get y position.
Definition: JVector2D.hh:74
double getDX() const
Get x direction.
Definition: JVersor2D.hh:53
double getX() const
Get x position.
Definition: JVector2D.hh:63
double getDY() const
Get y direction.
Definition: JVersor2D.hh:64
double JGEOMETRY2D::JVector2D::getPerpDot ( const JVector2D point) const
inlineinherited

Get perpendicular dot product.

Parameters
pointvector
Returns
perpendicular dot product

Definition at line 249 of file JVector2D.hh.

250  {
251  return
252  getX() * point.getY() -
253  getY() * point.getX();
254  }
double getY() const
Get y position.
Definition: JVector2D.hh:74
double getX() const
Get x position.
Definition: JVector2D.hh:63
double JGEOMETRY2D::JVector2D::getX ( ) const
inlineinherited

Get x position.

Returns
x position

Definition at line 63 of file JVector2D.hh.

64  {
65  return __x;
66  }
double JGEOMETRY2D::JVector2D::getY ( ) const
inlineinherited

Get y position.

Returns
y position

Definition at line 74 of file JVector2D.hh.

75  {
76  return __y;
77  }
JVector2D& JGEOMETRY2D::JVector2D::negate ( )
inlineinherited

Negate vector.

Returns
this vector

Definition at line 85 of file JVector2D.hh.

86  {
87  __x = -__x;
88  __y = -__y;
89 
90  return *this;
91  }
JVector2D& JGEOMETRY2D::JVector2D::add ( const JVector2D vector)
inlineinherited

Add vector.

Parameters
vectorvector
Returns
this vector

Definition at line 100 of file JVector2D.hh.

101  {
102  __x += vector.getX();
103  __y += vector.getY();
104 
105  return *this;
106  }
double getY() const
Get y position.
Definition: JVector2D.hh:74
double getX() const
Get x position.
Definition: JVector2D.hh:63
JVector2D& JGEOMETRY2D::JVector2D::sub ( const JVector2D vector)
inlineinherited

Subtract vector.

Parameters
vectorvector
Returns
this vector

Definition at line 115 of file JVector2D.hh.

116  {
117  __x -= vector.getX();
118  __y -= vector.getY();
119 
120  return *this;
121  }
double getY() const
Get y position.
Definition: JVector2D.hh:74
double getX() const
Get x position.
Definition: JVector2D.hh:63
JVector2D& JGEOMETRY2D::JVector2D::mul ( const double  factor)
inlineinherited

Scale vector.

Parameters
factormultiplication factor
Returns
this vector

Definition at line 130 of file JVector2D.hh.

131  {
132  __x *= factor;
133  __y *= factor;
134 
135  return *this;
136  }
template<class JFirst_t, class JSecond_t = JNullType>
JFirst_t& JMATH::JMath< JFirst_t, JSecond_t >::mul ( const JSecond_t &  object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 357 of file JMath.hh.

358  {
359  return static_cast<JFirst_t&>(*this) = JCalculator<JFirst_t>::calculator.mul(static_cast<const JFirst_t&>(*this), object);
360  }
Auxiliary class for arithmetic operations on objects.
Definition: JCalculator.hh:18
JVector2D& JGEOMETRY2D::JVector2D::div ( const double  factor)
inlineinherited

Scale vector.

Parameters
factordivision factor
Returns
this vector

Definition at line 145 of file JVector2D.hh.

146  {
147  __x /= factor;
148  __y /= factor;
149 
150  return *this;
151  }
JVector2D& JGEOMETRY2D::JVector2D::transform ( const JMatrix2D T)
inlineinherited

Transform.

Parameters
Tmatrix
Returns
this vector

Definition at line 160 of file JVector2D.hh.

161  {
162  T.transform(__x, __y);
163 
164  return *this;
165  }
do set_variable OUTPUT_DIRECTORY $WORKDIR T
bool JGEOMETRY2D::JVector2D::equals ( const JVector2D vector,
const double  precision = std::numeric_limits<double>::min() 
) const
inlineinherited

Check equality.

Parameters
vectorvector
precisionprecision
Returns
true if vectors are equal; else false

Definition at line 175 of file JVector2D.hh.

177  {
178  return (fabs(getX() - vector.getX()) <= precision &&
179  fabs(getY() - vector.getY()) <= precision);
180  }
double getY() const
Get y position.
Definition: JVector2D.hh:74
double getX() const
Get x position.
Definition: JVector2D.hh:63
double JGEOMETRY2D::JVector2D::getLengthSquared ( ) const
inlineinherited

Get length squared.

Returns
square of length

Definition at line 188 of file JVector2D.hh.

189  {
190  return getX()*getX() + getY()*getY();
191  }
double getY() const
Get y position.
Definition: JVector2D.hh:74
double getX() const
Get x position.
Definition: JVector2D.hh:63
double JGEOMETRY2D::JVector2D::getLength ( ) const
inlineinherited

Get length.

Returns
length

Definition at line 199 of file JVector2D.hh.

200  {
201  return sqrt(getLengthSquared());
202  }
double getLengthSquared() const
Get length squared.
Definition: JVector2D.hh:188
double JGEOMETRY2D::JVector2D::getDistanceSquared ( const JVector2D point) const
inlineinherited

Get squared of distance to point.

Parameters
pointpoint
Returns
square of distance

Definition at line 211 of file JVector2D.hh.

212  {
213  return JVector2D(point).sub(*this).getLengthSquared();
214  }
JVector2D()
Default constructor.
Definition: JVector2D.hh:39
double JGEOMETRY2D::JVector2D::getDistance ( const JVector2D point) const
inlineinherited

Get distance to point.

Parameters
pointpoint
Returns
distance

Definition at line 223 of file JVector2D.hh.

224  {
225  return sqrt(getDistanceSquared(point));
226  }
double getDistanceSquared(const JVector2D &point) const
Get squared of distance to point.
Definition: JVector2D.hh:211

Friends And Related Function Documentation

std::istream& operator>> ( std::istream &  in,
JCylinder3D cylinder 
)
friend

Read cylinder from input stream.

Parameters
ininput stream
cylindercylinder
Returns
input stream

Definition at line 348 of file JCylinder3D.hh.

349  {
350  in >> static_cast<JCircle2D&>(cylinder);
351  in >> cylinder.zmin >> cylinder.zmax;
352 
353  return in;
354  }
JCircle2D()
Default constructor.
Definition: JCircle2D.hh:40
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:42
std::ostream& operator<< ( std::ostream &  out,
const JCylinder3D cylinder 
)
friend

Write cylinder to output stream.

Parameters
outoutput stream
cylindercylinder
Returns
output stream

Definition at line 364 of file JCylinder3D.hh.

365  {
366  const JFormat format(out, getFormat<JCylinder3D>(JFormat_t(9, 3, std::ios::fixed | std::ios::showpos)));
367 
368  out << static_cast<const JCircle2D&>(cylinder);
369  out << ' ';
370  out << format << cylinder.zmin;
371  out << ' ';
372  out << format << cylinder.zmax;
373 
374  return out;
375  }
Auxiliary class to temporarily define format specifications.
Definition: JManip.hh:632
Data structure for format specifications.
Definition: JManip.hh:522
JReader& operator>> ( JReader in,
JCylinder3D cylinder 
)
friend

Read cylinder from input.

Parameters
inreader
cylindercylinder
Returns
reader

Definition at line 385 of file JCylinder3D.hh.

386  {
387  in >> static_cast<JCircle2D&>(cylinder);
388  in >> cylinder.zmin >> cylinder.zmax;
389 
390  return in;
391  }
JCircle2D()
Default constructor.
Definition: JCircle2D.hh:40
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:42
JWriter& operator<< ( JWriter out,
const JCylinder3D cylinder 
)
friend

Write cylinder to output.

Parameters
outwriter
cylindercylinder
Returns
writer

Definition at line 401 of file JCylinder3D.hh.

402  {
403  out << static_cast<const JCircle2D&>(cylinder);
404  out << cylinder.zmin << cylinder.zmax;
405 
406  return out;
407  }

Member Data Documentation

double JGEOMETRY3D::JCylinder3D::zmin
protected

Definition at line 411 of file JCylinder3D.hh.

double JGEOMETRY3D::JCylinder3D::zmax
protected

Definition at line 412 of file JCylinder3D.hh.

double JGEOMETRY2D::JCircle2D::__r
protectedinherited

Definition at line 345 of file JCircle2D.hh.

double JGEOMETRY2D::JVector2D::__x
protectedinherited

Definition at line 257 of file JVector2D.hh.

double JGEOMETRY2D::JVector2D::__y
protectedinherited

Definition at line 258 of file JVector2D.hh.


The documentation for this class was generated from the following file: