Jpp
Public Member Functions | Protected Attributes | Private Member Functions | 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< JVector2D >

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)
 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)
 Set circle. More...
 
template<class T >
void set (T __begin, T __end)
 Set circle. More...
 
bool is_inside (const JVector2D &pos) 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 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 getPerpDot (const JVector2D &point) const
 Get perpendicular dot product. More...
 
JVector2Dtransform (const JMatrix2D &T)
 Transform. More...
 
JVector2Dtransform (const JMatrix2D &T)
 Transform. 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...
 
JVector2Dmul (const JSecond_t &object)
 Multiply with object. More...
 
JVector2Ddiv (const double factor)
 Scale vector. 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
 

Private Member Functions

template<class T >
void configure (T __begin, T __end, const JVector2D &p0)
 Determine smallest enclosing circle. More...
 
template<class T >
void configure (T __begin, T __end, const JVector2D &p0, const JVector2D &p1)
 Determine smallest enclosing circle. More...
 

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.

A cylinder object consists of a 2D circle in (x,y) and a range in z.

Definition at line 37 of file JCylinder3D.hh.

Constructor & Destructor Documentation

◆ JCylinder3D() [1/3]

JGEOMETRY3D::JCylinder3D::JCylinder3D ( )
inline

Default constructor.

Definition at line 44 of file JCylinder3D.hh.

44  :
45  JCircle2D(),
46  zmin(0.0),
47  zmax(0.0)
48  {}

◆ JCylinder3D() [2/3]

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 58 of file JCylinder3D.hh.

60  :
61  JCircle2D(circle)
62  {
63  this->zmin = zmin;
64  this->zmax = zmax;
65  }

◆ JCylinder3D() [3/3]

template<class T >
JGEOMETRY3D::JCylinder3D::JCylinder3D ( __begin,
__end 
)
inline

Constructor.

Determines smallest enclosing cylinder for any number of points.

Parameters
__beginbegin of data
__endend of data

Definition at line 77 of file JCylinder3D.hh.

78  :
79  JCircle2D(__begin, __end),
80  zmin(0.0),
81  zmax(0.0)
82  {
83  if (__begin != __end) {
84 
85  zmin = +std::numeric_limits<double>::max();
86  zmax = -std::numeric_limits<double>::max();
87 
88  for (T i = __begin; i != __end; ++i) {
89  if (i->getZ() < zmin) zmin = i->getZ();
90  if (i->getZ() > zmax) zmax = i->getZ();
91  }
92  }
93  }

Member Function Documentation

◆ getZmin()

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

Get minimal z position.

Returns
minimal z position

Definition at line 101 of file JCylinder3D.hh.

102  {
103  return zmin;
104  }

◆ getZmax()

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

Get maximal z position.

Returns
maximal z position

Definition at line 112 of file JCylinder3D.hh.

113  {
114  return zmax;
115  }

◆ setZmin()

void JGEOMETRY3D::JCylinder3D::setZmin ( const double  zmin)
inline

Set minimal z position.

Parameters
zminminimal z position

Definition at line 123 of file JCylinder3D.hh.

124  {
125  this->zmin = zmin;
126  }

◆ setZmax()

void JGEOMETRY3D::JCylinder3D::setZmax ( const double  zmax)
inline

Set maximal z position.

Parameters
zmaxmaximal z position

Definition at line 134 of file JCylinder3D.hh.

135  {
136  this->zmax = zmax;
137  }

◆ add() [1/2]

JCylinder3D& JGEOMETRY3D::JCylinder3D::add ( const JVector3D pos)
inline

Add position.

Parameters
posposition
Returns
this cylinder

Definition at line 146 of file JCylinder3D.hh.

147  {
148  static_cast<JPosition2D&>(*this).add(JPosition2D(pos.getX(), pos.getY()));
149 
150  zmin += pos.getZ();
151  zmax += pos.getZ();
152 
153  return *this;
154  }

◆ addMargin()

void JGEOMETRY3D::JCylinder3D::addMargin ( const double  D)
inline

Add (safety) margin.

Parameters
Dmargin
Returns
this cylinder

Definition at line 163 of file JCylinder3D.hh.

164  {
165  __r += D;
166  zmin -= D;
167  zmax += D;
168  }

◆ getVolume()

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

Get volume.

Returns
volume

Definition at line 176 of file JCylinder3D.hh.

177  {
178  return (getZmax ()- getZmin()) * JTOOLS::PI * getRadius() * getRadius();
179  }

◆ getCenter()

JPosition3D JGEOMETRY3D::JCylinder3D::getCenter ( ) const
inline

Get centre.

Returns
centre

Definition at line 187 of file JCylinder3D.hh.

188  {
189  return JPosition3D(getPosition(), (getZmax() - getZmin())/2.0);
190  }

◆ is_inside() [1/2]

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 199 of file JCylinder3D.hh.

200  {
201  return (pos.getZ() >= getZmin() &&
202  pos.getZ() <= getZmax() &&
203  JCircle2D::is_inside(JVector2D(pos.getX(), pos.getY())));
204  }

◆ getDistance() [1/2]

double JGEOMETRY3D::JCylinder3D::getDistance ( const JVector3D pos) const
inline

Get distance between cylinder wall and given position.

Parameters
posposition
Returns
distance

Definition at line 213 of file JCylinder3D.hh.

214  {
215  JVector2D D(pos);
216 
217  D.sub(*this);
218 
219  double R = D.getLength();
220 
221  if (R > this->getRadius()) {
222 
223  R -= this->getRadius();
224 
225  double dz = 0.0;
226 
227  if (pos.getZ() > this->getZmax())
228  dz = pos.getZ() - this->getZmax();
229  else if (pos.getZ() < this->getZmin())
230  dz = this->getZmin() - pos.getZ();
231  else
232  return R;
233 
234  return sqrt(R*R + dz*dz);
235 
236  } else {
237 
238  if (pos.getZ() > this->getZmax())
239  return pos.getZ() - this->getZmax();
240  else if (pos.getZ() < this->getZmin())
241  return this->getZmin() - pos.getZ();
242  else
243  return 0.0;
244  }
245  }

◆ getDistanceSquared() [1/2]

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 254 of file JCylinder3D.hh.

255  {
256  const double d = getDistance(pos);
257 
258  return d*d;
259  }

◆ getIntersection()

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 268 of file JCylinder3D.hh.

269  {
270  double path[] = { 0.0, 0.0 };
271 
272  if (fabs(axis.getDZ()) != 0.0) {
273 
274  // intersection with bottom or top surface
275 
276  const double Z[] = {
277  axis.getDZ() > 0 ? this->getZmin() : this->getZmax(),
278  axis.getDZ() > 0 ? this->getZmax() : this->getZmin()
279  };
280 
281  for (int i = 0; i != 2; ++i) {
282 
283  const double u = (Z[i] - axis.getZ()) / axis.getDZ();
284  const double x = axis.getX() + u * axis.getDX() - this->getX();
285  const double y = axis.getY() + u * axis.getDY() - this->getY();
286 
287  if (x*x + y*y <= this->getRadius() * this->getRadius()) {
288  path[i] = u;
289  }
290  }
291  }
292 
293  if (fabs(axis.getDZ()) != 1.0) {
294 
295  // intersection with cylinder wall
296 
297  const double x = axis.getX() - this->getX();
298  const double y = axis.getY() - this->getY();
299  const double dx = axis.getDX();
300  const double dy = axis.getDY();
301  const double R = this->getRadius();
302 
303  const double a = (dx * dx + dy * dy);
304  const double b = 2*(dx * x + dy * y);
305  const double c = (x * x + y * y) - R * R;
306 
307  const double q = b*b - 4*a*c;
308 
309  if (q >= 0) {
310 
311  const double u[] = {
312  (-b - sqrt(q)) / (2*a),
313  (-b + sqrt(q)) / (2*a)
314  };
315 
316  for (int i = 0; i != 2; ++i) {
317 
318  const double z = axis.getZ() + u[i] * axis.getDZ();
319 
320  if (z >= this->getZmin() && z <= this->getZmax()) {
321  path[i] = u[i];
322  }
323  }
324  }
325  }
326 
327  return std::make_pair(path[0], path[1]);
328  }

