GL Studio Safety Critical Embedded C++ Runtime Library
GlsUtil Class Reference

#include <gls_util.h>

Classes

class  InlineReader
 

Static Public Member Functions

static GlsBool VeryCloseToZero (const GlsFloat32 val)
 
static GlsBool EqualFloat32 (const GlsFloat32 x, const GlsFloat32 y, const GlsFloat32 precision)
 
static GlsFloat64 Float64Mod (const GlsFloat64 x, const GlsFloat64 y)
 
static GlsBool EqualColor (const GlsColor &a, const GlsColor &b)
 
static void NormalizeVector3D (GlsVector3D &v)
 
static void CrossProductVector3D (GlsVector3D &v, const GlsVector3D &w)
 
static GlsFloat32 DistanceVector3D (const GlsVector3D &v, const GlsVector3D &w)
 

Static Public Attributes

static const GlsFloat64 PI
 
static const GlsFloat64 DEGREES_TO_RADIANS
 
static const GlsColor BLACK_GLS_COLOR
 
static const GlsVector3D ZERO_VECTOR_3D
 
static const GlsVector3D ONE_VECTOR_3D
 

Static Protected Attributes

static const GlsFloat32 CLOSE_TO_ZERO
 

Detailed Description

A collection of utility classes and functions

Invariant
NA (all static members)

Member Function Documentation

static void GlsUtil::CrossProductVector3D ( GlsVector3D v,
const GlsVector3D w 
)
static

Compute the 3D vector cross product of the the two vectors, assigning the result to v.

Parameters
v[in/out] vector on left side of cross product, receives result of cross product computation
wright side of cross product
Precondition
v.IsValid(), w.IsValid();
Postcondition
v = v X w
static GlsFloat32 GlsUtil::DistanceVector3D ( const GlsVector3D v,
const GlsVector3D w 
)
static

Compute the distance between the two given 3D points

Parameters
vfirst 3D point
wsecond 3D point
Returns
distance from v to w
Precondition
v.IsValid(), w.IsValid()
Postcondition
none
static GlsBool GlsUtil::EqualColor ( const GlsColor a,
const GlsColor b 
)
static

Determine if the two given colors are equal

Parameters
afirst color in question
bsecond color in question
Returns
GLS_TRUE if the colors are equal else GLS_FALSE
Precondition
a.IsValid(), b.IsValid()
Postcondition
none
static GlsBool GlsUtil::EqualFloat32 ( const GlsFloat32  x,
const GlsFloat32  y,
const GlsFloat32  precision 
)
static

Determine if the two given floats are within precision amount of each other

Parameters
xfirst float in question
ysecond float in question
precisionprecision amount indicating equal floats
Returns
GLS_TRUE if the two floats are within precision of each other else GLS_FALSE
Precondition
GlsFloatIsValid( x ), GlsFloatIsValid( y ), GlsFloatIsValid( precision ), precision > 0.0
Postcondition
none
static GlsFloat64 GlsUtil::Float64Mod ( const GlsFloat64  x,
const GlsFloat64  y 
)
static

Get the gloating point modulus ( x mod y )

Parameters
xnumber to mod
ynumber to mod by
Returns
x mod y
Precondition
GlsFloatIsValid( x ), GlsFloatIsValid( y )
Postcondition
none
static void GlsUtil::NormalizeVector3D ( GlsVector3D v)
static

Normalize the given vector

Parameters
v[in/out] vector to normalize
Precondition
v.IsValid(), the magnitide of v > 0.0
Postcondition
v is normalized
static GlsBool GlsUtil::VeryCloseToZero ( const GlsFloat32  val)
static

Determine if the given value is very close (< 10E-4) to 0.0

Parameters
valvalue in question
Returns
GLS_TRUE if very close to zero else GLS_FALSE
Precondition
GlsFloatIsValid( val );
Postcondition
none

Member Data Documentation

const GlsColor GlsUtil::BLACK_GLS_COLOR
static

black GlsColor constant

const GlsFloat32 GlsUtil::CLOSE_TO_ZERO
staticprotected

value used to determine if a value is close to 0.0

const GlsFloat64 GlsUtil::DEGREES_TO_RADIANS
static

degrees to radians conversion factor

const GlsVector3D GlsUtil::ONE_VECTOR_3D
static

3D vector of all ones

const GlsFloat64 GlsUtil::PI
static

PI constant

const GlsVector3D GlsUtil::ZERO_VECTOR_3D
static

3D vector of all zeroes