AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Geometry.h File Reference
#include <cstdlib>
#include <math.h>

Go to the source code of this file.

Functions

float getAngle (float startX, float startY, float destX, float destY)
 
float getSlopeAngle (float startX, float startY, float startZ, float destX, float destY, float destZ)
 
float getSlopeAngleAbs (float startX, float startY, float startZ, float destX, float destY, float destZ)
 
double getCircleAreaByRadius (double radius)
 
double getCirclePerimeterByRadius (double radius)
 
double getCylinderVolume (double height, double radius)
 

Function Documentation

◆ getAngle()

float getAngle ( float  startX,
float  startY,
float  destX,
float  destY 
)
inline

Utility library to define some global function for geometric calculations

31{
32 auto dx = destX - startX;
33 auto dy = destY - startY;
34
35 auto ang = std::atan2(dy, dx);
36 ang = (ang >= 0) ? ang : 2 * float(M_PI) + ang;
37 return ang;
38}

Referenced by Position::GetAngle().

◆ getCircleAreaByRadius()

double getCircleAreaByRadius ( double  radius)
inline
52{
53 return radius * radius * M_PI;
54}

Referenced by getCylinderVolume(), and getOutOfWater().

◆ getCirclePerimeterByRadius()

double getCirclePerimeterByRadius ( double  radius)
inline
57{
58 return radius * M_PI;
59}

◆ getCylinderVolume()

double getCylinderVolume ( double  height,
double  radius 
)
inline
62{
63 return height * getCircleAreaByRadius(radius);
64}
double getCircleAreaByRadius(double radius)
Definition: Geometry.h:51

References getCircleAreaByRadius().

Referenced by getWeight().

◆ getSlopeAngle()

float getSlopeAngle ( float  startX,
float  startY,
float  startZ,
float  destX,
float  destY,
float  destZ 
)
inline
41{
42 float floorDist = std::sqrt(pow(startY - destY, 2.0f) + pow(startX - destX, 2.0f));
43 return atan(std::abs(destZ - startZ) / std::abs(floorDist));
44}

Referenced by dtQueryFilterExt::getCost(), and getSlopeAngleAbs().

◆ getSlopeAngleAbs()

float getSlopeAngleAbs ( float  startX,
float  startY,
float  startZ,
float  destX,
float  destY,
float  destZ 
)
inline
47{
48 return std::abs(getSlopeAngle(startX, startY, startZ, destX, destY, destZ));
49}
float getSlopeAngle(float startX, float startY, float startZ, float destX, float destY, float destZ)
Definition: Geometry.h:40

References getSlopeAngle().

Referenced by PathGenerator::GetRequiredHeightToClimb().