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

Eigen values in 2D. More...

#include <JEigenValues2D.hh>

Inheritance diagram for JGEOMETRY2D::JEigenValues2D:
JGEOMETRY2D::JVector2D JMATH::JMath< JVector2D >

Public Member Functions

template<class T >
 JEigenValues2D (T __begin, T __end)
 Constructor. More...
 
int getN () const
 Get number of eigen values. More...
 
int getN (double precision) const
 Get number of eigen values with minimal value. 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...
 
double getDot (const JVector2D &point) const
 Get dot product. More...
 
double getPerpDot (const JVector2D &point) const
 Get perpendicular dot product. More...
 

Protected Attributes

int N
 
double __x
 
double __y
 

Detailed Description

Eigen values in 2D.

Definition at line 24 of file JEigenValues2D.hh.

Constructor & Destructor Documentation

template<class T >
JGEOMETRY2D::JEigenValues2D::JEigenValues2D ( T  __begin,
T  __end 
)
inline

Constructor.

Parameters
__beginbegin of data
__endend of data

Definition at line 35 of file JEigenValues2D.hh.

36  :
37  JVector2D(),
38  N(0)
39  {
40  const JCenter2D center(__begin, __end);
41 
42  // RMS matrix
43 
44  TMatrixDSym A(2);
45 
46  for (int i = 0; i != 2; ++i) {
47  for (int j = 0; j != 2; ++j) {
48  A(i,j) = 0.0;
49  }
50  }
51 
52  for (T i = __begin; i != __end; ++i) {
53 
54  const double dx = center.getX() - i->getX();
55  const double dy = center.getY() - i->getY();
56 
57  A(0,0) += (dx * dx);
58  A(0,1) += (dx * dy);
59 
60  A(1,1) += (dy * dy);
61  }
62 
63  A(1,0) = A(0,1);
64 
65  const TVectorD V = TMatrixDSymEigen(A).GetEigenValues(); // copy!
66 
67  N = V.GetNoElements();
68 
69  switch (N) {
70 
71  case 2:
72  __y = V[1];
73 
74  case 1:
75  __x = V[0];
76  break;
77 
78  default:
79  break;
80  }
81  }
JVector2D()
Default constructor.
Definition: JVector2D.hh:38
do set_variable OUTPUT_DIRECTORY $WORKDIR T
int j
Definition: JPolint.hh:634
source $JPP_DIR setenv csh $JPP_DIR eval JShellParser o a A

Member Function Documentation

int JGEOMETRY2D::JEigenValues2D::getN ( ) const
inline

Get number of eigen values.

Returns
number of eigen values

Definition at line 89 of file JEigenValues2D.hh.

90  {
91  return N;
92  }
int JGEOMETRY2D::JEigenValues2D::getN ( double  precision) const
inline

Get number of eigen values with minimal value.

Parameters
precisionminimal value
Returns
number of eigen values

Definition at line 101 of file JEigenValues2D.hh.

102  {
103  int n = 0;
104 
105  if (fabs(getX()) >= precision) ++n;
106  if (fabs(getY()) >= precision) ++n;
107 
108  if (n > N)
109  return N;
110  else
111  return n;
112  }
double getY() const
Get y position.
Definition: JVector2D.hh:73
double getX() const
Get x position.
Definition: JVector2D.hh:62
alias put_queue eval echo n
Definition: qlib.csh:19
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
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::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

Member Data Documentation

int JGEOMETRY2D::JEigenValues2D::N
protected

Definition at line 116 of file JEigenValues2D.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: