Ellipse.
More...
#include <JEllipse2D.hh>
|
| | JEllipse2D_t (const double A, const double B, const double C, const double D, const double E, const double F) |
| | Constructor.
|
| |
| | JEllipse2D_t (const JEllipse2D &ellipse) |
| | Constructor.
|
| |
| double | operator() (const JVector2D &p) const |
| | Evaluate ellipse equation for given point.
|
| |
| bool | is_inside (const JVector2D &p, const double precision=1.0e-8) const |
| | Check if a point is inside or on the boundary of the ellipse.
|
| |
| double | getArea () const |
| | Get area.
|
| |
|
| double | A |
| |
| double | B |
| |
| double | C |
| |
| double | D |
| |
| double | E |
| |
| double | F |
| |
Ellipse.
Definition at line 316 of file JEllipse2D.hh.
◆ JEllipse2D_t() [1/2]
| JGEOMETRY2D::JEllipse2D_t::JEllipse2D_t |
( |
const double | A, |
|
|
const double | B, |
|
|
const double | C, |
|
|
const double | D, |
|
|
const double | E, |
|
|
const double | F ) |
|
inline |
◆ JEllipse2D_t() [2/2]
| JGEOMETRY2D::JEllipse2D_t::JEllipse2D_t |
( |
const JEllipse2D & | ellipse | ) |
|
|
inline |
Constructor.
- Parameters
-
Definition at line 347 of file JEllipse2D.hh.
348 {
349 const double st = sin(ellipse.getAngle());
350 const double ct = cos(ellipse.getAngle());
351
352 const double x = ellipse.getX();
353 const double y = ellipse.getY();
354
355 const double a = ellipse.getMajorAxis();
356 const double b = ellipse.getMinorAxis();
357
358 A = a*a * st*st + b*b * ct*ct;
359 B = 2.0 * (b*b - a*a) * st*ct;
360 C = a*a * ct*ct + b*b * st*st;
363 F = A*
x*
x + B*
x*
y + C*
y*
y - a*a * b*b;
364 }
◆ operator()()
| double JGEOMETRY2D::JEllipse2D_t::operator() |
( |
const JVector2D & | p | ) |
const |
|
inline |
Evaluate ellipse equation for given point.
- Parameters
-
Definition at line 372 of file JEllipse2D.hh.
373 {
374 return (A * p.getX() * p.getX() +
375 B * p.getX() * p.getY() +
376 C * p.getY() * p.getY() +
380 }
◆ is_inside()
| bool JGEOMETRY2D::JEllipse2D_t::is_inside |
( |
const JVector2D & | p, |
|
|
const double | precision = 1.0e-8 ) const |
|
inline |
Check if a point is inside or on the boundary of the ellipse.
- Parameters
-
| p | point |
| precision | precision |
Definition at line 389 of file JEllipse2D.hh.
390 {
391 return (*this)(p) <= precision;
392 }
◆ getArea()
| double JGEOMETRY2D::JEllipse2D_t::getArea |
( |
| ) |
const |
|
inline |
Get area.
- Returns
- area
Definition at line 400 of file JEllipse2D.hh.
401 {
403
404 const double U = 4*A*C - B*
B;
405
406 return PI * 2.0 * (A*
E*
E + C*
D*
D - B*
D*
E - U*
F) / (U * sqrt(U));
407 }
static const double PI
Mathematical constants.
◆ operator>>
| std::istream & operator>> |
( |
std::istream & | in, |
|
|
JEllipse2D_t & | ellipse ) |
|
friend |
Read ellipse from input.
- Parameters
-
| in | input stream |
| ellipse | ellipse |
- Returns
- input stream
Definition at line 417 of file JEllipse2D.hh.
418 {
419 return in >> ellipse.A >> ellipse.B >> ellipse.C >> ellipse.D >> ellipse.E >> ellipse.F;
420 }
◆ operator<<
| std::ostream & operator<< |
( |
std::ostream & | out, |
|
|
const JEllipse2D_t & | ellipse ) |
|
friend |
Write ellipse to output.
- Parameters
-
| out | output stream |
| ellipse | ellipse |
- Returns
- output stream
Definition at line 430 of file JEllipse2D.hh.
431 {
433
434 return out << format << ellipse.A << ' '
435 << format << ellipse.B << ' '
436 << format << ellipse.C << ' '
437 << format << ellipse.D << ' '
438 << format << ellipse.E << ' '
439 << format << ellipse.F;
440 }
JFormat_t & getFormat()
Get format for given type.
| double JGEOMETRY2D::JEllipse2D_t::A |
| double JGEOMETRY2D::JEllipse2D_t::B |
| double JGEOMETRY2D::JEllipse2D_t::C |
| double JGEOMETRY2D::JEllipse2D_t::D |
| double JGEOMETRY2D::JEllipse2D_t::E |
| double JGEOMETRY2D::JEllipse2D_t::F |
The documentation for this struct was generated from the following file: