TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
EllipseBoundary Class Reference

#include <AreaBoundary.h>

Public Member Functions

 EllipseBoundary (Position const &center, double radiusX, double radiusY, bool isInverted=false)
 
 EllipseBoundary (DoublePosition const &center, double radiusX, double radiusY, bool isInverted=false)
 
- Public Member Functions inherited from AreaBoundary
virtual ~AreaBoundary ()
 
BoundaryType GetBoundaryType () const
 
bool IsWithinBoundary (const Position *pos) const
 

Protected Member Functions

bool IsWithinBoundaryArea (const Position *pos) const override
 
- Protected Member Functions inherited from AreaBoundary
 AreaBoundary (BoundaryType bType, bool isInverted)
 

Private Attributes

const DoublePosition _center
 
const double _radiusYSq
 
const double _scaleXSq
 

Additional Inherited Members

- Public Types inherited from AreaBoundary
enum  BoundaryType {
  BOUNDARY_RECTANGLE, BOUNDARY_CIRCLE, BOUNDARY_ELLIPSE, BOUNDARY_TRIANGLE,
  BOUNDARY_PARALLELOGRAM, BOUNDARY_Z_RANGE
}
 
- Protected Attributes inherited from AreaBoundary
const BoundaryType m_boundaryType
 
bool m_isInvertedBoundary
 

Constructor & Destructor Documentation

EllipseBoundary::EllipseBoundary ( Position const center,
double  radiusX,
double  radiusY,
bool  isInverted = false 
)
60  :
61  EllipseBoundary(DoublePosition(center), radiusX, radiusY, isInverted) { }
EllipseBoundary(Position const &center, double radiusX, double radiusY, bool isInverted=false)
Definition: AreaBoundary.cpp:60
EllipseBoundary::EllipseBoundary ( DoublePosition const center,
double  radiusX,
double  radiusY,
bool  isInverted = false 
)
62  :
63  AreaBoundary(BoundaryType::BOUNDARY_ELLIPSE, isInverted), _center(center), _radiusYSq(radiusY*radiusY), _scaleXSq(_radiusYSq / (radiusX*radiusX)) { }
const DoublePosition _center
Definition: AreaBoundary.h:108
const double _radiusYSq
Definition: AreaBoundary.h:109
const double _scaleXSq
Definition: AreaBoundary.h:109
AreaBoundary(BoundaryType bType, bool isInverted)
Definition: AreaBoundary.h:63

Member Function Documentation

bool EllipseBoundary::IsWithinBoundaryArea ( const Position pos) const
overrideprotectedvirtual

Implements AreaBoundary.

65 {
66  if (!pos)
67  return false;
68 
69  double offX = _center.GetDoublePositionX()-pos->GetPositionX(), offY = _center.GetDoublePositionY()-pos->GetPositionY();
70  return (offX*offX)*_scaleXSq + (offY*offY) <= _radiusYSq;
71 }
double GetDoublePositionX() const
Definition: AreaBoundary.h:49
const DoublePosition _center
Definition: AreaBoundary.h:108
float GetPositionY() const
Definition: Position.h:105
double GetDoublePositionY() const
Definition: AreaBoundary.h:50
const double _radiusYSq
Definition: AreaBoundary.h:109
const double _scaleXSq
Definition: AreaBoundary.h:109
float GetPositionX() const
Definition: Position.h:104

+ Here is the call graph for this function:

Member Data Documentation

const DoublePosition EllipseBoundary::_center
private
const double EllipseBoundary::_radiusYSq
private
const double EllipseBoundary::_scaleXSq
private

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