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< 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 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...
 
JVector2Dmul (const JNullType &object)
 Multiply with object. More...
 
JVector2Ddiv (const double factor)
 Scale vector. More...
 
JVector2Dtransform (const JMatrix2D &T)
 Transform. More...
 
bool equals (const JVector2D &vector) 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.

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

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  {}
JCircle2D()
Default constructor.
Definition: JCircle2D.hh:36
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  }
JCircle2D()
Default constructor.
Definition: JCircle2D.hh:36
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  }
JCircle2D()
Default constructor.
Definition: JCircle2D.hh:36

Member Function Documentation

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  }
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  }
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  }
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  }
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  }
JPosition2D()
Default constructor.
Definition: JPosition2D.hh:43
double getY() const
Get y position.
Definition: JVector3D.hh:102
double getX() const
Get x position.
Definition: JVector3D.hh:92
double getZ() const
Get z position.
Definition: JVector3D.hh:113
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  }
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  }
double getRadius() const
Get radius.
Definition: JCircle2D.hh:121
static const double PI
Constants.
Definition: JConstants.hh:20
double getZmin() const
Get minimal z position.
Definition: JCylinder3D.hh:101
double getZmax() const
Get maximal z position.
Definition: JCylinder3D.hh:112
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  }
const JPosition2D & getPosition() const
Get position.
Definition: JPosition2D.hh:97
double getZmin() const
Get minimal z position.
Definition: JCylinder3D.hh:101
double getZmax() const
Get maximal z position.
Definition: JCylinder3D.hh:112
Data structure for position in three dimensions.
Definition: JPosition3D.hh:35
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  }
JVector2D()
Default constructor.
Definition: JVector2D.hh:37
bool is_inside(const JVector2D &pos) const
Check whether given point is inside circle.
Definition: JCircle2D.hh:239
double getZmin() const
Get minimal z position.
Definition: JCylinder3D.hh:101
double getY() const
Get y position.
Definition: JVector3D.hh:102
double getZmax() const
Get maximal z position.
Definition: JCylinder3D.hh:112
double getX() const
Get x position.
Definition: JVector3D.hh:92
double getZ() const
Get z position.
Definition: JVector3D.hh:113
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  }
double getRadius() const
Get radius.
Definition: JCircle2D.hh:121
JVector2D()
Default constructor.
Definition: JVector2D.hh:37
double getZmin() const
Get minimal z position.
Definition: JCylinder3D.hh:101
double getZmax() const
Get maximal z position.
Definition: JCylinder3D.hh:112
double getZ() const
Get z position.
Definition: JVector3D.hh:113
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  }
double getDistance(const JVector3D &pos) const
Get distance between cylinder wall and given position.
Definition: JCylinder3D.hh:213
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  }
double getRadius() const
Get radius.
Definition: JCircle2D.hh:121
double getZmin() const
Get minimal z position.
Definition: JCylinder3D.hh:101
double getY() const
Get y position.
Definition: JVector2D.hh:72
double getDY() const
Get y direction.
Definition: JVersor3D.hh:101
double getDX() const
Get x direction.
Definition: JVersor3D.hh:90
double getX() const
Get x position.
Definition: JVector2D.hh:61
double getY() const
Get y position.
Definition: JVector3D.hh:102
double getZmax() const
Get maximal z position.
Definition: JCylinder3D.hh:112
double getX() const
Get x position.
Definition: JVector3D.hh:92
double getZ() const
Get z position.
Definition: JVector3D.hh:113
double getDZ() const
Get z direction.
Definition: JVersor3D.hh:112
double JGEOMETRY2D::JCircle2D::getRadius ( ) const
inlineinherited

Get radius.

Returns
radius

Definition at line 121 of file JCircle2D.hh.

