Jpp  master_rocky-43-ge265d140c
the software that should make you happy
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< JFirst_t, JSecond_t >

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 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...
 
JVector2Dadd (const JVector2D &vector)
 Add vector. More...
 
JVector2Dsub (const JVector2D &vector)
 Subtract vector. More...
 
JVector2Dmul (const double factor)
 Scale vector. More...
 
JFirst_t & mul (const JSecond_t &object)
 Multiply with object. More...
 
JVector2Ddiv (const double factor)
 Scale vector. More...
 
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 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 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

◆ JAxis2D() [1/4]

JGEOMETRY2D::JAxis2D::JAxis2D ( )
inline

Default constructor.

Definition at line 40 of file JAxis2D.hh.

40  :
41  JPosition2D (),
42  JDirection2D()
43  {}
JDirection2D()
Default constructor.
Definition: JDirection2D.hh:43
JPosition2D()
Default constructor.
Definition: JPosition2D.hh:44

◆ JAxis2D() [2/4]

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  {}

◆ JAxis2D() [3/4]

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  {}

◆ JAxis2D() [4/4]

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  {}

Member Function Documentation

◆ getAxis()

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

Get axis.

Returns
axis

Definition at line 86 of file JAxis2D.hh.

87  {
88  return *this;
89  }

◆ setAxis()

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  }

◆ negate()

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:33
Data structure for position in two dimensions.
Definition: JPosition2D.hh:33
JVector2D & negate()
Negate vector.
Definition: JVector2D.hh:85
JVersor2D & negate()
Negate versor.
Definition: JVersor2D.hh:86

◆ move()

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 JDirection2D & getDirection() const
Get direction.
Definition: JDirection2D.hh:95
const JPosition2D & getPosition() const
Get position.
Definition: JPosition2D.hh:98
JVector2D()
Default constructor.
Definition: JVector2D.hh:39

◆ intersects()

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 JVersor2D &versor) const
Get perpendicular dot product.
Definition: JVersor2D.hh:130
bool getCCW(const T &a, const T &b, const T &c)
Check sequence of three points in X-Y plane.

◆ getIntersection()

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  }
double getDistance(const JVector2D &point) const
Get distance to point.
Definition: JAxis2D.hh:190
double getPerpDot(const JAngle2D &angle) const
Get perpendicular dot product.

◆ getDistanceSquared()

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  }
Data structure for vector in two dimensions.
Definition: JVector2D.hh:34
double u[N+1]
Definition: JPolint.hh:865

◆ getDistance()

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

◆ rotate()

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  }
JDirection2D & rotate(const JRotation2D &R)
Rotate.
JPosition2D & rotate(const JRotation2D &R)
Rotate.
Definition: JPosition2D.hh:154

◆ rotate_back()

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.
JPosition2D & rotate_back(const JRotation2D &R)
Rotate back.
Definition: JPosition2D.hh:168

◆ getPosition() [1/2]

const JPosition2D& JGEOMETRY2D::JPosition2D::getPosition ( ) const
inlineinherited

Get position.

Returns
position

Definition at line 98 of file JPosition2D.hh.

99  {
100  return static_cast<const JPosition2D&>(*this);
101  }

◆ getPosition() [2/2]

JPosition2D& JGEOMETRY2D::JPosition2D::getPosition ( )
inlineinherited

Get position.

Returns
position

Definition at line 109 of file JPosition2D.hh.

110  {
111  return static_cast<JPosition2D&>(*this);
112  }

◆ setPosition()

void JGEOMETRY2D::JPosition2D::setPosition ( const JVector2D pos)
inlineinherited

Set position.

Parameters
posposition

Definition at line 120 of file JPosition2D.hh.

121  {
122  static_cast<JVector2D&>(*this) = pos;
123  }

◆ operator JAngle2D() [1/2]

JGEOMETRY2D::JPosition2D::operator JAngle2D ( ) const
inlineinherited

Type conversion operator.

Returns
angle

Definition at line 131 of file JPosition2D.hh.

132  {
133  return JAngle2D(getX(), getY());
134  }
Data structure for angle in two dimensions.
Definition: JAngle2D.hh:35
double getY() const
Get y position.
Definition: JVector2D.hh:74
double getX() const
Get x position.
Definition: JVector2D.hh:63

◆ operator JVersor2D()

JGEOMETRY2D::JPosition2D::operator JVersor2D ( ) const
inlineinherited

Type conversion operator.

Returns
direction

Definition at line 142 of file JPosition2D.hh.

143  {
144  return JVersor2D(getX(), getY());
145  }
Data structure for normalised vector in two dimensions.
Definition: JVersor2D.hh:21

◆ getDot() [1/8]

double JGEOMETRY2D::JPosition2D::getDot ( const JAngle2D angle) const
inlineinherited

Get dot product.

Parameters
angleangle
Returns
dot product

Definition at line 182 of file JPosition2D.hh.

