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

Axis object. More...

#include <JAxis2D.hh>

Inheritance diagram for JGEOMETRY2D::JAxis2D:
JGEOMETRY2D::JPosition2D JGEOMETRY2D::JDirection2D JGEOMETRY2D::JVector2D JGEOMETRY2D::JVersor2D JMATH::JMath< JVector2D >

Public Member Functions

 JAxis2D ()
 Default constructor. More...
 
 JAxis2D (const JVector2D &pos)
 Constructor. More...
 
 JAxis2D (const JVector2D &pos, const JVersor2D &dir)
 Constructor. More...
 
 JAxis2D (const JSegment2D &segment)
 Constructor. More...
 
const JAxis2DgetAxis () const
 Get axis. More...
 
void setAxis (const JAxis2D &axis)
 Set axis. More...
 
JAxis2Dnegate ()
 Negate axis. More...
 
void move (const double step)
 Move vertex along this axis. More...
 
bool intersects (const JSegment2D &segment) const
 Test whether this axis and given line segment intersect. More...
 
double getIntersection (const JAxis2D &axis, const double precision=1.0e-8) const
 Get intersection of two axes. 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...
 
JAxis2Drotate (const JRotation2D &R)
 Rotate axis. More...
 
JAxis2Drotate_back (const JRotation2D &R)
 Rotate back axis. 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...
 
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...
 
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...
 
const JDirection2DgetDirection () const
 Get direction. More...
 
JDirection2DgetDirection ()
 Get direction. More...
 
void setDirection (const JDirection2D &dir)
 Set direction. More...
 
 operator JAngle2D () const
 Type conversion operator. More...
 
 operator JVector2D () const
 Type conversion operator. More...
 
JDirection2Dtransform (const JMatrix2D &T)
 Transform. More...
 
double getDot (const JAngle2D &angle) const
 Get dot product. More...
 
double getDot (const JVector2D &pos) const
 Get dot product. More...
 
double getDot (const JVersor2D &versor) const
 Get dot product. More...
 
double getPerpDot (const JAngle2D &angle) const
 Get perpendicular dot product. More...
 
double getPerpDot (const JVector2D &pos) const
 Get perpendicular dot product. More...
 
double getPerpDot (const JVersor2D &versor) const
 Get perpendicular dot product. More...
 
double getDX () const
 Get x direction. More...
 
double getDY () const
 Get y direction. More...
 
double getPhi () const
 Get phi angle. More...
 
bool equals (const JVersor2D &versor, const double precision=std::numeric_limits< double >::min()) const
 Check equality. More...
 
JVersor2Dnormalise ()
 Normalise versor. More...
 

Protected Attributes

double __x
 
double __y
 
double __dx
 
double __dy
 

Friends

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

Detailed Description

Axis object.

An axis object consists of a position and a direction.

Definition at line 32 of file JAxis2D.hh.

Constructor & Destructor Documentation

JGEOMETRY2D::JAxis2D::JAxis2D ( )
inline

Default constructor.

Definition at line 40 of file JAxis2D.hh.

40  :
41  JPosition2D (),
42  JDirection2D()
43  {}
JPosition2D()
Default constructor.
Definition: JPosition2D.hh:43
JDirection2D()
Default constructor.
Definition: JDirection2D.hh:42
JGEOMETRY2D::JAxis2D::JAxis2D ( const JVector2D pos)
inline

Constructor.

Parameters
posposition

Definition at line 51 of file JAxis2D.hh.

51  :
52  JPosition2D (pos),
53  JDirection2D()
54  {}
JPosition2D()
Default constructor.
Definition: JPosition2D.hh:43
JDirection2D()
Default constructor.
Definition: JDirection2D.hh:42
JGEOMETRY2D::JAxis2D::JAxis2D ( const JVector2D pos,
const JVersor2D dir 
)
inline

Constructor.

Parameters
posposition
dirdirection

Definition at line 63 of file JAxis2D.hh.

64  :
65  JPosition2D (pos),
66  JDirection2D(dir)
67  {}
JPosition2D()
Default constructor.
Definition: JPosition2D.hh:43
JDirection2D()
Default constructor.
Definition: JDirection2D.hh:42
JGEOMETRY2D::JAxis2D::JAxis2D ( const JSegment2D segment)
inline

