Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 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...
 
std::pair< double, double > 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.

Constructor & Destructor Documentation

JGEOMETRY3D::JCylinder3D::JCylinder3D ( )
inline

Default constructor.

Definition at line 46 of file JCylinder3D.hh.

46  :
47  JCircle2D(),
48  zmin(0.0),
49  zmax(0.0)
50  {}
JCircle2D()
Default constructor.
Definition: JCircle2D.hh:37
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 60 of file JCylinder3D.hh.

62  :
63  JCircle2D(circle)
64  {
65  this->zmin = zmin;
66  this->zmax = zmax;
67  }
JCircle2D()
Default constructor.
Definition: JCircle2D.hh:37
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 80 of file JCylinder3D.hh.

82  :
83  JCircle2D(__begin, __end, precision),
84  zmin(0.0),
85  zmax(0.0)
86  {
87  if (__begin != __end) {
88 
89  zmin = std::numeric_limits<double>::max();
90  zmax = std::numeric_limits<double>::lowest();
91 
92  for (T i = __begin; i != __end; ++i) {
93  if (i->getZ() < zmin) zmin = i->getZ();
94  if (i->getZ() > zmax) zmax = i->getZ();
95  }
96  }
97  }
JCircle2D()
Default constructor.
Definition: JCircle2D.hh:37
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 105 of file JCylinder3D.hh.

106  {
107  return zmin;
108  }
double JGEOMETRY3D::JCylinder3D::getZmax ( ) const
inline

Get maximal z position.

Returns
maximal z position

Definition at line 116 of file JCylinder3D.hh.

117  {
118  return zmax;
119  }
void JGEOMETRY3D::JCylinder3D::setZmin ( const double  zmin)
inline

Set minimal z position.

Parameters
zminminimal z position

Definition at line 127 of file JCylinder3D.hh.

128  {
129  this->zmin = zmin;
130  }
void JGEOMETRY3D::JCylinder3D::setZmax ( const double  zmax)
inline

Set maximal z position.

Parameters
zmaxmaximal z position

Definition at line 138 of file JCylinder3D.hh.

139  {
140  this->zmax = zmax;
141  }
JCylinder3D& JGEOMETRY3D::JCylinder3D::add ( const JVector3D pos)
inline

Add position.

Parameters
posposition
Returns
this cylinder

Definition at line 150 of file JCylinder3D.hh.

151  {
152  static_cast<JPosition2D&>(*this).add(JPosition2D(pos.getX(), pos.getY()));
153 
154  zmin += pos.getZ();
155  zmax += pos.getZ();
156 
157  return *this;
158  }
JPosition2D()
Default constructor.
Definition: JPosition2D.hh:43
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 167 of file JCylinder3D.hh.

168  {
169  __r += D;
170  zmin -= D;
171  zmax += D;
172  }
do echo Generating $dir eval D
Definition: JDrawLED.sh:50
double JGEOMETRY3D::JCylinder3D::getVolume ( ) const
inline

Get volume.

Returns
volume

Definition at line 180 of file JCylinder3D.hh.

181  {
182  return (getZmax ()- getZmin()) * JMATH::PI * getRadius() * getRadius();
183  }
double getRadius() const
Get radius.
Definition: JCircle2D.hh:126
double getZmin() const
Get minimal z position.
Definition: JCylinder3D.hh:105
static const double PI
Mathematical constants.
double getZmax() const
Get maximal z position.
Definition: JCylinder3D.hh:116
JPosition3D JGEOMETRY3D::JCylinder3D::getCenter ( ) const
inline

Get centre.

Returns
centre

Definition at line 191 of file JCylinder3D.hh.

192  {
193  return JPosition3D(getPosition(), (getZmax() - getZmin())/2.0);
194  }
const JPosition2D & getPosition() const
Get position.
Definition: JPosition2D.hh:97
double getZmin() const
Get minimal z position.
Definition: JCylinder3D.hh:105
double getZmax() const
Get maximal z position.
Definition: JCylinder3D.hh:116
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 203 of file JCylinder3D.hh.

