Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Attributes | Private Member Functions | Friends | List of all members
JGEOMETRY2D::JCircle2D Class Reference

Data structure for circle in two dimensions. More...

#include <JCircle2D.hh>

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

Public Member Functions

 JCircle2D ()
 Default constructor. More...
 
 JCircle2D (const JVector2D &point, const double r)
 Constructor. More...
 
 JCircle2D (const JVector2D &p0, const JVector2D &p1)
 Constructor. More...
 
 JCircle2D (const JVector2D &p0, const JVector2D &p1, const JVector2D &p2)
 Constructor. More...
 
template<class T >
 JCircle2D (T __begin, T __end)
 Constructor. 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 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 __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, JCircle2D &circle)
 Read circle from input stream. More...
 
std::ostream & operator<< (std::ostream &out, const JCircle2D &circle)
 Write circle to output stream. More...
 
JReaderoperator>> (JReader &in, JCircle2D &circle)
 Read circle from input. More...
 
JWriteroperator<< (JWriter &out, const JCircle2D &circle)
 Write circle to output. More...
 

Detailed Description

Data structure for circle in two dimensions.

Definition at line 29 of file JCircle2D.hh.

Constructor & Destructor Documentation

JGEOMETRY2D::JCircle2D::JCircle2D ( )
inline

Default constructor.

Definition at line 36 of file JCircle2D.hh.

36  :
37  JPosition2D(),
38  __r(0.0)
39  {}
JPosition2D()
Default constructor.
Definition: JPosition2D.hh:43
JGEOMETRY2D::JCircle2D::JCircle2D ( const JVector2D point,
const double  r 
)
inline

Constructor.

Parameters
pointpoint
rradius

Definition at line 48 of file JCircle2D.hh.

49  :
50  JPosition2D(point),
51  __r(r)
52  {}
JPosition2D()
Default constructor.
Definition: JPosition2D.hh:43
data_type r[M+1]
Definition: JPolint.hh:709
JGEOMETRY2D::JCircle2D::JCircle2D ( const JVector2D p0,
const JVector2D p1 
)
inline

Constructor.

Determines circle through two points.

Parameters
p0first point
p1second point

Definition at line 62 of file JCircle2D.hh.

63  :
64  JPosition2D(),
65  __r(0.0)
66  {
67  set(p0, p1);
68  }
JPosition2D()
Default constructor.
Definition: JPosition2D.hh:43
void set(const JVector2D &p0, const JVector2D &p1)
Set circle.
Definition: JCircle2D.hh:134
JGEOMETRY2D::JCircle2D::JCircle2D ( const JVector2D p0,
const JVector2D p1,
const JVector2D p2 
)
inline

Constructor.

Determines circle through three points.

Parameters
p0first point
p1second point
p2third point

Definition at line 79 of file JCircle2D.hh.

81  :
82  JPosition2D(),
83  __r(0.0)
84  {
85  set(p0, p1, p2);
86  }
JPosition2D()
Default constructor.
Definition: JPosition2D.hh:43
void set(const JVector2D &p0, const JVector2D &p1)
Set circle.
Definition: JCircle2D.hh:134
template<class T >
JGEOMETRY2D::JCircle2D::JCircle2D ( T  __begin,
T  __end 
)
inline

Constructor.

Determines smallest enclosing circle around set of points. The type of data should have the following member methods:

    double getX();   // x coordinate
    double getY();   // y coordinate

Reference: Computational Geometry Algorithms and Applications Authors: de Berg, M., Cheong, O., van Kreveld, M., Overmars, M.

Parameters
__beginbegin of data
__endend of data

Definition at line 107 of file JCircle2D.hh.

108  :
109  JPosition2D(),
110  __r(0.0)
111  {
112  set(__begin, __end);
113  }
JPosition2D()
Default constructor.
Definition: JPosition2D.hh:43
void set(const JVector2D &p0, const JVector2D &p1)
Set circle.
Definition: JCircle2D.hh:134

