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

#include <AreaBoundary.h>

Public Member Functions

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

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

CircleBoundary::CircleBoundary ( Position const center,
double  radius,
bool  isInverted = false 
)
40  :
41  CircleBoundary(DoublePosition(center), radius, isInverted) { }
CircleBoundary(Position const &center, double radius, bool isInverted=false)
Definition: AreaBoundary.cpp:40
CircleBoundary::CircleBoundary ( DoublePosition const center,
double  radius,
bool  isInverted = false 
)
42  :
43  AreaBoundary(BoundaryType::BOUNDARY_CIRCLE, isInverted), _center(center), _radiusSq(radius*radius) { }
const double _radiusSq
Definition: AreaBoundary.h:95
const DoublePosition _center
Definition: AreaBoundary.h:94
AreaBoundary(BoundaryType bType, bool isInverted)
Definition: AreaBoundary.h:63
CircleBoundary::CircleBoundary ( Position const center,
Position const pointOnCircle,
bool  isInverted = false 
)
44  :
45  CircleBoundary(DoublePosition(center), DoublePosition(pointOnCircle), isInverted) { }
CircleBoundary(Position const &center, double radius, bool isInverted=false)
Definition: AreaBoundary.cpp:40
CircleBoundary::CircleBoundary ( DoublePosition const center,
DoublePosition const pointOnCircle,
bool  isInverted = false 
)
46  :
47  AreaBoundary(BoundaryType::BOUNDARY_CIRCLE, isInverted), _center(center), _radiusSq(center.GetDoubleExactDist2dSq(pointOnCircle)) { }
const double _radiusSq
Definition: AreaBoundary.h:95
const DoublePosition _center
Definition: AreaBoundary.h:94
AreaBoundary(BoundaryType bType, bool isInverted)
Definition: AreaBoundary.h:63

Member Function Documentation

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

Implements AreaBoundary.

49 {
50  if (!pos)
51  return false;
52 
53  double offX = _center.GetDoublePositionX() - pos->GetPositionX();
54  double offY = _center.GetDoublePositionY() - pos->GetPositionY();
55  return offX*offX+offY*offY <= _radiusSq;
56 }
double GetDoublePositionX() const
Definition: AreaBoundary.h:49
const double _radiusSq
Definition: AreaBoundary.h:95
const DoublePosition _center
Definition: AreaBoundary.h:94
float GetPositionY() const
Definition: Position.h:105
double GetDoublePositionY() const
Definition: AreaBoundary.h:50
float GetPositionX() const
Definition: Position.h:104

+ Here is the call graph for this function:

Member Data Documentation

const DoublePosition CircleBoundary::_center
private
const double CircleBoundary::_radiusSq
private

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