tile2d
Loading...
Searching...
No Matches
Classes | Typedefs | Functions
math.hpp File Reference

contains various functions and classes that are used for both convience and/or functionality that may not be fit to be in other files More...

#include "base.hpp"

Go to the source code of this file.

Classes

struct  std::less< glm::i32vec2 >
 
struct  std::less< glm::vec< 2, int32_t, glm::packed_lowp > >
 
struct  std::hash< glm::i32vec2 >
 
struct  boost::hash< glm::vec< 2, int32_t, glm::packed_lowp > >
 
struct  boost::hash< glm::i32vec2 >
 
struct  std::equal_to< glm::i32vec2 >
 
class  SinCos
 Used to simplify the use of precalculated values for sine and cosine. More...
 
struct  Transform
 
struct  AABB< T, Prec >
 
struct  LinearGeneralForm
 
struct  TOBB
 

Typedefs

using MinMax = std::pair<Float, Float>
 

Functions

template<typename T >
T2D_NAMESPACE_BEGIN T constexpr square (T x)
 Returns the sqaure of x.
 
vec2 rotate (const vec2 &v, Float sin, Float cos)
 
vec2 rotate (const vec2 &v, const SinCos &sincos)
 
Float cross (const vec2 &a, const vec2 &b)
 
bool overlap (Float min1, Float max1, Float min2, Float max2)
 
Float absdot (const vec2 &vec1, const vec2 &vec2)
 
vec2 reverse (const vec2 &vec)
 
Float sideOf (const vec2 &p, const vec2 &a, const vec2 &b)
 
template<typename T >
parallelAxisTheorem (T Icm, T mass, T sqDistance)
 
template<typename T >
AABB< T > computeAABBCollisionArea (const AABB< T > &_1, const AABB< T > &_2)
 
bool nearlyEqual (Float a, Float b, Float max=0.0001f)
 
bool nearlyEqual (vec2 a, vec2 b, Float max=0.0001f)
 
Float sqaure (Float value)
 
Float pointSegmentDistance (vec2 p, vec2 v1, vec2 v2, vec2 &cp)
 
template<class Container >
MinMax projectBoxOnNormal (const Container &vertices, const vec2 &normal)
 
template<class Container , class OutputContainer = std::vector<vec2>>
OutputContainer sutherlandHodgmanClip (const Container &subjectVertices, const Container &clipVertices)
 
bool circleCollide (Float radi1, const vec2 &pos1, Float radi2, const vec2 &pos2)
 
Float convertToFloat (uint8_t num)
 
template<typename Tint >
Tint constexpr getSqrtMagicNumber ()
 
template<>
constexpr std::int32_t getSqrtMagicNumber ()
 
template<>
constexpr std::int64_t getSqrtMagicNumber ()
 
template<typename T >
fastInverseSqrt (T x)
 
template<typename Int , typename Float >
Int floor (Float x)
 

Detailed Description

contains various functions and classes that are used for both convience and/or functionality that may not be fit to be in other files

Function Documentation

◆ square()

template<typename T >
T2D_NAMESPACE_BEGIN T constexpr square ( T x)
constexpr

Returns the sqaure of x.

Parameters
xThe value to get the sqaure of
Returns
The sqaure of x