ScummVM API documentation
Common::SineTable Class Reference

Public Member Functions

 SineTable (int nPoints)
 
const float * getTable ()
 
float at (int index) const
 
float atLegacy (int index) const
 

Constructor & Destructor Documentation

◆ SineTable()

Common::SineTable::SineTable ( int  nPoints)

Construct a sine table given the number of points

Parameters
nPointsNumber of distinct radian points, which must be in range [16,65536] and be divisible by 4

Member Function Documentation

◆ getTable()

const float* Common::SineTable::getTable ( )
inline

Get pointer to table

This table contains nPoints/2 entries. Prefer to use at() The layout of this table is as follows:

  • Entries 0 up to (excluding) nPoints/4: sin(0) till (excluding) sin(1/2*pi)
  • Entries 2_nPoints/4 up to nPoints/2: sin(pi) till (excluding) sin(3/2*pi)

◆ at()

float Common::SineTable::at ( int  index) const

Returns sin(2*pi * index / nPoints ) Index must be in range [0, nPoints - 1] Faster than atLegacy

◆ atLegacy()

float Common::SineTable::atLegacy ( int  index) const

Returns sin(2*pi * index / nPoints ) Index must be in range [0, nPoints - 1]


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