Main Page Class List Class Members

# sdk/extensions/authoring/source/VHACD/inc/btScalar.h File Reference

`#include <float.h>`
`#include <math.h>`
`#include <stdlib.h>`
`#include <stdint.h>`
`#include <assert.h>`

Go to the source code of this file.

## Classes
struct | btTypedObject
| rudimentary class to provide type info More...
## Defines
#define | ATTRIBUTE_ALIGNED128(a) a
#define | ATTRIBUTE_ALIGNED16(a) a
#define | ATTRIBUTE_ALIGNED64(a) a
#define | BT_BULLET_VERSION 279
#define | BT_DECLARE_ALIGNED_ALLOCATOR()
#define | BT_DECLARE_HANDLE(name)
#define | BT_LARGE_FLOAT 1e18f
#define | btAssert(x)
#define | btFsels(a, b, c) (btScalar) btFsel(a, b, c)
#define | btFullAssert(x)
#define | btLikely(_c) _c
#define | btRecipSqrt(x) ((btScalar)(btScalar(1.0) / btSqrt(btScalar(x))))
#define | btUnlikely(_c) _c
#define | SIMD_2_PI btScalar(6.283185307179586232)
#define | SIMD_DEGS_PER_RAD (btScalar(360.0) / SIMD_2_PI)
#define | SIMD_EPSILON FLT_EPSILON
#define | SIMD_FORCE_INLINE inline
#define | SIMD_HALF_PI (SIMD_2_PI * btScalar(0.25))
#define | SIMD_INFINITY FLT_MAX
#define | SIMD_PI (SIMD_2_PI * btScalar(0.5))
#define | SIMD_RADS_PER_DEG (SIMD_2_PI / btScalar(360.0))
#define | SIMDSQRT12 btScalar(0.7071067811865475244008443621048490)
## Typedefs
typedef float | btScalar
| The btScalar type abstracts floating point numbers, to easily switch between double and single floating point precision.
## Functions
SIMD_FORCE_INLINE btScalar | btAcos (btScalar x)
SIMD_FORCE_INLINE btScalar | btAsin (btScalar x)
SIMD_FORCE_INLINE btScalar | btAtan (btScalar x)
SIMD_FORCE_INLINE btScalar | btAtan2 (btScalar x, btScalar y)
SIMD_FORCE_INLINE btScalar | btAtan2Fast (btScalar y, btScalar x)
SIMD_FORCE_INLINE btScalar | btCos (btScalar x)
SIMD_FORCE_INLINE btScalar | btDegrees (btScalar x)
SIMD_FORCE_INLINE bool | btEqual (btScalar a, btScalar eps)
SIMD_FORCE_INLINE btScalar | btExp (btScalar x)
SIMD_FORCE_INLINE btScalar | btFabs (btScalar x)
SIMD_FORCE_INLINE btScalar | btFmod (btScalar x, btScalar y)
SIMD_FORCE_INLINE btScalar | btFsel (btScalar a, btScalar b, btScalar c)
SIMD_FORCE_INLINE bool | btFuzzyZero (btScalar x)
int32_t | btGetVersion ()
SIMD_FORCE_INLINE bool | btGreaterEqual (btScalar a, btScalar eps)
SIMD_FORCE_INLINE int32_t | btIsNegative (btScalar x)
SIMD_FORCE_INLINE btScalar | btLog (btScalar x)
SIMD_FORCE_INLINE bool | btMachineIsLittleEndian ()
SIMD_FORCE_INLINE btScalar | btNormalizeAngle (btScalar angleInRadians)
SIMD_FORCE_INLINE btScalar | btPow (btScalar x, btScalar y)
SIMD_FORCE_INLINE btScalar | btRadians (btScalar x)
SIMD_FORCE_INLINE float | btSelect (unsigned condition, float valueIfConditionNonZero, float valueIfConditionZero)
SIMD_FORCE_INLINE int32_t | btSelect (unsigned condition, int32_t valueIfConditionNonZero, int32_t valueIfConditionZero)
SIMD_FORCE_INLINE unsigned | btSelect (unsigned condition, unsigned valueIfConditionNonZero, unsigned valueIfConditionZero)
SIMD_FORCE_INLINE btScalar | btSin (btScalar x)
SIMD_FORCE_INLINE btScalar | btSqrt (btScalar y)
template<typename T >
SIMD_FORCE_INLINE void | btSwap (T &a, T &b)
SIMD_FORCE_INLINE unsigned short | btSwapEndian (short val)
SIMD_FORCE_INLINE unsigned | btSwapEndian (int32_t val)
SIMD_FORCE_INLINE unsigned short | btSwapEndian (unsigned short val)
SIMD_FORCE_INLINE unsigned | btSwapEndian (unsigned val)
SIMD_FORCE_INLINE void | btSwapEndianDouble (double d, unsigned char *dst)
SIMD_FORCE_INLINE uint32_t | btSwapEndianFloat (float d)
| btSwapFloat uses using char pointers to swap the endianness
SIMD_FORCE_INLINE btScalar | btTan (btScalar x)
SIMD_FORCE_INLINE double | btUnswapEndianDouble (const unsigned char *src)
SIMD_FORCE_INLINE float | btUnswapEndianFloat (uint32_t a)