◆ getRadius()

double JGEOMETRY2D::JCircle2D::getRadius ( ) const
inlineinherited

Get radius.

Returns
radius

Definition at line 121 of file JCircle2D.hh.

122  {
123  return __r;
124  }

◆ set() [1/3]

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 134 of file JCircle2D.hh.

136  {
137  __x = 0.5 * (p0.getX() + p1.getX());
138  __y = 0.5 * (p0.getY() + p1.getY());
139  __r = this->getDistance(p0);
140  }

◆ set() [2/3]

void JGEOMETRY2D::JCircle2D::set ( const JVector2D p0,
const JVector2D p1,
const JVector2D p2 
)
inlineinherited

Set circle.

Determines circle through three points.

Parameters
p0first point
p1second point
p2third point

Definition at line 151 of file JCircle2D.hh.

154  {
155  const double x0 = p2.getX() - p1.getX();
156  const double x1 = p0.getX() - p2.getX();
157  const double x2 = p1.getX() - p0.getX();
158 
159  const double y0 = p1.getY() - p2.getY();
160  const double y1 = p2.getY() - p0.getY();
161  const double y2 = p0.getY() - p1.getY();
162 
163  const double D = 2.0 * (p0.getX()*y0 + p1.getX()*y1 + p2.getX()*y2);
164 
165  if (D != 0.0) {
166 
167  const double a = p0.getLengthSquared();
168  const double b = p1.getLengthSquared();
169  const double c = p2.getLengthSquared();
170 
171  __x = (a*y0 + b*y1 + c*y2) / D;
172  __y = (a*x0 + b*x1 + c*x2) / D;
173  __r = this->getDistance(p0);
174 
175  } else {
176 
177  set(p0, p1);
178 
179  const JCircle2D c1(p1, p2);
180  const JCircle2D c2(p0, p2);
181 
182  if (c1.getRadius() > this->getRadius()) { *this = c1; }
183  if (c2.getRadius() > this->getRadius()) { *this = c2; }
184  }
185  }

◆ set() [3/3]

template<class T >
void JGEOMETRY2D::JCircle2D::set ( __begin,
__end 
)
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

Definition at line 200 of file JCircle2D.hh.

202  {
203  if (std::distance(__begin,__end) == 1) {
204 
205  __x = __begin->getX();
206  __y = __begin->getY();
207  __r = 0.0;
208 
209  } else if (std::distance(__begin,__end) > 1) {
210 
211  T j = __begin;
212 
213  const JVector2D p0(j->getX(), j->getY());
214 
215  ++j;
216 
217  const JVector2D p1(j->getX(), j->getY());
218 
219  set(p0, p1);
220 
221  while (++j != __end) {
222 
223  const JVector2D p2(j->getX(), j->getY());
224 
225  if (this->getDistance(p2) > this->getRadius()) {
226  configure(__begin, j, p2);
227  }
228  }
229  }
230  }

◆ is_inside() [2/2]

bool JGEOMETRY2D::JCircle2D::is_inside ( const JVector2D pos) const
inlineinherited

Check whether given point is inside circle.

Parameters
posposition
Returns
true if inside; else false

Definition at line 239 of file JCircle2D.hh.

240  {
241  return (this->getDistance(pos) <= this->getRadius());
242  }

◆ configure() [1/2]

template<class T >
void JGEOMETRY2D::JCircle2D::configure ( __begin,
__end,
const JVector2D p0 
)
inlineprivateinherited

Determine smallest enclosing circle.

Parameters
__beginbegin of data
__endend of data
p0point on circle

Definition at line 323 of file JCircle2D.hh.