122  {
123  return __r;
124  }
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  }
double getDistance(const JVector2D &point) const
Get distance to point.
Definition: JVector2D.hh:219
double getY() const
Get y position.
Definition: JVector2D.hh:72
double getX() const
Get x position.
Definition: JVector2D.hh:61
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  }
double getLengthSquared() const
Get length squared.
Definition: JVector2D.hh:184
double getRadius() const
Get radius.
Definition: JCircle2D.hh:121
Data structure for circle in two dimensions.
Definition: JCircle2D.hh:29
double getDistance(const JVector2D &point) const
Get distance to point.
Definition: JVector2D.hh:219
double getY() const
Get y position.
Definition: JVector2D.hh:72
double getX() const
Get x position.
Definition: JVector2D.hh:61
TCanvas * c1
Global variables to handle mouse events.
void set(const JVector2D &p0, const JVector2D &p1)
Set circle.
Definition: JCircle2D.hh:134
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  }
Data structure for vector in two dimensions.
Definition: JVector2D.hh:30
double getRadius() const
Get radius.
Definition: JCircle2D.hh:121
TPaveText * p1
double getDistance(const JVector2D &point) const
Get distance to point.
Definition: JVector2D.hh:219
void set(const JVector2D &p0, const JVector2D &p1)
Set circle.
Definition: JCircle2D.hh:134
void configure(T __begin, T __end, const JVector2D &p0)
Determine smallest enclosing circle.
Definition: JCircle2D.hh:323
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  }
double getRadius() const
Get radius.
Definition: JCircle2D.hh:121
double getDistance(const JVector2D &point) const
Get distance to point.
Definition: JVector2D.hh:219
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:30
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:30
double getY() const
Get y position.
Definition: JVector2D.hh:72
double getX() const
Get x position.
Definition: JVector2D.hh:61
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:72
Data structure for normalised vector in two dimensions.
Definition: JVersor2D.hh:19
double getX() const
Get x position.
Definition: JVector2D.hh:61
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:80
double getY() const
Get y position.
Definition: JVector2D.hh:72
double getX() const
Get x position.
Definition: JVector2D.hh:61
double getDY() const
Get y direction.
Definition: JAngle2D.hh:91
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:72
double getDX() const
Get x direction.
Definition: JVersor2D.hh:52
double getX() const
Get x position.
Definition: JVector2D.hh:61
double getDY() const
Get y direction.
Definition: JVersor2D.hh:63
double JGEOMETRY2D::JVector2D::getDot ( const JVector2D point) const
inlineinherited

Get dot product.

Parameters
pointvector
Returns
dot product

Definition at line 231 of file JVector2D.hh.

232  {
233  return
234  getX() * point.getX() +
235  getY() * point.getY();
236  }
double getY() const
Get y position.
Definition: JVector2D.hh:72
double getX() const
Get x position.
Definition: JVector2D.hh:61
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:80
double getY() const
Get y position.
Definition: JVector2D.hh:72
double getX() const
Get x position.
Definition: JVector2D.hh:61
double getDY() const
Get y direction.
Definition: JAngle2D.hh:91
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:72
double getDX() const
Get x direction.
Definition: JVersor2D.hh:52
double getX() const
Get x position.
Definition: JVector2D.hh:61
double getDY() const
Get y direction.
Definition: JVersor2D.hh:63
double JGEOMETRY2D::JVector2D::getPerpDot ( const JVector2D point) const
inlineinherited

Get perpendicular dot product.

Parameters
pointvector
Returns
perpendicular dot product

Definition at line 245 of file JVector2D.hh.

246  {
247  return
248  getX() * point.getY() -
249  getY() * point.getX();
250  }
double getY() const
Get y position.
Definition: JVector2D.hh:72
double getX() const
Get x position.
Definition: JVector2D.hh:61
double JGEOMETRY2D::JVector2D::getX ( ) const
inlineinherited

Get x position.

Returns
x position

Definition at line 61 of file JVector2D.hh.

62  {
63  return __x;
64  }
double JGEOMETRY2D::JVector2D::getY ( ) const
inlineinherited

Get y position.

Returns
y position

Definition at line 72 of file JVector2D.hh.

73  {
74  return __y;
75  }
JVector2D& JGEOMETRY2D::JVector2D::negate ( )
inlineinherited

Negate vector.

Returns
this vector