## Define Documentation

#define ATTRIBUTE_ALIGNED128 | ( | a |  | ) | a

#define ATTRIBUTE_ALIGNED16 | ( | a |  | ) | a

Todo:
  : check out alignment methods for other platforms/compilers define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16))) define ATTRIBUTE_ALIGNED64(a) a __attribute__ ((aligned (64))) define ATTRIBUTE_ALIGNED128(a) a __attribute__ ((aligned (128)))

#define ATTRIBUTE_ALIGNED64 | ( | a |  | ) | a

#define BT_BULLET_VERSION 279

#define BT_DECLARE_ALIGNED_ALLOCATOR | ( |  | ) |

Value:

    SIMD_FORCE_INLINE void* operator new(size_t sizeInBytes) { return btAlignedAlloc(sizeInBytes, 16); }   \
        SIMD_FORCE_INLINE void operator delete(void* ptr) { btAlignedFree(ptr); }                              \
        SIMD_FORCE_INLINE void* operator new(size_t, void* ptr) { return ptr; }                                \
        SIMD_FORCE_INLINE void operator delete(void*, void*) {}                                                \
        SIMD_FORCE_INLINE void* operator new[](size_t sizeInBytes) { return btAlignedAlloc(sizeInBytes, 16); } \
        SIMD_FORCE_INLINE void operator delete[](void* ptr) { btAlignedFree(ptr); }                            \
        SIMD_FORCE_INLINE void* operator new[](size_t, void* ptr) { return ptr; }                              \
        SIMD_FORCE_INLINE void operator delete[](void*, void*) {}

#define BT_DECLARE_HANDLE | ( | name |  | ) |

Value:

    typedef struct name##__ {   \
            int32_t unused;             \
        } * name

#define BT_LARGE_FLOAT 1e18f

#define btAssert | ( | x |  | ) |

#define btFsels | ( | a,
|  | b,
|  | c |  | ) | (btScalar) btFsel(a, b, c)

#define btFullAssert | ( | x |  | ) |

#define btLikely | ( | _c |  | ) | _c

#define btRecipSqrt | ( | x |  | ) | ((btScalar)(btScalar(1.0) / btSqrt(btScalar(x))))

#define btUnlikely | ( | _c |  | ) | _c

#define SIMD_2_PI btScalar(6.283185307179586232)

#define SIMD_DEGS_PER_RAD (btScalar(360.0) / SIMD_2_PI)

#define SIMD_EPSILON FLT_EPSILON

#define SIMD_FORCE_INLINE inline

#define SIMD_HALF_PI (SIMD_2_PI * btScalar(0.25))

#define SIMD_INFINITY FLT_MAX

#define SIMD_PI (SIMD_2_PI * btScalar(0.5))

#define SIMD_RADS_PER_DEG (SIMD_2_PI / btScalar(360.0))

#define SIMDSQRT12 btScalar(0.7071067811865475244008443621048490)

## Typedef Documentation

typedef float btScalar

The btScalar type abstracts floating point numbers, to easily switch between double and single floating point precision.

## Function Documentation

SIMD_FORCE_INLINE btScalar btAcos | ( | btScalar | x | ) |

SIMD_FORCE_INLINE btScalar btAsin | ( | btScalar | x | ) |

SIMD_FORCE_INLINE btScalar btAtan | ( | btScalar | x | ) |

SIMD_FORCE_INLINE btScalar btAtan2 | ( | btScalar | x,
|  | btScalar | y |
| ) |  |  |

SIMD_FORCE_INLINE btScalar btAtan2Fast | ( | btScalar | y,
|  | btScalar | x |
| ) |  |  |