326  {
327  this->set(JVector2D(__begin->getX(), __begin->getY()), p0);
328 
329  for (T i = __begin; ++i != __end; ) {
330 
331  const JVector2D p1(i->getX(), i->getY());
332 
333  if (this->getDistance(p1) > this->getRadius()) {
334  configure(__begin, i, p0, p1);
335  }
336  }
337  }

◆ configure() [2/2]

template<class T >
void JGEOMETRY2D::JCircle2D::configure ( __begin,
__end,
const JVector2D p0,
const JVector2D p1 
)
inlineprivateinherited

Determine smallest enclosing circle.

Parameters
__beginbegin of data
__endend of data
p0point on circle
p1point on circle

Definition at line 349 of file JCircle2D.hh.

353  {
354  this->set(p0, p1);
355 
356  for (T i = __begin; i != __end; ++i) {
357 
358  const JVector2D p2(i->getX(), i->getY());
359 
360  if (this->getDistance(p2) > this->getRadius()) {
361 
362  const JCircle2D c1(p0, p1, p2);
363 
364  if (c1.getRadius() > this->getRadius()) { *this = c1; }
365  }
366  }
367  }

◆ getPosition() [1/2]

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  }

◆ getPosition() [2/2]

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  }

◆ setPosition()

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  }

◆ operator JAngle2D()

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  }

◆ operator JVersor2D()

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  }

◆ rotate()

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  }

◆ rotate_back()

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  }

◆ getDot() [1/4]

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  }

◆ getDot() [2/4]

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  }

◆ getDot() [3/4]

double JGEOMETRY2D::JVector2D::getDot
inlineinherited

Get dot product.

Parameters
pointvector
Returns
dot product

Definition at line 233 of file JVector2D.hh.

234  {
235  return
236  getX() * point.getX() +
237  getY() * point.getY();
238  }

◆ getDot() [4/4]

double JGEOMETRY2D::JVector2D::getDot ( const JVector2D point) const
inlineinherited

Get dot product.

Parameters
pointvector
Returns
dot product

Definition at line 233 of file JVector2D.hh.

234  {
235  return
236  getX() * point.getX() +
237  getY() * point.getY();
238  }

◆ getPerpDot() [1/4]

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  }

◆ getPerpDot() [2/4]

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  }

◆ getPerpDot() [3/4]

double JGEOMETRY2D::JVector2D::getPerpDot
inlineinherited

Get perpendicular dot product.

Parameters
pointvector
Returns
perpendicular dot product

Definition at line 247 of file JVector2D.hh.

248  {
249  return
250  getX() * point.getY() -
251  getY() * point.getX();
252  }

◆ getPerpDot() [4/4]

double JGEOMETRY2D::JVector2D::getPerpDot ( const JVector2D point) const
inlineinherited

Get perpendicular dot product.

Parameters
pointvector
Returns
perpendicular dot product

Definition at line 247 of file JVector2D.hh.

248  {
249  return
250  getX() * point.getY() -
251  getY() * point.getX();
252  }

◆ transform() [1/2]

JVector2D& JGEOMETRY2D::JVector2D::transform
inlineinherited

Transform.

Parameters
Tmatrix
Returns
this vector

Definition at line 159 of file JVector2D.hh.

160  {
161  T.transform(__x, __y);
162 
163  return *this;
164  }

◆ transform() [2/2]

JVector2D& JGEOMETRY2D::JVector2D::transform ( const JMatrix2D T)
inlineinherited

Transform.

Parameters
Tmatrix
Returns
this vector

Definition at line 159 of file JVector2D.hh.

160  {
161  T.transform(__x, __y);
162 
163  return *this;
164  }

◆ getX()

double JGEOMETRY2D::JVector2D::getX ( ) const
inlineinherited

Get x position.

Returns
x position

Definition at line 62 of file JVector2D.hh.

63  {
64  return __x;
65  }

◆ getY()

double JGEOMETRY2D::JVector2D::getY ( ) const
inlineinherited