Member Function Documentation

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

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 
)
inline

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:222
double getY() const
Get y position.
Definition: JVector2D.hh:73
double getX() const
Get x position.
Definition: JVector2D.hh:62
void JGEOMETRY2D::JCircle2D::set ( const JVector2D p0,
const JVector2D p1,
const JVector2D p2 
)
inline

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:187
do echo Generating $dir eval D
Definition: JDrawLED.sh:50
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:222
fi JEventTimesliceWriter a
double getY() const
Get y position.
Definition: JVector2D.hh:73
double getX() const
Get x position.
Definition: JVector2D.hh:62
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 ( T  __begin,
T  __end 
)
inline

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:31
double getRadius() const
Get radius.
Definition: JCircle2D.hh:121
TPaveText * p1
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
double getDistance(const JVector2D &point) const
Get distance to point.
Definition: JVector2D.hh:222
do set_variable OUTPUT_DIRECTORY $WORKDIR T
int j
Definition: JPolint.hh:634
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
inline

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:222
template<class T >
void JGEOMETRY2D::JCircle2D::configure ( T  __begin,
T  __end,
const JVector2D p0 
)
inlineprivate

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  }
Data structure for vector in two dimensions.
Definition: JVector2D.hh:31
double getRadius() const
Get radius.
Definition: JCircle2D.hh:121
TPaveText * p1
JVector2D()
Default constructor.
Definition: JVector2D.hh:38
double getDistance(const JVector2D &point) const
Get distance to point.
Definition: JVector2D.hh:222
do set_variable OUTPUT_DIRECTORY $WORKDIR T
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
template<class T >
void JGEOMETRY2D::JCircle2D::configure ( T  __begin,
T  __end,
const JVector2D p0,
const JVector2D p1 
)
inlineprivate

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  }
Data structure for vector in two dimensions.
Definition: JVector2D.hh:31
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:222
do set_variable OUTPUT_DIRECTORY $WORKDIR T
TCanvas * c1
Global variables to handle mouse events.
void set(const JVector2D &p0, const JVector2D &p1)
Set circle.
Definition: JCircle2D.hh:134
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:31
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:31
double getY() const
Get y position.
Definition: JVector2D.hh:73
double getX() const
Get x position.
Definition: JVector2D.hh:62
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:73
Data structure for normalised vector in two dimensions.
Definition: JVersor2D.hh:20
double getX() const
Get x position.
Definition: JVector2D.hh:62
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:81
double getY() const
Get y position.
Definition: JVector2D.hh:73
double getX() const
Get x position.
Definition: JVector2D.hh:62
double getDY() const
Get y direction.
Definition: JAngle2D.hh:92
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:73
double getDX() const
Get x direction.
Definition: JVersor2D.hh:53
double getX() const
Get x position.
Definition: JVector2D.hh:62
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 234 of file JVector2D.hh.

235  {
236  return
237  getX() * point.getX() +
238  getY() * point.getY();
239  }
double getY() const
Get y position.
Definition: JVector2D.hh:73
double getX() const
Get x position.
Definition: JVector2D.hh:62
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:81
double getY() const
Get y position.
Definition: JVector2D.hh:73
double getX() const
Get x position.
Definition: JVector2D.hh:62
double getDY() const
Get y direction.
Definition: JAngle2D.hh:92
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:73
double getDX() const
Get x direction.
Definition: JVersor2D.hh:53
double getX() const
Get x position.
Definition: JVector2D.hh:62
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 248 of file JVector2D.hh.

249  {
250  return
251  getX() * point.getY() -
252  getY() * point.getX();
253  }
double getY() const
Get y position.
Definition: JVector2D.hh:73
double getX() const
Get x position.
Definition: JVector2D.hh:62
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  }
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  }
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  }
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  }
double getY() const
Get y position.
Definition: JVector2D.hh:73
double getX() const
Get x position.
Definition: JVector2D.hh:62
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  }
double getY() const
Get y position.
Definition: JVector2D.hh:73
double getX() const
Get x position.
Definition: JVector2D.hh:62
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  }
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 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 144 of file JVector2D.hh.

145  {
146  __x /= factor;
147  __y /= factor;
148 
149  return *this;
150  }
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  }
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 174 of file JVector2D.hh.

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

Get length squared.

Returns
square of length

Definition at line 187 of file JVector2D.hh.

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

Get length.

Returns
length

Definition at line 198 of file JVector2D.hh.

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

Get squared of distance to point.

Parameters
pointpoint
Returns
square of distance

Definition at line 210 of file JVector2D.hh.

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

Get distance to point.

Parameters
pointpoint
Returns
distance

Definition at line 222 of file JVector2D.hh.

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

Friends And Related Function Documentation

std::istream& operator>> ( std::istream &  in,
JCircle2D circle 
)
friend

Read circle from input stream.

Parameters
ininput stream
circlecircle
Returns
input stream

Definition at line 252 of file JCircle2D.hh.

253  {
254  in >> static_cast<JPosition2D&>(circle);
255  in >> circle.__r;
256 
257  return in;
258  }
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
Definition: JSirene.sh:45
Data structure for position in two dimensions.
Definition: JPosition2D.hh:30
std::ostream& operator<< ( std::ostream &  out,
const JCircle2D circle 
)
friend

Write circle to output stream.

Parameters
outoutput stream
circlecircle
Returns
output stream

Definition at line 268 of file JCircle2D.hh.

269  {
270  out << static_cast<const JPosition2D&>(circle);
271  out << ' ';
272  out << circle.__r;
273 
274  return out;
275  }
JReader& operator>> ( JReader in,
JCircle2D circle 
)
friend

Read circle from input.

Parameters
inreader
circlecircle
Returns
reader

Definition at line 285 of file JCircle2D.hh.

286  {
287  in >> static_cast<JPosition2D&>(circle);
288  in >> circle.__r;
289 
290  return in;
291  }
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
Definition: JSirene.sh:45
Data structure for position in two dimensions.
Definition: JPosition2D.hh:30
JWriter& operator<< ( JWriter out,
const JCircle2D circle 
)
friend

Write circle to output.

Parameters
outwriter
circlecircle
Returns
writer

Definition at line 301 of file JCircle2D.hh.

302  {
303  out << static_cast<const JPosition2D&>(circle);
304  out << circle.__r;
305 
306  return out;
307  }

Member Data Documentation

double JGEOMETRY2D::JCircle2D::__r
protected

Definition at line 311 of file JCircle2D.hh.

double JGEOMETRY2D::JVector2D::__x
protectedinherited

Definition at line 256 of file JVector2D.hh.

double JGEOMETRY2D::JVector2D::__y
protectedinherited

Definition at line 257 of file JVector2D.hh.


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