Data structure for vector in two dimensions.
More...
#include <JVector2D.hh>
Data structure for vector in two dimensions.
This class implements the JMATH::JMath interface.
Definition at line 32 of file JVector2D.hh.
◆ JVector2D() [1/2]
JGEOMETRY2D::JVector2D::JVector2D |
( |
| ) |
|
|
inline |
◆ JVector2D() [2/2]
JGEOMETRY2D::JVector2D::JVector2D |
( |
const double |
x, |
|
|
const double |
y |
|
) |
| |
|
inline |
◆ getX()
double JGEOMETRY2D::JVector2D::getX |
( |
| ) |
const |
|
inline |
Get x position.
- Returns
- x position
Definition at line 63 of file JVector2D.hh.
◆ getY()
double JGEOMETRY2D::JVector2D::getY |
( |
| ) |
const |
|
inline |
Get y position.
- Returns
- y position
Definition at line 74 of file JVector2D.hh.
◆ negate()
JVector2D& JGEOMETRY2D::JVector2D::negate |
( |
| ) |
|
|
inline |
Negate vector.
- Returns
- this vector
Definition at line 85 of file JVector2D.hh.
◆ add()
Add vector.
- Parameters
-
- Returns
- this vector
Definition at line 100 of file JVector2D.hh.
double getY() const
Get y position.
double getX() const
Get x position.
◆ sub()
Subtract vector.
- Parameters
-
- Returns
- this vector
Definition at line 115 of file JVector2D.hh.
◆ mul() [1/2]
JVector2D& JGEOMETRY2D::JVector2D::mul |
( |
const double |
factor | ) |
|
|
inline |
Scale vector.
- Parameters
-
factor | multiplication factor |
- Returns
- this vector
Definition at line 130 of file JVector2D.hh.
◆ div()
JVector2D& JGEOMETRY2D::JVector2D::div |
( |
const double |
factor | ) |
|
|
inline |
Scale vector.
- Parameters
-
- Returns
- this vector
Definition at line 145 of file JVector2D.hh.
◆ transform()
Transform.
- Parameters
-
- Returns
- this vector
Definition at line 160 of file JVector2D.hh.
◆ equals()
bool JGEOMETRY2D::JVector2D::equals |
( |
const JVector2D & |
vector, |
|
|
const double |
precision = std::numeric_limits<double>::min() |
|
) |
| const |
|
inline |
Check equality.
- Parameters
-
vector | vector |
precision | precision |
- Returns
- true if vectors are equal; else false
Definition at line 175 of file JVector2D.hh.
178 return (fabs(
getX() - vector.
getX()) <= precision &&
179 fabs(
getY() - vector.
getY()) <= precision);
◆ getLengthSquared()
double JGEOMETRY2D::JVector2D::getLengthSquared |
( |
| ) |
const |
|
inline |
Get length squared.
- Returns
- square of length
Definition at line 188 of file JVector2D.hh.
◆ getLength()
double JGEOMETRY2D::JVector2D::getLength |
( |
| ) |
const |
|
inline |
Get length.
- Returns
- length
Definition at line 199 of file JVector2D.hh.
double getLengthSquared() const
Get length squared.
◆ getDistanceSquared()
double JGEOMETRY2D::JVector2D::getDistanceSquared |
( |
const JVector2D & |
point | ) |
const |
|
inline |
Get squared of distance to point.
- Parameters
-
- Returns
- square of distance
Definition at line 211 of file JVector2D.hh.
213 return JVector2D(point).sub(*this).getLengthSquared();
JVector2D()
Default constructor.
◆ getDistance()
double JGEOMETRY2D::JVector2D::getDistance |
( |
const JVector2D & |
point | ) |
const |
|
inline |
Get distance to point.
- Parameters
-
- Returns
- distance
Definition at line 223 of file JVector2D.hh.
double getDistanceSquared(const JVector2D &point) const
Get squared of distance to point.
◆ getDot()
double JGEOMETRY2D::JVector2D::getDot |
( |
const JVector2D & |
point | ) |
const |
|
inline |
Get dot product.
- Parameters
-
- Returns
- dot product
Definition at line 235 of file JVector2D.hh.
◆ getPerpDot()
double JGEOMETRY2D::JVector2D::getPerpDot |
( |
const JVector2D & |
point | ) |
const |
|
inline |
Get perpendicular dot product.
- Parameters
-
- Returns
- perpendicular dot product
Definition at line 249 of file JVector2D.hh.
◆ 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
-
- Returns
- result object
Definition at line 354 of file JMath.hh.
356 return static_cast<JFirst_t&
>(*this) = JFirst_t().mul(
static_cast<const JFirst_t&
>(*
this),
object);
◆ __x
double JGEOMETRY2D::JVector2D::__x |
|
protected |
◆ __y
double JGEOMETRY2D::JVector2D::__y |
|
protected |
The documentation for this class was generated from the following file: