#include "lrint.h"
#include <iostream>
#include <cmath>
#include <float.h>
#include <algorithm>
Go to the source code of this file.
Functions | |
template<typename Element , typename OtherElement > | |
bool | float_equal_epsilon (const Element &self, const OtherElement &other, const Element &epsilon) |
Returns true if self is equal to other other within epsilon . | |
template<typename Element > | |
Element | float_mid (const Element &self, const Element &other) |
Returns the value midway between self and other . | |
template<typename Element > | |
int | float_to_integer (const Element &f) |
Returns f rounded to the nearest integer. Note that this is not the same behaviour as casting from float to int. | |
template<typename Element , typename OtherElement > | |
Element | float_snapped (const Element &f, const OtherElement &snap) |
Returns f rounded to the nearest multiple of snap . | |
template<typename Element > | |
bool | float_is_integer (const Element &f) |
Returns true if f has no decimal fraction part. | |
template<typename Element , typename ModulusElement > | |
Element | float_mod_range (const Element &self, const ModulusElement &modulus) |
Returns self modulated by the range [0, modulus ) self must be in the range [-modulus , modulus ). | |
template<typename Element , typename ModulusElement > | |
Element | float_mod (const Element &self, const ModulusElement &modulus) |
Returns self modulated by the range [0, modulus ). |
bool float_equal_epsilon | ( | const Element & | self, | |
const OtherElement & | other, | |||
const Element & | epsilon | |||
) | [inline] |
Returns true if self
is equal to other other
within epsilon
.
Definition at line 18 of file FloatTools.h.
Referenced by SelectionIntersection::equalEpsilon(), plane3_equal(), plane3_valid(), vector3_equal_epsilon(), and vector4_equal_epsilon().
bool float_is_integer | ( | const Element & | f | ) | [inline] |
Returns true if f
has no decimal fraction part.
Definition at line 46 of file FloatTools.h.
References float_to_integer().
Referenced by check_plane_is_integer().
Element float_mid | ( | const Element & | self, | |
const Element & | other | |||
) | [inline] |
Returns the value midway between self
and other
.
Definition at line 25 of file FloatTools.h.
Element float_mod | ( | const Element & | self, | |
const ModulusElement & | modulus | |||
) | [inline] |
Returns self
modulated by the range [0, modulus
).
Definition at line 61 of file FloatTools.h.
References float_mod_range().
Referenced by EntityAttribute::angle_normalised(), normalise_angle(), and normalise_angles().
Element float_mod_range | ( | const Element & | self, | |
const ModulusElement & | modulus | |||
) | [inline] |
Returns self
modulated by the range [0, modulus
) self
must be in the range [-modulus
, modulus
).
Definition at line 54 of file FloatTools.h.
Referenced by float_mod().
Element float_snapped | ( | const Element & | f, | |
const OtherElement & | snap | |||
) | [inline] |
Returns f
rounded to the nearest multiple of snap
.
Definition at line 39 of file FloatTools.h.
References float_to_integer().
Referenced by quantiseFloating(), and vector3_snapped().
int float_to_integer | ( | const Element & | f | ) | [inline] |
Returns f
rounded to the nearest integer. Note that this is not the same behaviour as casting from float to int.
Definition at line 32 of file FloatTools.h.
Referenced by XORRectangle::draw(), float_is_integer(), float_snapped(), quantiseInteger(), and vector3_snapped().