Get y position.

Returns
y position

Definition at line 73 of file JVector2D.hh.

74  {
75  return __y;
76  }

◆ negate()

JVector2D& JGEOMETRY2D::JVector2D::negate ( )
inlineinherited

Negate vector.

Returns
this vector

Definition at line 84 of file JVector2D.hh.

85  {
86  __x = -__x;
87  __y = -__y;
88 
89  return *this;
90  }

◆ add() [2/2]

JVector2D& JGEOMETRY2D::JVector2D::add ( const JVector2D vector)
inlineinherited

Add vector.

Parameters
vectorvector
Returns
this vector

Definition at line 99 of file JVector2D.hh.

100  {
101  __x += vector.getX();
102  __y += vector.getY();
103 
104  return *this;
105  }

◆ sub()

JVector2D& JGEOMETRY2D::JVector2D::sub ( const JVector2D vector)
inlineinherited

Subtract vector.

Parameters
vectorvector
Returns
this vector

Definition at line 114 of file JVector2D.hh.

115  {
116  __x -= vector.getX();
117  __y -= vector.getY();
118 
119  return *this;
120  }

◆ mul() [1/2]

JVector2D& JGEOMETRY2D::JVector2D::mul ( const double  factor)
inlineinherited

Scale vector.

Parameters
factormultiplication factor
Returns
this vector

Definition at line 129 of file JVector2D.hh.

130  {
131  __x *= factor;
132  __y *= factor;
133 
134  return *this;
135  }

◆ mul() [2/2]