Constructor.

Parameters
segmentline segment

Definition at line 75 of file JAxis2D.hh.

75  :
76  JPosition2D (segment.first),
77  JDirection2D(segment.second - segment.first)
78  {}
JPosition2D()
Default constructor.
Definition: JPosition2D.hh:43
JDirection2D()
Default constructor.
Definition: JDirection2D.hh:42

Member Function Documentation

const JAxis2D& JGEOMETRY2D::JAxis2D::getAxis ( ) const
inline

Get axis.

Returns
axis

Definition at line 86 of file JAxis2D.hh.

87  {
88  return *this;
89  }
void JGEOMETRY2D::JAxis2D::setAxis ( const JAxis2D axis)
inline

Set axis.

Parameters
axisaxis

Definition at line 97 of file JAxis2D.hh.

98  {
99  *this = axis;
100  }
JAxis2D& JGEOMETRY2D::JAxis2D::negate ( )
inline

Negate axis.

Returns
this axis

Definition at line 108 of file JAxis2D.hh.

109  {
110  static_cast<JPosition2D&> (*this).negate();
111  static_cast<JDirection2D&>(*this).negate();
112 
113  return *this;
114  }
Data structure for direction in two dimensions.
Definition: JDirection2D.hh:30
JVersor2D & negate()
Negate versor.
Definition: JVersor2D.hh:86
JVector2D & negate()
Negate vector.
Definition: JVector2D.hh:84
Data structure for position in two dimensions.
Definition: JPosition2D.hh:30
void JGEOMETRY2D::JAxis2D::move ( const double  step)
inline

Move vertex along this axis.

Parameters
stepstep

Definition at line 122 of file JAxis2D.hh.

123  {
124  getPosition() += step * JVector2D(getDirection());
125  }
const JPosition2D & getPosition() const
Get position.
Definition: JPosition2D.hh:97
JVector2D()
Default constructor.
Definition: JVector2D.hh:38
const JDirection2D & getDirection() const
Get direction.
Definition: JDirection2D.hh:94
bool JGEOMETRY2D::JAxis2D::intersects ( const JSegment2D segment) const
inline

Test whether this axis and given line segment intersect.

Parameters
segmentline segment
Returns
true if axis and line segment intersect; else false

Definition at line 134 of file JAxis2D.hh.

135  {
136  if (getCCW(segment.first, this->getPosition(), segment.second))
137  return (this->getDirection().getPerpDot(segment.first - this->getPosition()) > 0.0 &&
138  this->getDirection().getPerpDot(segment.second - this->getPosition()) < 0.0);
139  else
140  return (this->getDirection().getPerpDot(segment.first - this->getPosition()) < 0.0 &&
141  this->getDirection().getPerpDot(segment.second - this->getPosition()) > 0.0);
142  }
double getPerpDot(const JAngle2D &angle) const
Get perpendicular dot product.
bool getCCW(const T &a, const T &b, const T &c)
Check sequence of three points in X-Y plane.
const JDirection2D & getDirection() const
Get direction.
Definition: JDirection2D.hh:94
double JGEOMETRY2D::JAxis2D::getIntersection ( const JAxis2D axis,
const double  precision = 1.0e-8 
) const
inline

Get intersection of two axes.

Parameters
axisaxis
precisionprecision
Returns
longitudinal position

Definition at line 152 of file JAxis2D.hh.

153  {
154  const double gp = this->getDirection().getPerpDot(axis.getDirection());
155 
156  if (fabs(gp) > precision)
157  return axis.getDirection().getPerpDot(this->getPosition() - axis.getPosition()) / gp;
158  else
159  return this->getDistance(axis.getPosition());
160  }
const JPosition2D & getPosition() const
Get position.
Definition: JPosition2D.hh:97
double getPerpDot(const JAngle2D &angle) const
Get perpendicular dot product.
double getDistance(const JVector2D &point) const
Get distance to point.
Definition: JAxis2D.hh:190
const JDirection2D & getDirection() const
Get direction.
Definition: JDirection2D.hh:94
double JGEOMETRY2D::JAxis2D::getDistanceSquared ( const JVector2D point) const
inline

