blob: 32d7be6c0470de4ff30d843f2af4408eaa27aae1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
/*
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
*/
/**
*
* Utility library to define some global function for simple physics calculations
*
*/
#ifndef _ACORE_PHYSICS_H
#define _ACORE_PHYSICS_H
#include "Geometry.h"
#include <cmath>
#include <cstdlib>
#include <iostream>
using namespace std;
[[nodiscard]] inline float getWeight(float height, float width, float specificWeight)
{
auto volume = getCylinderVolume(height, width / 2.0f);
auto weight = volume * specificWeight;
return weight;
}
/**
* @brief Get the height immersed in water
*
* @param height
* @param width
* @param weight specific weight
* @return float
*/
[[nodiscard]] inline float getOutOfWater(float width, float weight, float density)
{
auto baseArea = getCircleAreaByRadius(width / 2.0f);
return weight / (baseArea * density);
}
#endif // _ACORE_PHYSICS_H
|