Basetypes

Last Updated 3/13/2000.

Types:

jeBoolean;

typedef int jeBoolean;
#define JE_FALSE ((jeBoolean)0)
#define JE_TRUE  ((jeBoolean)1)


typedef float jeFloat;

typedef signed long int32;

typedef signed short int16;

typedef signed char int8 ;

typedef unsigned long uint32;

typedef unsigned short uint16;

typedef unsigned char uint8 ;

Macros:

#define JE_ABS(x)

Computes the absolute value of x.


#define JE_BOOLSAME(x,y)

This returns True if x and y are both true or both false, otherwise it returns False.


#define JE_CLAMP(x,lo,hi)

If x is less than lo, lo is returned, otherwise if x is greater than hi, hi is returned, otherwise x is returned.  In other words x is "clamped" between hi and lo.


#define JE_CLAMP8(x)

This is an 8-bit unsigned (0-255) clamp.  See JE_CLAMP above for more information.


#define JE_CLAMP16(x)

This is a 16-bit unsigned (0-65536) clamp.  See JE_CLAMP above for more information


#define JE_DEGS_PER_RAD  ((jeFloat)0.01745329251994329576)

The number of degrees in a radian. This is backwards.
#define JE_EPSILON    ((jeFloat)0.000797f)
If two floating point values differ by this constant or less then they are considered equivalent per the definition of JE_FLOATS_EQUAL shown below.  Thanks to Raul Beltran for clarifying and confirming my suspicions about this. I'm still uncertain what the derivation of the specific value is.


#define JE_FLOATS_EQUAL(x,y) ( JE_ABS((x) - (y)) < JE_EPSILON )

This defines 2 floats (x,y) equal if they only differ by EPSILON as defined above.


#define JE_FLOAT_ISZERO(x)  JE_FLOATS_EQUAL(x,0.0f)

This defines a float as being "equal" to zero if it only differs from zero by EPSILON as define above.


#define JE_PI ((geFloat)3.14159265358979323846f) (also JE_TWOPI and JE_HALFPI define constants of double and half of this respectively)

A value to use for pi. (2*pi and 0.5*pi)


#define JE_RADS_PER_DEG  ((jeFloat)57.2957795130823208767)

This is the number of radians in a degree.  This is backwards.


#define NULL ((void *) 0)

A constant for null.
 
Functions:

static jeFloat __inline jeFloat_Cos(jeFloat val)

This function returns the cos() of jeFloat val.

Returns: the jeFloat result.
 

static __inline jeFloat jeFloat_Cube(jeFloat a)
This function returns the cube of a (a*a*a)

Returns: the jeFloat result.
 

__inline jeFloat jeFloat_DegToRad(jeFloat d)
This function converts the jeFloat d in degrees to radians.

Returns: the jeFloat result.


__inline jeFloat jeFloat_RadToDeg(jeFloat r)

This function converts the jeFloat r in radians to degrees.

Returns: the jeFloat result.


static jeFloat __inline jeFloat_RoundToInt(jeFloat val)

This function rounds jeFloat val to the nearest integer value returning the result as a jeFloat.

Returns: the result.

Notes:
    from Basetype.h:  rounds depending on how you set jeCPU_FloatControl


static jeFloat __inline jeFloat_Sin(jeFloat val)

This function returns the sin() of jeFloat val.

Returns:  the jeFloat result.
 

static __inline jeFloat jeFloat_Sqr(jeFloat a)
This function returns the square of a (a*a).

Returns:  the jeFloat result.
 

static jeFloat __inline jeFloat_Sqrt(jeFloat val)
This function returns the square root of jeFloat val as a jeFloat.

Returns:  the result
 

static int32 __inline jeFloat_ToInt(jeFloat f)
This function converts jeFloat f to an int32 value.

Returns:  the int32 result.