Get squared of distance to point.

Parameters
pointpoint
Returns
square of distance

Definition at line 169 of file JAxis2D.hh.

170  {
171  JVector2D D(this->getDirection());
172 
173  const JVector2D U(point - this->getPosition());
174 
175  const double u = D.getDot(U);
176 
177  D.mul(u);
178  D.sub(U);
179 
180  return D.getLengthSquared();
181  }
const JPosition2D & getPosition() const
Get position.
Definition: JPosition2D.hh:97
Data structure for vector in two dimensions.
Definition: JVector2D.hh:31
do echo Generating $dir eval D
Definition: JDrawLED.sh:50
const JDirection2D & getDirection() const
Get direction.
Definition: JDirection2D.hh:94
double u[N+1]
Definition: JPolint.hh:706
double JGEOMETRY2D::JAxis2D::getDistance ( const JVector2D point) const
inline

Get distance to point.

Parameters
pointpoint
Returns
distance

Definition at line 190 of file JAxis2D.hh.

191  {
192  return sqrt(getDistanceSquared(point));
193  }
double getDistanceSquared(const JVector2D &point) const
Get squared of distance to point.
Definition: JAxis2D.hh:169
JAxis2D& JGEOMETRY2D::JAxis2D::rotate ( const JRotation2D R)
inline

Rotate axis.

Parameters
Rrotation matrix
Returns
this axis

Definition at line 202 of file JAxis2D.hh.

203  {
204  static_cast<JPosition2D&> (*this).rotate(R);
205  static_cast<JDirection2D&>(*this).rotate(R);
206 
207  return *this;
208  }
Data structure for direction in two dimensions.
Definition: JDirection2D.hh:30
JDirection2D & rotate(const JRotation2D &R)
Rotate.
JPosition2D & rotate(const JRotation2D &R)
Rotate.
Definition: JPosition2D.hh:153
Data structure for position in two dimensions.
Definition: JPosition2D.hh:30
JAxis2D& JGEOMETRY2D::JAxis2D::rotate_back ( const JRotation2D R)
inline

Rotate back axis.

Parameters
Rrotation matrix
Returns
this axis

Definition at line 217 of file JAxis2D.hh.

218  {
219  static_cast<JPosition2D&> (*this).rotate_back(R);
220  static_cast<JDirection2D&>(*this).rotate_back(R);
221 
222  return *this;
223  }
JDirection2D & rotate_back(const JRotation2D &R)
Rotate back.
Data structure for direction in two dimensions.
Definition: JDirection2D.hh:30
Data structure for position in two dimensions.
Definition: JPosition2D.hh:30
JPosition2D & rotate_back(const JRotation2D &R)
Rotate back.
Definition: JPosition2D.hh:167
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
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::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
const JDirection2D& JGEOMETRY2D::JDirection2D::getDirection ( ) const
inlineinherited

Get direction.

Returns
direction

Definition at line 94 of file JDirection2D.hh.

95  {
96  return static_cast<const JDirection2D&>(*this);
97  }
Data structure for direction in two dimensions.
Definition: JDirection2D.hh:30
JDirection2D& JGEOMETRY2D::JDirection2D::getDirection ( )
inlineinherited

Get direction.

Returns
direction

Definition at line 105 of file JDirection2D.hh.

106  {
107  return static_cast<JDirection2D&>(*this);
108  }
Data structure for direction in two dimensions.
Definition: JDirection2D.hh:30
void JGEOMETRY2D::JDirection2D::setDirection ( const JDirection2D dir)
inlineinherited

Set direction.

Parameters
dirdirection

Definition at line 116 of file JDirection2D.hh.

117  {
118  static_cast<JDirection2D&>(*this) = dir;
119  }
Data structure for direction in two dimensions.
Definition: JDirection2D.hh:30
JGEOMETRY2D::JDirection2D::operator JAngle2D ( ) const
inlineinherited

Type conversion operator.

Returns
angle