Definition at line 83 of file JVector2D.hh.

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

Add vector.

Parameters
vectorvector
Returns
this vector

Definition at line 98 of file JVector2D.hh.

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

Subtract vector.

Parameters
vectorvector
Returns
this vector

Definition at line 113 of file JVector2D.hh.

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

Scale vector.

Parameters
factormultiplication factor
Returns
this vector

Definition at line 128 of file JVector2D.hh.

129  {
130  __x *= factor;
131  __y *= factor;
132 
133  return *this;
134  }
JVector2D & JMATH::JMath< JVector2D , JNullType >::mul ( const JNullType 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  }
Auxiliary class for product evaluation of objects.
Definition: JCalculator.hh:18
JVector2D& JGEOMETRY2D::JVector2D::div ( const double  factor)
inlineinherited

Scale vector.

Parameters
factordivision factor
Returns
this vector

Definition at line 143 of file JVector2D.hh.

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

Transform.

Parameters
Tmatrix
Returns
this vector

Definition at line 158 of file JVector2D.hh.

159  {
160  T.transform(__x, __y);
161 
162  return *this;
163  }
bool JGEOMETRY2D::JVector2D::equals ( const JVector2D vector) const
inlineinherited

Check equality.

Parameters
vectorvector
Returns
true if vectors are equal; else false

Definition at line 172 of file JVector2D.hh.

173  {
174  return (getX() == vector.getX() &&
175  getY() == vector.getY());
176  }
double getY() const
Get y position.
Definition: JVector2D.hh:72
double getX() const
Get x position.
Definition: JVector2D.hh:61
double JGEOMETRY2D::JVector2D::getLengthSquared ( ) const
inlineinherited

Get length squared.

Returns
square of length

Definition at line 184 of file JVector2D.hh.

185  {
186  return getX()*getX() + getY()*getY();
187  }
double getY() const
Get y position.
Definition: JVector2D.hh:72
double getX() const
Get x position.
Definition: JVector2D.hh:61
double JGEOMETRY2D::JVector2D::getLength ( ) const
inlineinherited

Get length.

Returns
length

Definition at line 195 of file JVector2D.hh.

196  {
197  return sqrt(getLengthSquared());
198  }
double getLengthSquared() const
Get length squared.
Definition: JVector2D.hh:184
double JGEOMETRY2D::JVector2D::getDistanceSquared ( const JVector2D point) const
inlineinherited

Get squared of distance to point.

Parameters
pointpoint
Returns
square of distance

Definition at line 207 of file JVector2D.hh.

208  {
209  return JVector2D(point).sub(*this).getLengthSquared();
210  }
JVector2D()
Default constructor.
Definition: JVector2D.hh:37
double JGEOMETRY2D::JVector2D::getDistance ( const JVector2D point) const
inlineinherited

Get distance to point.

Parameters
pointpoint
Returns
distance

Definition at line 219 of file JVector2D.hh.

220  {
221  return sqrt(getDistanceSquared(point));
222  }
double getDistanceSquared(const JVector2D &point) const
Get squared of distance to point.
Definition: JVector2D.hh:207

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

339  {
340  in >> static_cast<JCircle2D&>(cylinder);
341  in >> cylinder.zmin >> cylinder.zmax;
342 
343  return in;
344  }
JCircle2D()
Default constructor.
Definition: JCircle2D.hh: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 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  }
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  }
JCircle2D()
Default constructor.
Definition: JCircle2D.hh:36
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

double JGEOMETRY3D::JCylinder3D::zmin
protected

Definition at line 399 of file JCylinder3D.hh.

double JGEOMETRY3D::JCylinder3D::zmax
protected

Definition at line 400 of file JCylinder3D.hh.

double JGEOMETRY2D::JCircle2D::__r
protectedinherited

Definition at line 311 of file JCircle2D.hh.

double JGEOMETRY2D::JVector2D::__x
protectedinherited

Definition at line 253 of file JVector2D.hh.

double JGEOMETRY2D::JVector2D::__y
protectedinherited

Definition at line 254 of file JVector2D.hh.


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