JVector2D & JMATH::JMath< JVector2D , JSecond_t >::mul ( const JSecond_t &  object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 273 of file JMath.hh.

274  {
275  return static_cast<JFirst_t&>(*this) = JCalculator<JFirst_t>::calculator.mul(static_cast<const JFirst_t&>(*this), object);
276  }

◆ div()

JVector2D& JGEOMETRY2D::JVector2D::div ( const double  factor)
inlineinherited

Scale vector.

Parameters
factordivision factor
Returns
this vector

Definition at line 144 of file JVector2D.hh.

145  {
146  __x /= factor;
147  __y /= factor;
148 
149  return *this;
150  }

◆ equals()

bool JGEOMETRY2D::JVector2D::equals ( const JVector2D vector,
const double  precision = std::numeric_limits<double>::min() 
) const
inlineinherited

Check equality.

Parameters
vectorvector
Returns
true if vectors are equal; else false

Definition at line 173 of file JVector2D.hh.

175  {
176  return (fabs(getX() - vector.getX()) <= precision &&
177  fabs(getY() - vector.getY()) <= precision);
178  }

◆ getLengthSquared()

double JGEOMETRY2D::JVector2D::getLengthSquared ( ) const
inlineinherited

Get length squared.

Returns
square of length

Definition at line 186 of file JVector2D.hh.

187  {
188  return getX()*getX() + getY()*getY();
189  }

◆ getLength()

double JGEOMETRY2D::JVector2D::getLength ( ) const
inlineinherited

Get length.

Returns
length

Definition at line 197 of file JVector2D.hh.

198  {
199  return sqrt(getLengthSquared());
200  }

◆ getDistanceSquared() [2/2]

double JGEOMETRY2D::JVector2D::getDistanceSquared ( const JVector2D point) const
inlineinherited

Get squared of distance to point.

Parameters
pointpoint
Returns
square of distance

Definition at line 209 of file JVector2D.hh.

210  {
211  return JVector2D(point).sub(*this).getLengthSquared();
212  }

◆ getDistance() [2/2]

double JGEOMETRY2D::JVector2D::getDistance ( const JVector2D point) const
inlineinherited

Get distance to point.

Parameters
pointpoint
Returns
distance

Definition at line 221 of file JVector2D.hh.

222  {
223  return sqrt(getDistanceSquared(point));
224  }

Friends And Related Function Documentation

◆ operator>> [1/2]

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

Read cylinder from input stream.

Parameters
ininput stream
cylindercylinder
Returns
input stream

Definition at line 338 of file JCylinder3D.hh.

339  {
340  in >> static_cast<JCircle2D&>(cylinder);
341  in >> cylinder.zmin >> cylinder.zmax;
342 
343  return in;
344  }

◆ operator<< [1/2]

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 354 of file JCylinder3D.hh.

355  {
356  out << static_cast<const JCircle2D&>(cylinder);
357  out << ' ';
358  out << cylinder.zmin;
359  out << ' ';
360  out << cylinder.zmax;
361 
362  return out;
363  }

◆ operator>> [2/2]

JReader& operator>> ( JReader in,
JCylinder3D cylinder 
)
friend

Read cylinder from input.

Parameters
inreader
cylindercylinder
Returns
reader

Definition at line 373 of file JCylinder3D.hh.

374  {
375  in >> static_cast<JCircle2D&>(cylinder);
376  in >> cylinder.zmin >> cylinder.zmax;
377 
378  return in;
379  }

◆ operator<< [2/2]

JWriter& operator<< ( JWriter out,
const JCylinder3D cylinder 
)
friend

Write cylinder to output.

Parameters
outwriter
cylindercylinder
Returns
writer

Definition at line 389 of file JCylinder3D.hh.

390  {
391  out << static_cast<const JCircle2D&>(cylinder);
392  out << cylinder.zmin << cylinder.zmax;
393 
394  return out;
395  }

Member Data Documentation

◆ zmin

double JGEOMETRY3D::JCylinder3D::zmin
protected

Definition at line 399 of file JCylinder3D.hh.

◆ zmax

double JGEOMETRY3D::JCylinder3D::zmax
protected

Definition at line 400 of file JCylinder3D.hh.

◆ __r

double JGEOMETRY2D::JCircle2D::__r
protectedinherited

Definition at line 311 of file JCircle2D.hh.

◆ __x

double JGEOMETRY2D::JVector2D::__x
protectedinherited

Definition at line 255 of file JVector2D.hh.

◆ __y

double JGEOMETRY2D::JVector2D::__y
protectedinherited

Definition at line 256 of file JVector2D.hh.


The documentation for this class was generated from the following file:
JGEOMETRY3D::JVersor3D::getDZ
double getDZ() const
Get z direction.
Definition: JVersor3D.hh:113
JGEOMETRY2D::JRotation2D::rotate_back
void rotate_back(double &__x, double &__y) const
Rotate back.
Definition: JRotation2D.hh:112
JGEOMETRY2D::JAngle2D::getDX
double getDX() const
Get x direction.
Definition: JAngle2D.hh:81
JGEOMETRY2D::JPosition2D::getPosition
const JPosition2D & getPosition() const
Get position.
Definition: JPosition2D.hh:97
JGEOMETRY3D::JCylinder3D::getDistance
double getDistance(const JVector3D &pos) const
Get distance between cylinder wall and given position.
Definition: JCylinder3D.hh:213
JGEOMETRY3D::JCylinder3D::getZmin
double getZmin() const
Get minimal z position.
Definition: JCylinder3D.hh:101
JGEOMETRY2D::JCircle2D
Data structure for circle in two dimensions.
Definition: JCircle2D.hh:29
JGEOMETRY3D::JVector3D::getZ
double getZ() const
Get z position.
Definition: JVector3D.hh:114
JGEOMETRY2D::JVector2D::getLengthSquared
double getLengthSquared() const
Get length squared.
Definition: JVector2D.hh:186
c1
TCanvas * c1
Global variables to handle mouse events.
Definition: JDrawModule3D.cc:34
JTOOLS::u
double u[N+1]
Definition: JPolint.hh:706
JGEOMETRY3D::JCylinder3D::zmin
double zmin
Definition: JCylinder3D.hh:399
JTOOLS::j
int j
Definition: JPolint.hh:634
distance
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Definition: PhysicsEvent.hh:434
JGEOMETRY2D::JCircle2D::getRadius
double getRadius() const
Get radius.
Definition: JCircle2D.hh:121
JGEOMETRY2D::JPosition2D::JPosition2D
JPosition2D()
Default constructor.
Definition: JPosition2D.hh:43
JGEOMETRY2D::JVector2D::getDistanceSquared
double getDistanceSquared(const JVector2D &point) const
Get squared of distance to point.
Definition: JVector2D.hh:209
JGEOMETRY2D::JRotation2D::rotate
void rotate(double &__x, double &__y) const
Rotate.
Definition: JRotation2D.hh:96
JGEOMETRY3D::JCylinder3D::zmax
double zmax
Definition: JCylinder3D.hh:400
JGEOMETRY2D::JVector2D::__x
double __x
Definition: JVector2D.hh:255
JGEOMETRY3D::JPosition3D
Data structure for position in three dimensions.
Definition: JPosition3D.hh:35
JGEOMETRY2D::JAngle2D::getDY
double getDY() const
Get y direction.
Definition: JAngle2D.hh:92
JGEOMETRY3D::JVersor3D::getDX
double getDX() const
Get x direction.
Definition: JVersor3D.hh:91
JGEOMETRY2D::JCircle2D::configure
void configure(T __begin, T __end, const JVector2D &p0)
Determine smallest enclosing circle.
Definition: JCircle2D.hh:323
JGEOMETRY2D::JCircle2D::__r
double __r
Definition: JCircle2D.hh:311
JGEOMETRY3D::JVersor3D::getDY
double getDY() const
Get y direction.
Definition: JVersor3D.hh:102
JGEOMETRY2D::JVector2D::getDistance
double getDistance(const JVector2D &point) const
Get distance to point.
Definition: JVector2D.hh:221
JGEOMETRY2D::JCircle2D::is_inside
bool is_inside(const JVector2D &pos) const
Check whether given point is inside circle.
Definition: JCircle2D.hh:239
JGEOMETRY2D::JAngle2D
Data structure for angle in two dimensions.
Definition: JAngle2D.hh:31
JGEOMETRY2D::JCircle2D::JCircle2D
JCircle2D()
Default constructor.
Definition: JCircle2D.hh:36
JGEOMETRY3D::JCylinder3D::getZmax
double getZmax() const
Get maximal z position.
Definition: JCylinder3D.hh:112
JGEOMETRY2D::JVector2D::JVector2D
JVector2D()
Default constructor.
Definition: JVector2D.hh:38
JGEOMETRY3D::JVector3D::getY
double getY() const
Get y position.
Definition: JVector3D.hh:103
JTOOLS::PI
static const double PI
Constants.
Definition: JConstants.hh:20
JGEOMETRY2D::JVector2D::getX
double getX() const
Get x position.
Definition: JVector2D.hh:62
JGEOMETRY2D::JCircle2D::set
void set(const JVector2D &p0, const JVector2D &p1)
Set circle.
Definition: JCircle2D.hh:134
JGEOMETRY2D::JVersor2D::getDX
double getDX() const
Get x direction.
Definition: JVersor2D.hh:53
JMATH::JCalculator
Auxiliary class for arithmetic operations on objects.
Definition: JCalculator.hh:18
p1
TPaveText * p1
Definition: JDrawModule3D.cc:35
JGEOMETRY2D::JVersor2D
Data structure for normalised vector in two dimensions.
Definition: JVersor2D.hh:20
JGEOMETRY3D::JVector3D::getX
double getX() const
Get x position.
Definition: JVector3D.hh:93
JGEOMETRY2D::JVector2D::getY
double getY() const
Get y position.
Definition: JVector2D.hh:73
JGEOMETRY2D::JVersor2D::getDY
double getDY() const
Get y direction.
Definition: JVersor2D.hh:64
JGEOMETRY2D::JVector2D::__y
double __y
Definition: JVector2D.hh:256
JGEOMETRY2D::JVector2D
Data structure for vector in two dimensions.
Definition: JVector2D.hh:31