Fixed32 Class Reference

#include <OSGFixed.h>

List of all members.


Public Member Functions

 Fixed32 (void)
 Fixed32 (const Real32 source)
 Fixed32 (const UInt32 source)
 Fixed32 (const Fixed32 &source)
 ~Fixed32 (void)
Fixed32 operator- () const
void setFixedValue (Int32 src)
Fixed32operator= (const Fixed32 rhs)
Fixed32operator+= (const Fixed32 rhs)
Fixed32operator-= (const Fixed32 rhs)
Fixed32operator *= (const Fixed32 rhs)
Fixed32operator/= (const Fixed32 rhs)
Fixed32 operator+ (const Fixed32 rhs) const
Fixed32 operator- (const Fixed32 rhs) const
Fixed32 operator * (const Fixed32 rhs) const
Fixed32 operator/ (const Fixed32 rhs) const
bool operator== (const Fixed32 rhs) const
bool operator!= (const Fixed32 rhs) const
bool operator< (const Fixed32 rhs) const
bool operator> (const Fixed32 rhs) const
bool operator<= (const Fixed32 rhs) const
bool operator>= (const Fixed32 rhs) const
Int32 getValue (void) const
void setValue (Int32 iVal)

Static Public Member Functions

static Fixed32 abs (Fixed32 rhs)
static Fixed32 sqrt (Fixed32 rhs)
static Fixed32 sin (Fixed32 rhs)
static Fixed32 cos (Fixed32 rhs)
static Fixed32 tan (Fixed32 rhs)

Protected Member Functions

 Fixed32 (const Int32 source)

Static Protected Member Functions

static Real32 toFloat (Fixed32 rhs)

Private Attributes

Int32 _value

Detailed Description

Definition at line 46 of file OSGFixed.h.


Constructor & Destructor Documentation

Fixed32::Fixed32 ( void   )  [inline]

Definition at line 47 of file OSGFixed.inl.

00047                      :
00048     _value(0)
00049 {
00050 }

Fixed32::Fixed32 ( const Real32  source  )  [inline]

Definition at line 53 of file OSGFixed.inl.

00053                                     :
00054     _value(Int32(source * 65536.0f))
00055 {
00056     
00057 }

Fixed32::Fixed32 ( const UInt32  source  )  [inline]

Definition at line 60 of file OSGFixed.inl.

00060                                     :
00061     _value(source << 16)
00062 {
00063 }

Fixed32::Fixed32 ( const Fixed32 source  )  [inline]

Definition at line 72 of file OSGFixed.inl.

00072                                       :
00073     _value(source._value)
00074 {
00075 }

Fixed32::~Fixed32 ( void   )  [inline]

Definition at line 78 of file OSGFixed.inl.

00079 {
00080 }

Fixed32::Fixed32 ( const Int32  source  )  [inline, protected]

Definition at line 66 of file OSGFixed.inl.

00066                                    :
00067     _value(source)
00068 {
00069 }


Member Function Documentation

Fixed32 Fixed32::operator- (  )  const [inline]

Definition at line 85 of file OSGFixed.inl.

References _value.

00086 {
00087     Fixed32 returnValue;
00088 
00089     returnValue._value = -_value;
00090 
00091     return returnValue;
00092 }

void Fixed32::setFixedValue ( Int32  src  )  [inline]

Definition at line 95 of file OSGFixed.inl.

References _value.

00096 {
00097     _value = src;
00098 }

Fixed32 & Fixed32::operator= ( const Fixed32  rhs  )  [inline]

Definition at line 103 of file OSGFixed.inl.

References _value.

00104 {
00105     _value = rhs._value;
00106 
00107     return *this;
00108 }

Fixed32 & Fixed32::operator+= ( const Fixed32  rhs  )  [inline]

Definition at line 111 of file OSGFixed.inl.

References _value.

00112 {
00113     _value += rhs._value;
00114 
00115     return *this;
00116 }

Fixed32 & Fixed32::operator-= ( const Fixed32  rhs  )  [inline]

Definition at line 119 of file OSGFixed.inl.

References _value.

00120 {
00121     _value -= rhs._value;
00122 
00123     return *this;
00124 }

Fixed32 & Fixed32::operator *= ( const Fixed32  rhs  )  [inline]

Definition at line 127 of file OSGFixed.inl.

References _value.

00128 {
00129     _value = (Int32)(((Int64)_value * (Int64) rhs._value) >> 16);
00130 
00131     return *this;
00132 }

Fixed32 & Fixed32::operator/= ( const Fixed32  rhs  )  [inline]

Definition at line 135 of file OSGFixed.inl.

References _value.

00136 {
00137     _value = (Int32)(((Int64) _value << 16) / rhs._value);
00138 
00139     return *this;
00140 }

Fixed32 Fixed32::operator+ ( const Fixed32  rhs  )  const [inline]

Definition at line 143 of file OSGFixed.inl.

References _value.

00144 {
00145     Fixed32 returnValue(_value);
00146 
00147     returnValue._value += rhs._value;
00148 
00149     return returnValue;
00150 }

