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

#include "AreaBoundary.h"

Inheritance diagram for CircleBoundary:
AreaBoundary

Public Member Functions

 CircleBoundary (Position const &center, double radius, bool isInverted=false)
 
 CircleBoundary (Position const &center, Position const &pointOnCircle, 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 _radiusSq
 

Detailed Description

Constructor & Destructor Documentation

◆ CircleBoundary() [1/2]

CircleBoundary::CircleBoundary ( Position const &  center,
double  radius,
bool  isInverted = false 
)
35 :
36 AreaBoundary(isInverted), _center(center), _radiusSq(radius*radius) { }
Definition: AreaBoundary.h:24
DoublePosition const _center
Definition: AreaBoundary.h:98
double const _radiusSq
Definition: AreaBoundary.h:99

◆ CircleBoundary() [2/2]

CircleBoundary::CircleBoundary ( Position const &  center,
Position const &  pointOnCircle,
bool  isInverted = false 
)
38 :
39 AreaBoundary(isInverted), _center(center), _radiusSq(_center.GetDoubleExactDist2dSq(pointOnCircle)) { }
double GetDoubleExactDist2dSq(DoublePosition const &pos) const
Definition: AreaBoundary.h:49

Member Function Documentation

◆ IsWithinBoundaryArea()

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

Implements AreaBoundary.

42{
43 double offX = _center.GetDoublePositionX() - pos->GetPositionX();
44 double offY = _center.GetDoublePositionY() - pos->GetPositionY();
45 return offX * offX + offY * offY <= _radiusSq;
46}
double GetDoublePositionY() const
Definition: AreaBoundary.h:46
double GetDoublePositionX() const
Definition: AreaBoundary.h:45

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

Member Data Documentation

◆ _center

DoublePosition const CircleBoundary::_center
private

Referenced by IsWithinBoundaryArea().

◆ _radiusSq

double const CircleBoundary::_radiusSq
private

Referenced by IsWithinBoundaryArea().