Definition at line 127 of file JDirection2D.hh.

128  {
129  return JAngle2D(getDX(), getDY());
130  }
Data structure for angle in two dimensions.
Definition: JAngle2D.hh:31
double getDX() const
Get x direction.
Definition: JVersor2D.hh:53
double getDY() const
Get y direction.
Definition: JVersor2D.hh:64
JGEOMETRY2D::JDirection2D::operator JVector2D ( ) const
inlineinherited

Type conversion operator.

Returns
position

Definition at line 138 of file JDirection2D.hh.

139  {
140  return JVector2D(getDX(), getDY());
141  }
Data structure for vector in two dimensions.
Definition: JVector2D.hh:31
double getDX() const
Get x direction.
Definition: JVersor2D.hh:53
double getDY() const
Get y direction.
Definition: JVersor2D.hh:64
JDirection2D& JGEOMETRY2D::JDirection2D::transform ( const JMatrix2D T)
inlineinherited

Transform.

Parameters
Tmatrix
Returns
this direction

Definition at line 150 of file JDirection2D.hh.

151  {
152  T.transform(__dx, __dy);
153 
154  normalise();
155 
156  return *this;
157  }
JVersor2D & normalise()
Normalise versor.
Definition: JVersor2D.hh:144
do set_variable OUTPUT_DIRECTORY $WORKDIR T
double JGEOMETRY2D::JDirection2D::getDot ( const JAngle2D angle) const
inlineinherited

Get dot product.

Parameters
angleangle
Returns
dot product

Definition at line 198 of file JDirection2D.hh.

199  {
200  return
201  getDX() * angle.getDX() +
202  getDY() * angle.getDY();
203  }
double getDX() const
Get x direction.
Definition: JAngle2D.hh:81
double getDX() const
Get x direction.
Definition: JVersor2D.hh:53
double getDY() const
Get y direction.
Definition: JVersor2D.hh:64
double getDY() const
Get y direction.
Definition: JAngle2D.hh:92
double JGEOMETRY2D::JDirection2D::getDot ( const JVector2D pos) const
inlineinherited

Get dot product.

Parameters
posposition
Returns
dot product

Definition at line 212 of file JDirection2D.hh.

213  {
214  return
215  getDX() * pos.getX() +
216  getDY() * pos.getY();
217  }
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::JVersor2D::getDot ( const JVersor2D versor) const
inlineinherited

Get dot product.

Parameters
versorversor
Returns
dot product

Definition at line 116 of file JVersor2D.hh.

117  {
118  return
119  getDX() * versor.getDX() +
120  getDY() * versor.getDY();
121  }
double getDX() const
Get x direction.
Definition: JVersor2D.hh:53
double getDY() const
Get y direction.
Definition: JVersor2D.hh:64
double JGEOMETRY2D::JDirection2D::getPerpDot ( const JAngle2D angle) const
inlineinherited

Get perpendicular dot product.

Parameters
angleangle
Returns
perpendicular dot product

Definition at line 226 of file JDirection2D.hh.

227  {
228  return
229  getDX() * angle.getDY() -
230  getDY() * angle.getDX();
231  }
double getDX() const
Get x direction.
Definition: JAngle2D.hh:81
double getDX() const
Get x direction.
Definition: JVersor2D.hh:53
double getDY() const
Get y direction.
Definition: JVersor2D.hh:64
double getDY() const
Get y direction.
Definition: JAngle2D.hh:92
double JGEOMETRY2D::JDirection2D::getPerpDot ( const JVector2D pos) const
inlineinherited

Get perpendicular dot product.

Parameters
posposition
Returns
perpendicular dot product

Definition at line 240 of file JDirection2D.hh.

241  {
242  return
243  getDX() * pos.getY() -
244  getDY() * pos.getX();
245  }
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::JVersor2D::getPerpDot ( const JVersor2D versor) const
inlineinherited

Get perpendicular dot product.

Parameters
versorversor
Returns
perpendicular dot product

Definition at line 130 of file JVersor2D.hh.

131  {
132  return
133  getDX() * versor.getDY() -
134  getDY() * versor.getDX();
135  }
double getDX() const
Get x direction.
Definition: JVersor2D.hh:53
double getDY() const
Get y direction.
Definition: JVersor2D.hh:64
double JGEOMETRY2D::JVersor2D::getDX ( ) const
inlineinherited

Get x direction.

Returns
x direction

Definition at line 53 of file JVersor2D.hh.

54  {
55  return __dx;
56  }
double JGEOMETRY2D::JVersor2D::getDY ( ) const
inlineinherited

Get y direction.

Returns
y direction

Definition at line 64 of file JVersor2D.hh.

65  {
66  return __dy;
67  }
double JGEOMETRY2D::JVersor2D::getPhi ( ) const
inlineinherited

Get phi angle.

Returns
phi angle [rad]

Definition at line 75 of file JVersor2D.hh.

76  {
77  return atan2(__dy, __dx);
78  }
bool JGEOMETRY2D::JVersor2D::equals ( const JVersor2D versor,
const double  precision = std::numeric_limits<double>::min() 
) const
inlineinherited

Check equality.

Parameters
versorversor
precisionprecision
Returns
true if versors are equal; else false

Definition at line 102 of file JVersor2D.hh.

104  {
105  return (fabs(getDX() - versor.getDX()) <= precision &&
106  fabs(getDY() - versor.getDY()) <= precision);
107  }
double getDX() const
Get x direction.
Definition: JVersor2D.hh:53
double getDY() const
Get y direction.
Definition: JVersor2D.hh:64
JVersor2D& JGEOMETRY2D::JVersor2D::normalise ( )
inlineinherited

Normalise versor.

This operation may set the result to the unit y-vector.

Returns
this versor

Definition at line 144 of file JVersor2D.hh.

145  {
146  const double v = sqrt(getDX()*getDX() + getDY()*getDY());
147 
148  if (v != 0.0) {
149  __dx /= v;
150  __dy /= v;
151  } else {
152  __dx = 0.0;
153  __dy = 1.0;
154  }
155 
156  return *this;
157  }
double getDX() const
Get x direction.
Definition: JVersor2D.hh:53
double getDY() const
Get y direction.
Definition: JVersor2D.hh:64
data_type v[N+1][M+1]
Definition: JPolint.hh:707

Friends And Related Function Documentation

std::istream& operator>> ( std::istream &  in,
JAxis2D axis 
)
friend

Read axis from input.

Parameters
ininput stream
axisaxis
Returns
input stream

Definition at line 233 of file JAxis2D.hh.

234  {
235  in >> static_cast<JPosition2D&> (axis);
236  in >> static_cast<JDirection2D&>(axis);
237 
238  return in;
239  }
Data structure for direction in two dimensions.
Definition: JDirection2D.hh:30
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 JAxis2D axis 
)
friend

Write axis to output.

Parameters
outoutput stream
axisaxis
Returns
output stream

Definition at line 249 of file JAxis2D.hh.

250  {
251  out << static_cast<const JPosition2D&> (axis);
252  out << ' ';
253  out << static_cast<const JDirection2D&>(axis);
254 
255  return out;
256  }
JReader& operator>> ( JReader in,
JAxis2D axis 
)
friend

Read axis from input.

Parameters
inreader
axisaxis
Returns
reader

Definition at line 266 of file JAxis2D.hh.

267  {
268  in >> static_cast<JPosition2D&> (axis);
269  in >> static_cast<JDirection2D&>(axis);
270 
271  return in;
272  }
Data structure for direction in two dimensions.
Definition: JDirection2D.hh:30
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 JAxis2D axis 
)
friend

Write axis to output.

Parameters
outwriter
axisaxis
Returns
writer

Definition at line 282 of file JAxis2D.hh.

283  {
284  out << static_cast<const JPosition2D&> (axis);
285  out << static_cast<const JDirection2D&>(axis);
286 
287  return out;
288  }

Member Data Documentation

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.

double JGEOMETRY2D::JVersor2D::__dx
protectedinherited

Definition at line 160 of file JVersor2D.hh.

double JGEOMETRY2D::JVersor2D::__dy
protectedinherited

Definition at line 161 of file JVersor2D.hh.


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