204  {
205  return (pos.getZ() >= getZmin() &&
206  pos.getZ() <= getZmax() &&
207  JCircle2D::is_inside(JVector2D(pos.getX(), pos.getY())));
208  }
JVector2D()
Default constructor.
Definition: JVector2D.hh:39
double getZmin() const
Get minimal z position.
Definition: JCylinder3D.hh:105
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:252
double getY() const
Get y position.
Definition: JVector3D.hh:104
double getZmax() const
Get maximal z position.
Definition: JCylinder3D.hh:116
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 217 of file JCylinder3D.hh.

218  {
219  JVector2D D(pos);
220 
221  D.sub(*this);
222 
223  double R = D.getLength();
224 
225  if (R > this->getRadius()) {
226 
227  R -= this->getRadius();
228 
229  double dz = 0.0;
230 
231  if (pos.getZ() > this->getZmax())
232  dz = pos.getZ() - this->getZmax();
233  else if (pos.getZ() < this->getZmin())
234  dz = this->getZmin() - pos.getZ();
235  else
236  return R;
237 
238  return sqrt(R*R + dz*dz);
239 
240  } else {
241 
242  if (pos.getZ() > this->getZmax())
243  return pos.getZ() - this->getZmax();
244  else if (pos.getZ() < this->getZmin())
245  return this->getZmin() - pos.getZ();
246  else
247  return 0.0;
248  }
249  }
do echo Generating $dir eval D
Definition: JDrawLED.sh:50
double getRadius() const
Get radius.
Definition: JCircle2D.hh:126
JVector2D()
Default constructor.
Definition: JVector2D.hh:39
double getZmin() const
Get minimal z position.
Definition: JCylinder3D.hh:105
then usage $script[distance] fi case set_variable R
Definition: JDrawLED.sh:40
double getZmax() const
Get maximal z position.
Definition: JCylinder3D.hh:116
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 258 of file JCylinder3D.hh.

259  {
260  const double d = getDistance(pos);
261 
262  return d*d;
263  }
then JMuonMCEvt f $INPUT_FILE o $INTERMEDIATE_FILE d
Definition: JMuonPath.sh:45
double getDistance(const JVector3D &pos) const
Get distance between cylinder wall and given position.
Definition: JCylinder3D.hh:217
std::pair<double, double> 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 272 of file JCylinder3D.hh.

