NLPACS::CRational64 Class Reference

#include <edge_collide.h>


Detailed Description

A Rational of 2 64 bits.
Author:
Lionel Berenguier

Nevrax France

Date:
2001

Definition at line 123 of file edge_collide.h.

Public Member Functions

 CRational64 (sint64 num, sint64 den)
 CRational64 (sint64 a)
 CRational64 ()
bool operator< (const CRational64 &o) const
 operator<

bool operator== (const CRational64 &o) const
 operator==


Data Fields

sint64 Denominator
 Denominator. always >0.

sint64 Numerator
 Numerator.


Constructor & Destructor Documentation

NLPACS::CRational64::CRational64  )  [inline]
 

Definition at line 134 of file edge_collide.h.

00134 {}

NLPACS::CRational64::CRational64 sint64  a  )  [inline]
 

Definition at line 135 of file edge_collide.h.

References Denominator, Numerator, and sint64.

00135 : Numerator(a), Denominator(1) {}

NLPACS::CRational64::CRational64 sint64  num,
sint64  den
[inline]
 

Definition at line 136 of file edge_collide.h.

References Denominator, num, Numerator, and sint64.

00137         {
00138                 if(den>0)
00139                 {
00140                         Numerator= num; 
00141                         Denominator= den;
00142                 }
00143                 else
00144                 {
00145                         Numerator= -num; 
00146                         Denominator= -den;
00147                 }
00148         }


Member Function Documentation

bool NLPACS::CRational64::operator< const CRational64 o  )  const [inline]
 

operator<

Definition at line 151 of file edge_collide.h.

References Denominator, Numerator, and NLPACS::CInt128::setMul().

00152         {
00153                 CInt128         n0, n1;
00154                 // a/b < c/d  <=>  a*d < c*b
00155                 n0.setMul(Numerator, o.Denominator);
00156                 n1.setMul(o.Numerator, Denominator);
00157                 return n0<n1;
00158         }

bool NLPACS::CRational64::operator== const CRational64 o  )  const [inline]
 

operator==

Definition at line 161 of file edge_collide.h.

References Denominator, Numerator, and NLPACS::CInt128::setMul().

00162         {
00163                 CInt128         n0, n1;
00164                 // a/b == c/d  <=>  a*d == c*b
00165                 n0.setMul(Numerator, o.Denominator);
00166                 n1.setMul(o.Numerator, Denominator);
00167                 return n0==n1;
00168         }


Field Documentation

sint64 NLPACS::CRational64::Denominator
 

Denominator. always >0.

Definition at line 129 of file edge_collide.h.

Referenced by CRational64(), operator<(), operator==(), and NLPACS::CGlobalRetriever::testMovementWithCollisionChains().

sint64 NLPACS::CRational64::Numerator
 

Numerator.

Definition at line 127 of file edge_collide.h.

Referenced by CRational64(), operator<(), operator==(), and NLPACS::CGlobalRetriever::testMovementWithCollisionChains().


The documentation for this class was generated from the following file:
Generated on Tue Mar 16 14:22:17 2004 for NeL by doxygen 1.3.6