183  {
184  return
185  getX() * angle.getDX() +
186  getY() * angle.getDY();
187  }
double getDY() const
Get y direction.
Definition: JAngle2D.hh:94
double getDX() const
Get x direction.
Definition: JAngle2D.hh:83

◆ getDot() [2/8]

double JGEOMETRY2D::JPosition2D::getDot ( const JVersor2D versor) const
inlineinherited

Get dot product.

Parameters
versorversor
Returns
dot product

Definition at line 196 of file JPosition2D.hh.

197  {
198  return
199  getX() * versor.getDX() +
200  getY() * versor.getDY();
201  }
double getDX() const
Get x direction.
Definition: JVersor2D.hh:53
double getDY() const
Get y direction.
Definition: JVersor2D.hh:64

◆ getDot() [3/8]

double JGEOMETRY2D::JVector2D::getDot
inlineinherited

Get dot product.

Parameters
pointvector
Returns
dot product

Definition at line 235 of file JVector2D.hh.

236  {
237  return
238  getX() * point.getX() +
239  getY() * point.getY();
240  }

◆ getDot() [4/8]

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

Get dot product.

Parameters
pointvector
Returns
dot product

Definition at line 235 of file JVector2D.hh.

236  {
237  return
238  getX() * point.getX() +
239  getY() * point.getY();
240  }

◆ getPerpDot() [1/8]

double JGEOMETRY2D::JPosition2D::getPerpDot ( const JAngle2D angle) const
inlineinherited

Get perpendicular dot product.

Parameters
angleangle
Returns
perpendicular dot product

Definition at line 210 of file JPosition2D.hh.

211  {
212  return
213  getX() * angle.getDY() -
214  getY() * angle.getDX();
215  }

◆ getPerpDot() [2/8]

double JGEOMETRY2D::JPosition2D::getPerpDot ( const JVersor2D dir) const
inlineinherited

Get perpendicular dot product.

Parameters
dirdirection
Returns
perpendicular dot product

Definition at line 224 of file JPosition2D.hh.

225  {
226  return
227  getX() * dir.getDY() -
228  getY() * dir.getDX();
229  }

◆ getPerpDot() [3/8]

double JGEOMETRY2D::JVector2D::getPerpDot
inlineinherited

Get perpendicular dot product.

Parameters
pointvector
Returns
perpendicular dot product

Definition at line 249 of file JVector2D.hh.

250  {
251  return
252  getX() * point.getY() -
253  getY() * point.getX();
254  }

◆ getPerpDot() [4/8]

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

Get perpendicular dot product.

Parameters
pointvector
Returns
perpendicular dot product

Definition at line 249 of file JVector2D.hh.

250  {
251  return
252  getX() * point.getY() -
253  getY() * point.getX();
254  }

◆ transform() [1/3]

JVector2D& JGEOMETRY2D::JVector2D::transform
inlineinherited

Transform.

Parameters
Tmatrix
Returns
this vector

Definition at line 160 of file JVector2D.hh.

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

◆ transform() [2/3]

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

Transform.

Parameters
Tmatrix
Returns
this vector

Definition at line 160 of file JVector2D.hh.

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

◆ getX()

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

Get x position.

Returns
x position

Definition at line 63 of file JVector2D.hh.

64  {
65  return __x;
66  }

◆ getY()

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

Get y position.

Returns
y position

Definition at line 74 of file JVector2D.hh.

75  {
76  return __y;
77  }

◆ add()

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

Add vector.

Parameters
vectorvector
Returns
this vector

Definition at line 100 of file JVector2D.hh.

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

◆ sub()

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

Subtract vector.

Parameters
vectorvector
Returns
this vector

Definition at line 115 of file JVector2D.hh.

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

◆ mul() [1/2]

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

Scale vector.

Parameters
factormultiplication factor
Returns
this vector

Definition at line 130 of file JVector2D.hh.

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

◆ mul() [2/2]

template<class JFirst_t , class JSecond_t >
JFirst_t& JMATH::JMath< JFirst_t, JSecond_t >::mul ( const JSecond_t &  object)
inlineinherited

Multiply with object.

Parameters
objectobject
Returns
result object

Definition at line 354 of file JMath.hh.

355  {
356  return static_cast<JFirst_t&>(*this) = JFirst_t().mul(static_cast<const JFirst_t&>(*this), object);
357  }

◆ div()

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

Scale vector.

Parameters
factordivision factor
Returns
this vector

Definition at line 145 of file JVector2D.hh.

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

◆ equals() [1/2]

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

Check equality.

Parameters
vectorvector
precisionprecision
Returns
true if vectors are equal; else false

Definition at line 175 of file JVector2D.hh.

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

◆ getLengthSquared()

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

Get length squared.

Returns
square of length

Definition at line 188 of file JVector2D.hh.

189  {
190  return getX()*getX() + getY()*getY();
191  }

◆ getLength()

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