273  {
274  double path[] = { 0.0, 0.0 };
275 
276  if (fabs(axis.getDZ()) != 0.0) {
277 
278  // intersection with bottom or top surface
279 
280  const double Z[] = {
281  axis.getDZ() > 0 ? this->getZmin() : this->getZmax(),
282  axis.getDZ() > 0 ? this->getZmax() : this->getZmin()
283  };
284 
285  for (int i = 0; i != 2; ++i) {
286 
287  const double u = (Z[i] - axis.getZ()) / axis.getDZ();
288  const double x = axis.getX() + u * axis.getDX() - this->getX();
289  const double y = axis.getY() + u * axis.getDY() - this->getY();
290 
291  if (x*x + y*y <= this->getRadius() * this->getRadius()) {
292  path[i] = u;
293  }
294  }
295  }
296 
297  if (fabs(axis.getDZ()) != 1.0) {
298 
299  // intersection with cylinder wall
300 
301  const double x = axis.getX() - this->getX();
302  const double y = axis.getY() - this->getY();
303  const double dx = axis.getDX();
304  const double dy = axis.getDY();
305  const double R = this->getRadius();
306 
307  const double a = (dx * dx + dy * dy);
308  const double b = 2*(dx * x + dy * y);
309  const double c = (x * x + y * y) - R * R;
310 
311  const double q = b*b - 4*a*c;
312 
313  if (q >= 0) {
314 
315  const double u[] = {
316  (-b - sqrt(q)) / (2*a),
317  (-b + sqrt(q)) / (2*a)
318  };
319 
320  for (int i = 0; i != 2; ++i) {
321 
322  const double z = axis.getZ() + u[i] * axis.getDZ();
323 
324  if (z >= this->getZmin() && z <= this->getZmax()) {
325  path[i] = u[i];
326  }
327  }
328  }
329  }
330 
331  return std::make_pair(path[0], path[1]);
332  }
double getRadius() const
Get radius.
Definition: JCircle2D.hh:126
double getZmin() const
Get minimal z position.
Definition: JCylinder3D.hh:105
double getY() const
Get y position.
Definition: JVector2D.hh:74
do cat driver txt<< EOFevent ev_configure{RC_EVT%< ev_configure.txt > RC_DWRT path
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
then usage $script[distance] fi case set_variable R
Definition: JDrawLED.sh:40
double getZmax() const
Get maximal z position.
Definition: JCylinder3D.hh:116
then JCalibrateToT a
Definition: JTuneHV.sh:103
double getX() const
Get x position.
Definition: JVector3D.hh:94
double u[N+1]
Definition: JPolint.hh:739
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 126 of file JCircle2D.hh.

127  {
128  return __r;
129  }
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 139 of file JCircle2D.hh.

141  {
142  __x = 0.5 * (p0.getX() + p1.getX());
143  __y = 0.5 * (p0.getY() + p1.getY());
144  __r = this->getDistance(p0);
145  }
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 157 of file JCircle2D.hh.

161  {
162  const double x0 = p2.getX() - p1.getX();
163  const double x1 = p0.getX() - p2.getX();
164  const double x2 = p1.getX() - p0.getX();
165 
166  const double y0 = p1.getY() - p2.getY();
167  const double y1 = p2.getY() - p0.getY();
168  const double y2 = p0.getY() - p1.getY();
169 
170  const double D = 2.0 * (p0.getX()*y0 + p1.getX()*y1 + p2.getX()*y2);
171 
172  if (fabs(D) > precision) {
173 
174  const double a = p0.getLengthSquared();
175  const double b = p1.getLengthSquared();
176  const double c = p2.getLengthSquared();
177 
178  __x = (a*y0 + b*y1 + c*y2) / D;
179  __y = (a*x0 + b*x1 + c*x2) / D;
180  __r = this->getDistance(p0);
181 
182  } else {
183 
184  set(p0, p1);
185 
186  const JCircle2D c1(p1, p2);
187  const JCircle2D c2(p0, p2);
188 
189  if (c1.getRadius() > this->getRadius()) { *this = c1; }
190  if (c2.getRadius() > this->getRadius()) { *this = c2; }
191  }
192  }
double getLengthSquared() const
Get length squared.
Definition: JVector2D.hh:188
do echo Generating $dir eval D
Definition: JDrawLED.sh:50
double getRadius() const
Get radius.
Definition: JCircle2D.hh:126
Data structure for circle in two dimensions.
Definition: JCircle2D.hh:30
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:103
void set(const JVector2D &p0, const JVector2D &p1)
Set circle.
Definition: JCircle2D.hh:139
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 208 of file JCircle2D.hh.

211  {
212  if (__begin != __end) {
213 
214  __x = __begin->getX();
215  __y = __begin->getY();
216  __r = 0.0;
217 
218  T i = __begin;
219 
220  const JVector2D p0(i->getX(), i->getY());
221 
222  while (++i != __end && p0.getDistance(JVector2D(i->getX(), i->getY())) <= precision) {}
223 
224  if (i != __end) {
225 
226  const JVector2D p1(i->getX(), i->getY());
227 
228  set(p0, p1);
229 
230  while (++i != __end) {
231 
232  const JVector2D p2(i->getX(), i->getY());
233 
234  if (this->getDistance(p2) > this->getRadius() + precision &&
235  p0.getDistance(p2) > precision &&
236  p1.getDistance(p2) > precision) {
237  configure(__begin, i, p2, precision);
238  }
239  }
240  }
241  }
242  }
Data structure for vector in two dimensions.
Definition: JVector2D.hh:32
double getRadius() const
Get radius.
Definition: JCircle2D.hh:126
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:338
p2
Definition: module-Z:fit.sh:48
void set(const JVector2D &p0, const JVector2D &p1)
Set circle.
Definition: JCircle2D.hh:139
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 252 of file JCircle2D.hh.

254  {
255  return (this->getDistance(pos) <= this->getRadius() + precision);
256  }
double getRadius() const
Get radius.
Definition: JCircle2D.hh:126
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 97 of file JPosition2D.hh.

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

Get position.

Returns
position

Definition at line 108 of file JPosition2D.hh.

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

Set position.

Parameters
posposition

Definition at line 119 of file JPosition2D.hh.

120  {
121  static_cast<JVector2D&>(*this) = pos;
122  }
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 130 of file JPosition2D.hh.

131  {
132  return JAngle2D(getX(), getY());
133  }
Data structure for angle in two dimensions.
Definition: JAngle2D.hh:32
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 141 of file JPosition2D.hh.

142  {
143  return JVersor2D(getX(), getY());
144  }
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 153 of file JPosition2D.hh.

154  {
155  R.rotate(__x, __y);
156 
157  return *this;
158  }
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 167 of file JPosition2D.hh.

168  {
169  R.rotate_back(__x, __y);
170 
171  return *this;
172  }
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 181 of file JPosition2D.hh.

182  {
183  return
184  getX() * angle.getDX() +
185  getY() * angle.getDY();
186  }
double getDX() const
Get x direction.
Definition: JAngle2D.hh:82
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:93
double JGEOMETRY2D::JPosition2D::getDot ( const JVersor2D versor) const
inlineinherited

Get dot product.

Parameters
versorversor
Returns
dot product

Definition at line 195 of file JPosition2D.hh.

196  {
197  return
198  getX() * versor.getDX() +
199  getY() * versor.getDY();
200  }
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 209 of file JPosition2D.hh.

210  {
211  return
212  getX() * angle.getDY() -
213  getY() * angle.getDX();
214  }
double getDX() const
Get x direction.
Definition: JAngle2D.hh:82
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:93
double JGEOMETRY2D::JPosition2D::getPerpDot ( const JVersor2D dir) const
inlineinherited

Get perpendicular dot product.

Parameters
dirdirection
Returns
perpendicular dot product

Definition at line 223 of file JPosition2D.hh.

224  {
225  return
226  getX() * dir.getDY() -
227  getY() * dir.getDX();
228  }
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 342 of file JCylinder3D.hh.

343  {
344  in >> static_cast<JCircle2D&>(cylinder);
345  in >> cylinder.zmin >> cylinder.zmax;
346 
347  return in;
348  }
JCircle2D()
Default constructor.
Definition: JCircle2D.hh:37
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 typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:36
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 358 of file JCylinder3D.hh.

359  {
360  const JFormat format(out, getFormat<JCylinder3D>(JFormat_t(9, 3, std::ios::fixed | std::ios::showpos)));
361 
362  out << static_cast<const JCircle2D&>(cylinder);
363  out << ' ';
364  out << format << cylinder.zmin;
365  out << ' ';
366  out << format << cylinder.zmax;
367 
368  return out;
369  }
Auxiliary class to temporarily define format specifications.
Definition: JManip.hh:631
Data structure for format specifications.
Definition: JManip.hh:521
JReader& operator>> ( JReader in,
JCylinder3D cylinder 
)
friend

Read cylinder from input.

Parameters
inreader
cylindercylinder
Returns
reader

Definition at line 379 of file JCylinder3D.hh.

380  {
381  in >> static_cast<JCircle2D&>(cylinder);
382  in >> cylinder.zmin >> cylinder.zmax;
383 
384  return in;
385  }
JCircle2D()
Default constructor.
Definition: JCircle2D.hh:37
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 typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:36
JWriter& operator<< ( JWriter out,
const JCylinder3D cylinder 
)
friend

Write cylinder to output.

Parameters
outwriter
cylindercylinder
Returns
writer

Definition at line 395 of file JCylinder3D.hh.

396  {
397  out << static_cast<const JCircle2D&>(cylinder);
398  out << cylinder.zmin << cylinder.zmax;
399 
400  return out;
401  }

Member Data Documentation

double JGEOMETRY3D::JCylinder3D::zmin
protected

Definition at line 405 of file JCylinder3D.hh.

double JGEOMETRY3D::JCylinder3D::zmax
protected

Definition at line 406 of file JCylinder3D.hh.

double JGEOMETRY2D::JCircle2D::__r
protectedinherited

Definition at line 325 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: