AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Geometry.h File Reference
#include "Define.h"
#include <cstdlib>
#include <iostream>
#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

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

Referenced by Position::GetAngle().

◆ getCircleAreaByRadius()

double getCircleAreaByRadius ( double  radius)
inline
54{
55 return radius * radius * M_PI;
56}

Referenced by getCylinderVolume(), and getOutOfWater().

◆ getCirclePerimeterByRadius()

double getCirclePerimeterByRadius ( double  radius)
inline
59{
60 return radius * M_PI;
61}

◆ getCylinderVolume()

double getCylinderVolume ( double  height,
double  radius 
)
inline
64{
65 return height * getCircleAreaByRadius(radius);
66}
double getCircleAreaByRadius(double radius)
Definition: Geometry.h:53

References getCircleAreaByRadius().

Referenced by getWeight().

◆ getSlopeAngle()

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

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

◆ getSlopeAngleAbs()

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

References getSlopeAngle().

Referenced by PathGenerator::GetRequiredHeightToClimb().