Fixed32 Fixed32::operator- ( const Fixed32  rhs  )  const [inline]

Definition at line 154 of file OSGFixed.inl.

References _value.

00155 {
00156     Fixed32 returnValue(_value);
00157 
00158     returnValue._value -= rhs._value;
00159 
00160     return returnValue;
00161 }

Fixed32 Fixed32::operator * ( const Fixed32  rhs  )  const [inline]

Definition at line 164 of file OSGFixed.inl.

References _value.

00165 {
00166     Fixed32 returnValue;
00167 
00168     returnValue._value = (Int32)(((Int64) _value * 
00169                                   (Int64) rhs._value) >> 16);
00170 
00171     return returnValue;
00172 }

Fixed32 Fixed32::operator/ ( const Fixed32  rhs  )  const [inline]

Definition at line 175 of file OSGFixed.inl.

References _value.

00176 {
00177     Fixed32 returnValue;
00178 
00179     returnValue._value = (Int32)(((Int64) _value << 16) / rhs._value);
00180 
00181     return returnValue;
00182 }

bool Fixed32::operator== ( const Fixed32  rhs  )  const [inline]

Definition at line 185 of file OSGFixed.inl.

References _value.

00186 {
00187     return _value == rhs._value;
00188 }

bool Fixed32::operator!= ( const Fixed32  rhs  )  const [inline]

Definition at line 191 of file OSGFixed.inl.

References _value.

00192 {
00193     return _value != rhs._value;
00194 }

bool Fixed32::operator< ( const Fixed32  rhs  )  const [inline]

Definition at line 197 of file OSGFixed.inl.

References _value.

00198 {
00199     return _value < rhs._value;
00200 }

bool Fixed32::operator> ( const Fixed32  rhs  )  const [inline]

Definition at line 203 of file OSGFixed.inl.

References _value.

00204 {
00205     return _value > rhs._value;
00206 }

bool Fixed32::operator<= ( const Fixed32  rhs  )  const [inline]

Definition at line 210 of file OSGFixed.inl.

References _value.

00211 {
00212     return _value <= rhs._value;
00213 }

bool Fixed32::operator>= ( const Fixed32  rhs  )  const [inline]

Definition at line 217 of file OSGFixed.inl.

References _value.

00218 {
00219     return _value >= rhs._value;
00220 }

Int32 Fixed32::getValue ( void   )  const [inline]

Definition at line 223 of file OSGFixed.inl.

References _value.

Referenced by OSG::OutStream::operator<<().

00224 {
00225     return _value;
00226 }

void Fixed32::setValue ( Int32  iVal  )  [inline]

Definition at line 229 of file OSGFixed.inl.

References _value.

00230 {
00231     _value = iVal;
00232 }

Fixed32 Fixed32::abs ( Fixed32  rhs  )  [inline, static]

Definition at line 235 of file OSGFixed.inl.

References _value.

Referenced by OSG::osgAbs().

00236 {
00237     Fixed32 returnValue;
00238     
00239     returnValue._value = (rhs._value > 0 ? rhs._value : - rhs._value);
00240 
00241     return returnValue;
00242 }

Fixed32 Fixed32::sqrt ( Fixed32  rhs  )  [inline, static]

Definition at line 251 of file OSGFixed.inl.

References toFloat().

Referenced by OSG::osgSqrt().

00252 {
00253     Fixed32 returnValue((Real32(std::sqrt(Fixed32::toFloat(rhs)))));
00254 
00255     return returnValue;
00256 }

Fixed32 Fixed32::sin ( Fixed32  rhs  )  [inline, static]

Definition at line 259 of file OSGFixed.inl.

References toFloat().

Referenced by OSG::osgSin().

00260 {
00261     Fixed32 returnValue((Real32(std::sin(Fixed32::toFloat(rhs)))));
00262 
00263     return returnValue;
00264 }

Fixed32 Fixed32::cos ( Fixed32  rhs  )  [inline, static]

Definition at line 267 of file OSGFixed.inl.

References toFloat().

Referenced by OSG::osgCos().

00268 {
00269     Fixed32 returnValue((Real32(std::cos(Fixed32::toFloat(rhs)))));
00270 
00271     return returnValue;
00272 }

Fixed32 Fixed32::tan ( Fixed32  rhs  )  [inline, static]

Definition at line 275 of file OSGFixed.inl.

References toFloat().

Referenced by OSG::osgTan().

00276 {
00277     Fixed32 returnValue((Real32(std::tan(Fixed32::toFloat(rhs)))));
00278 
00279     return returnValue;
00280 }

Real32 Fixed32::toFloat ( Fixed32  rhs  )  [inline, static, protected]

Definition at line 245 of file OSGFixed.inl.

References _value.

Referenced by cos(), sin(), sqrt(), and tan().

00246 {
00247     return (Real32)(rhs._value) / (Real32)(1 << 16);
00248 }


Member Data Documentation

Int32 Fixed32::_value [private]


The documentation for this class was generated from the following files: