CartoType API
Public Types | Public Member Functions | Static Public Member Functions
CartoType::TFixed Class Reference

#include <cartotype_arithmetic.h>

List of all members.

Public Types

enum  TRaw { ERaw }
enum  T64ths { E64ths }

Public Member Functions

 TFixed ()
 TFixed (int32 aValue)
 TFixed (int32 aValue, int32 aFractionalBits)
 TFixed (double aValue)
 TFixed (int32 aValue, TRaw)
 TFixed (int32 aValue, T64ths)
 TFixed (const TFixedSmall &aFixedSmall)
int32 RawValue () const
double FpValue () const
void SetRawValue (int32 aRawValue)
bool operator== (TFixed aFixed) const
bool operator!= (TFixed aFixed) const
bool operator< (TFixed aFixed) const
bool operator<= (TFixed aFixed) const
bool operator> (TFixed aFixed) const
bool operator>= (TFixed aFixed) const
int32 Rounded () const
int32 Floor () const
int32 Ceiling () const
int32 Rounded64ths () const
TFixed operator+ (TFixed aFixed) const
void operator+= (TFixed aFixed)
TFixed operator- (TFixed aFixed) const
void operator-= (TFixed aFixed)
void operator*= (TFixed aB)
TFixed operator* (TFixed aFixed) const
void operator*= (int32 aInt)
TFixed operator* (int32 aInt) const
void operator/= (TFixed aB)
TFixed operator/ (TFixed aFixed) const
void operator/= (int32 aInt)
TFixed operator/ (int32 aInt) const
TFixed operator- () const
CT_IMPORT TFixed Sqrt () const
CT_IMPORT TFixedSmall ToRadians () const
CT_IMPORT TFixed AngleDiff (TFixed aAngle) const
int32 IntegerPart () const
TFixed FractionalPart () const
TFixed Abs () const
bool IsZero () const
bool NonZero () const

Static Public Member Functions

static CT_IMPORT TFixed Pi ()
static CT_IMPORT TFixed HalfPi ()

Detailed Description

A fixed-point number consisting of a 16-bit integer plus 16 fractional bits. This type and the routines used are based on FreeType's FT_FIXED type and the FT_MulFix and FT_DivFix functions.


Member Enumeration Documentation

A dummy type allowing construction of a TFixed from 64ths.

A dummy type allowing construction of a TFixed from a raw value.


Constructor & Destructor Documentation

CartoType::TFixed::TFixed ( ) [inline]

Construct a TFixed with the value zero.

CartoType::TFixed::TFixed ( int32  aValue) [inline]

Construct a TFixed from an integer.

CartoType::TFixed::TFixed ( int32  aValue,
int32  aFractionalBits 
) [inline]

Construct a TFixed from a value with 0...16 fractional bits.

CartoType::TFixed::TFixed ( double  aValue) [inline]

Construct a TFixed from a double-precision floating-point number.

CartoType::TFixed::TFixed ( int32  aValue,
TRaw   
) [inline]

Construct a TFixed from a raw value.

CartoType::TFixed::TFixed ( int32  aValue,
T64ths   
) [inline]

Construct a TFixed from 64ths.

CartoType::TFixed::TFixed ( const TFixedSmall aFixedSmall) [inline]

Construct a TFixed from a TFixedSmall.


Member Function Documentation

TFixed CartoType::TFixed::Abs ( ) const [inline]

Return the absolute value of the fixed number.

CT_EXPORT TFixed TFixed::AngleDiff ( TFixed  aAngle) const

Return the difference between two angles. The result, expressed in radians, is the angular distance swept out when moving the angle to aAngle by the shortest route, and thus is in the range -pi ... pi.

int32 CartoType::TFixed::Ceiling ( ) const [inline]

Return the nearest integer value at or above the actual value.

int32 CartoType::TFixed::Floor ( ) const [inline]

Return the nearest integer value at or below the actual value.

double CartoType::TFixed::FpValue ( ) const [inline]

Return the value as a double-precision floating-point number.

TFixed CartoType::TFixed::FractionalPart ( ) const [inline]

Return the fractional part, rounding down. The fractional part of 3.6 is 0.6; the fractional part of -0.2 is 0.8.

CT_EXPORT TFixed TFixed::HalfPi ( ) [static]

Return the constant pi/2 as a TFixed value.

int32 CartoType::TFixed::IntegerPart ( ) const [inline]

Return the integer part, rounding down. The integer part of 3.6 is 3; the integer part of -0.2 is -1.

bool CartoType::TFixed::IsZero ( ) const [inline]

Return true if the number is zero.

bool CartoType::TFixed::NonZero ( ) const [inline]

Return true if the number is non-zero.

bool CartoType::TFixed::operator!= ( TFixed  aFixed) const [inline]

The inequality operator.

TFixed CartoType::TFixed::operator* ( TFixed  aFixed) const [inline]

Multiply by a fixed-point value.

TFixed CartoType::TFixed::operator* ( int32  aInt) const [inline]

Multiply by an integer.

void CartoType::TFixed::operator*= ( TFixed  aB) [inline]

An assignment operator to multiply two fixed-point values.

void CartoType::TFixed::operator*= ( int32  aInt) [inline]

An assignment operator to multiply by an integer value.

TFixed CartoType::TFixed::operator+ ( TFixed  aFixed) const [inline]

Add a fixed-point value.

void CartoType::TFixed::operator+= ( TFixed  aFixed) [inline]

Increment by a fixed-point value.

TFixed CartoType::TFixed::operator- ( TFixed  aFixed) const [inline]

Subtract a fixed-point value.

TFixed CartoType::TFixed::operator- ( ) const [inline]

The unary negation operator.

void CartoType::TFixed::operator-= ( TFixed  aFixed) [inline]

Decrement by a fixed-point value.

TFixed CartoType::TFixed::operator/ ( TFixed  aFixed) const [inline]

Divide by a fixed-point value.

TFixed CartoType::TFixed::operator/ ( int32  aInt) const [inline]

Divide by an integer.

void CartoType::TFixed::operator/= ( TFixed  aB) [inline]

An assignment operator to divide one fixed-point value by another.

Compute result directly if b has no fractional part.

void CartoType::TFixed::operator/= ( int32  aInt) [inline]

An assignment operator to divide by an integer.

bool CartoType::TFixed::operator< ( TFixed  aFixed) const [inline]

The less-than operator.

bool CartoType::TFixed::operator<= ( TFixed  aFixed) const [inline]

The less-than-or-equal operator.

bool CartoType::TFixed::operator== ( TFixed  aFixed) const [inline]

The equality operator.

bool CartoType::TFixed::operator> ( TFixed  aFixed) const [inline]

The greater-than operator.

bool CartoType::TFixed::operator>= ( TFixed  aFixed) const [inline]

The greater-than-or-equal operator.

CT_EXPORT TFixed TFixed::Pi ( ) [static]

Return the constant pi as a TFixed value.

int32 CartoType::TFixed::RawValue ( ) const [inline]

Return the value in 65536ths.

int32 CartoType::TFixed::Rounded ( ) const [inline]

Return the value rounded to the nearest unit.

int32 CartoType::TFixed::Rounded64ths ( ) const [inline]

Return the value rounded to the nearest 64th.

void CartoType::TFixed::SetRawValue ( int32  aRawValue) [inline]

Set the value in 65536ths.

CT_EXPORT TFixed TFixed::Sqrt ( ) const

Return the square root of a fixed-point value. Return 0 if the argument is less than or equal to zero.

CT_EXPORT TFixedSmall TFixed::ToRadians ( ) const

Interpret a value as degrees and convert it to radians.


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