SIMD_FORCE_INLINE btScalar btCos | ( | btScalar | x | ) |

SIMD_FORCE_INLINE btScalar btDegrees | ( | btScalar | x | ) |

SIMD_FORCE_INLINE bool btEqual | ( | btScalar | a,
|  | btScalar | eps |
| ) |  |  |

SIMD_FORCE_INLINE btScalar btExp | ( | btScalar | x | ) |

SIMD_FORCE_INLINE btScalar btFabs | ( | btScalar | x | ) |

SIMD_FORCE_INLINE btScalar btFmod | ( | btScalar | x,
|  | btScalar | y |
| ) |  |  |

SIMD_FORCE_INLINE btScalar btFsel | ( | btScalar | a,
|  | btScalar | b,
|  | btScalar | c |
| ) |  |  |

SIMD_FORCE_INLINE bool btFuzzyZero | ( | btScalar | x | ) |

int32_t btGetVersion | ( |  | ) | `[inline]`

SIMD_FORCE_INLINE bool btGreaterEqual | ( | btScalar | a,
|  | btScalar | eps |
| ) |  |  |

SIMD_FORCE_INLINE int32_t btIsNegative | ( | btScalar | x | ) |

SIMD_FORCE_INLINE btScalar btLog | ( | btScalar | x | ) |

SIMD_FORCE_INLINE bool btMachineIsLittleEndian | ( |  | ) |

SIMD_FORCE_INLINE btScalar btNormalizeAngle | ( | btScalar | angleInRadians | ) |

SIMD_FORCE_INLINE btScalar btPow | ( | btScalar | x,
|  | btScalar | y |
| ) |  |  |

SIMD_FORCE_INLINE btScalar btRadians | ( | btScalar | x | ) |

SIMD_FORCE_INLINE float btSelect | ( | unsigned | condition,
|  | float | valueIfConditionNonZero,
|  | float | valueIfConditionZero |
| ) |  |  |

SIMD_FORCE_INLINE int32_t btSelect | ( | unsigned | condition,
|  | int32_t | valueIfConditionNonZero,
|  | int32_t | valueIfConditionZero |
| ) |  |  |

SIMD_FORCE_INLINE unsigned btSelect | ( | unsigned | condition,
|  | unsigned | valueIfConditionNonZero,
|  | unsigned | valueIfConditionZero |
| ) |  |  |

btSelect avoids branches, which makes performance much better for consoles like Playstation 3 and XBox 360 Thanks Phil Knight. See also http://www.cellperformance.com/articles/2006/04/more_techniques_for_eliminatin_1.html

SIMD_FORCE_INLINE btScalar btSin | ( | btScalar | x | ) |

SIMD_FORCE_INLINE btScalar btSqrt | ( | btScalar | y | ) |

template<typename T >

SIMD_FORCE_INLINE void btSwap | ( | T & | a,
|  | T & | b |
| ) |  |  | `[inline]`

SIMD_FORCE_INLINE unsigned short btSwapEndian | ( | short | val | ) |

SIMD_FORCE_INLINE unsigned btSwapEndian | ( | int32_t | val | ) |

SIMD_FORCE_INLINE unsigned short btSwapEndian | ( | unsigned short | val | ) |

SIMD_FORCE_INLINE unsigned btSwapEndian | ( | unsigned | val | ) |

SIMD_FORCE_INLINE void btSwapEndianDouble | ( | double | d,
|  | unsigned char * | dst |
| ) |  |  |

SIMD_FORCE_INLINE uint32_t btSwapEndianFloat | ( | float | d | ) |

btSwapFloat uses using char pointers to swap the endianness

btSwapFloat/btSwapDouble will NOT return a float, because the machine might 'correct' invalid floating point values Not all values of sign/exponent/mantissa are valid floating point numbers according to IEEE 754. When a floating point unit is faced with an invalid value, it may actually change the value, or worse, throw an exception. In most systems, running user mode code, you wouldn't get an exception, but instead the hardware/os/runtime will 'fix' the number for you. so instead of returning a float/double, we return integer/long long integer

SIMD_FORCE_INLINE btScalar btTan | ( | btScalar | x | ) |

SIMD_FORCE_INLINE double btUnswapEndianDouble | ( | const unsigned char * | src | ) |

SIMD_FORCE_INLINE float btUnswapEndianFloat | ( | uint32_t | a | ) |