AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
EllipseBoundary Class Reference

#include "AreaBoundary.h"

Inheritance diagram for EllipseBoundary:
AreaBoundary

Public Member Functions

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

Protected Member Functions

bool IsWithinBoundaryArea (Position const *pos) const override
 
- Protected Member Functions inherited from AreaBoundary
 AreaBoundary (bool isInverted)
 
virtual bool IsWithinBoundaryArea (Position const *pos) const =0
 

Private Attributes

DoublePosition const _center
 
double const _radiusYSq
 
double const _scaleXSq
 

Detailed Description

Constructor & Destructor Documentation

◆ EllipseBoundary()

EllipseBoundary::EllipseBoundary ( Position const &  center,
double  radiusX,
double  radiusY,
bool  isInverted = false 
)
49 :
50 AreaBoundary(isInverted), _center(center), _radiusYSq(radiusY*radiusY), _scaleXSq(_radiusYSq / (radiusX*radiusX)) { }
Definition: AreaBoundary.h:24
DoublePosition const _center
Definition: AreaBoundary.h:111
double const _scaleXSq
Definition: AreaBoundary.h:112
double const _radiusYSq
Definition: AreaBoundary.h:112

Member Function Documentation

◆ IsWithinBoundaryArea()

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

Implements AreaBoundary.

53{
54 double offX = _center.GetDoublePositionX() - pos->GetPositionX();
55 double offY = _center.GetDoublePositionY() - pos->GetPositionY();
56 return (offX*offX)*_scaleXSq + (offY*offY) <= _radiusYSq;
57}
double GetDoublePositionY() const
Definition: AreaBoundary.h:46
double GetDoublePositionX() const
Definition: AreaBoundary.h:45

References _center, _radiusYSq, _scaleXSq, AreaBoundary::DoublePosition::GetDoublePositionX(), AreaBoundary::DoublePosition::GetDoublePositionY(), Position::GetPositionX(), and Position::GetPositionY().

Member Data Documentation

◆ _center

DoublePosition const EllipseBoundary::_center
private

Referenced by IsWithinBoundaryArea().

◆ _radiusYSq

double const EllipseBoundary::_radiusYSq
private

Referenced by IsWithinBoundaryArea().

◆ _scaleXSq

double const EllipseBoundary::_scaleXSq
private

Referenced by IsWithinBoundaryArea().