Get length.

Returns
length

Definition at line 199 of file JVector2D.hh.

200  {
201  return sqrt(getLengthSquared());
202  }
double getLengthSquared() const
Get length squared.
Definition: JVector2D.hh:188

◆ getDirection() [1/2]

const JDirection2D& JGEOMETRY2D::JDirection2D::getDirection ( ) const
inlineinherited

Get direction.

Returns
direction

Definition at line 95 of file JDirection2D.hh.

96  {
97  return static_cast<const JDirection2D&>(*this);
98  }

◆ getDirection() [2/2]

JDirection2D& JGEOMETRY2D::JDirection2D::getDirection ( )
inlineinherited

Get direction.

Returns
direction

Definition at line 106 of file JDirection2D.hh.

107  {
108  return static_cast<JDirection2D&>(*this);
109  }

◆ setDirection()

void JGEOMETRY2D::JDirection2D::setDirection ( const JDirection2D dir)
inlineinherited

Set direction.

Parameters
dirdirection

Definition at line 117 of file JDirection2D.hh.

118  {
119  static_cast<JDirection2D&>(*this) = dir;
120  }

◆ operator JAngle2D() [2/2]

JGEOMETRY2D::JDirection2D::operator JAngle2D ( ) const
inlineinherited

Type conversion operator.

Returns
angle

Definition at line 128 of file JDirection2D.hh.

129  {
130  return JAngle2D(getDX(), getDY());
131  }

◆ operator JVector2D()

JGEOMETRY2D::JDirection2D::operator JVector2D ( ) const
inlineinherited

Type conversion operator.

Returns
position

Definition at line 139 of file JDirection2D.hh.

140  {
141  return JVector2D(getDX(), getDY());
142  }

◆ transform() [3/3]

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

Transform.

Parameters
Tmatrix
Returns
this direction

Definition at line 151 of file JDirection2D.hh.

152  {
153  T.transform(__dx, __dy);
154 
155  normalise();
156 
157  return *this;
158  }
JVersor2D & normalise()
Normalise versor.
Definition: JVersor2D.hh:144

◆ getDot() [5/8]

double JGEOMETRY2D::JDirection2D::getDot ( const JAngle2D angle) const
inlineinherited

Get dot product.

Parameters
angleangle
Returns
dot product

Definition at line 199 of file JDirection2D.hh.

200  {
201  return
202  getDX() * angle.getDX() +
203  getDY() * angle.getDY();
204  }

◆ getDot() [6/8]

double JGEOMETRY2D::JDirection2D::getDot ( const JVector2D pos) const
inlineinherited

Get dot product.

Parameters
posposition
Returns
dot product

Definition at line 213 of file JDirection2D.hh.

214  {
215  return
216  getDX() * pos.getX() +
217  getDY() * pos.getY();
218  }

◆ getDot() [7/8]

double JGEOMETRY2D::JVersor2D::getDot
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  }

◆ getDot() [8/8]

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  }

◆ getPerpDot() [5/8]

double JGEOMETRY2D::JDirection2D::getPerpDot ( const JAngle2D angle) const
inlineinherited

Get perpendicular dot product.

Parameters
angleangle
Returns
perpendicular dot product

Definition at line 227 of file JDirection2D.hh.

228  {
229  return
230  getDX() * angle.getDY() -
231  getDY() * angle.getDX();
232  }

◆ getPerpDot() [6/8]

double JGEOMETRY2D::JDirection2D::getPerpDot ( const JVector2D pos) const
inlineinherited

Get perpendicular dot product.

Parameters
posposition
Returns
perpendicular dot product

Definition at line 241 of file JDirection2D.hh.

242  {
243  return
244  getDX() * pos.getY() -
245  getDY() * pos.getX();
246  }

◆ getPerpDot() [7/8]

double JGEOMETRY2D::JVersor2D::getPerpDot
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  }

◆ getPerpDot() [8/8]

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  }

◆ getDX()

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  }

◆ getDY()

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  }

◆ getPhi()

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  }

◆ equals() [2/2]

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  }

◆ normalise()

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  }
data_type v[N+1][M+1]
Definition: JPolint.hh:866

Friends And Related Function Documentation

◆ operator>> [1/2]

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  }

◆ operator<< [1/2]

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  }

◆ operator>> [2/2]

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  }

◆ operator<< [2/2]

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

◆ __x

double JGEOMETRY2D::JVector2D::__x
protectedinherited

Definition at line 257 of file JVector2D.hh.

◆ __y

double JGEOMETRY2D::JVector2D::__y
protectedinherited

Definition at line 258 of file JVector2D.hh.

◆ __dx

double JGEOMETRY2D::JVersor2D::__dx
protectedinherited

Definition at line 160 of file JVersor2D.hh.

◆ __dy

double JGEOMETRY2D::JVersor2D::__dy
protectedinherited

Definition at line 161 of file JVersor2D.hh.


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