Panda3D
Macros | Functions
nearly_zero.h File Reference

PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University. More...

#include "dtoolbase.h"

Go to the source code of this file.

Macros

#define IS_NEARLY_EQUAL(value1, value2)   (IS_THRESHOLD_EQUAL(value1, value2, get_nearly_zero_value(value1)))
 
#define IS_NEARLY_ZERO(value)   (IS_THRESHOLD_ZERO(value, get_nearly_zero_value(value)))
 
#define IS_THRESHOLD_COMPEQ(value1, value2, threshold)   (cfloor(value1 / threshold + 0.5f) == cfloor(value2 / threshold + 0.5f))
 
#define IS_THRESHOLD_EQUAL(value1, value2, threshold)   (IS_THRESHOLD_ZERO((value1) - (value2), threshold))
 
#define IS_THRESHOLD_ZERO(value, threshold)   ((value) < (threshold) && (value) > -(threshold))
 
#define MAYBE_ZERO(value)   (IS_NEARLY_ZERO(value) ? 0 : (value))
 
#define NEARLY_ZERO(FLOATTYPE)   (get_nearly_zero_value((FLOATTYPE)0))
 

Functions

constexpr double get_nearly_zero_value (double)
 
constexpr float get_nearly_zero_value (float)
 
constexpr int get_nearly_zero_value (int)
 

Detailed Description

PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.

All rights reserved.

All use of this software is subject to the terms of the revised BSD license. You should have received a copy of this license along with this source code in a file named "LICENSE."

Author
drose
Date
2000-03-08

Definition in file nearly_zero.h.