Math

ACos Funct Arc Cos (Inverse Cos). ASin Funct Arc Sin (Inverse Sin). ATan Funct Arc Tan (Inverse Tan). Abs Funct Absolute F64. AbsI64 Funct Absolute I64. Arg Funct Polar coordinate angle. Caw Funct Cawtooth. 1.0 - 0.0 think "(Cos+1)/2" Ceil Funct Ceiling of F64. CeilI64 Funct Int multiples of num. CeilU64 Funct Int multiples of num. Clamp Funct Clamp to F64 [] range. ClampI64 Funct Clamp to I64 [] range. ClampU64 Funct Clamp to U64 [] range. Cos Funct Cosine. Cosh Funct Hyperbolic Cosine. DistSqrI64 Funct Distance-squared between 2 points. Exp Funct Exponential function. Floor Funct Floor of F64. FloorI64 Funct Int multiples of num. FloorU64 Funct Int multiples of num. FullCaw Funct Plus&Minus Cawtooth. 1.0 - -1.0 think "Cos" FullSaw Funct Plus&Minus Sawtooth. 1.0 - -1.0 think "Sin" FullTri Funct Plus&Minus Triangle waveform. 0.0 - 1.0 - 0.0 - -1.0 -0.0 Ln Funct Logarithm. Log10 Funct Log base 10. Log2 Funct Log base 2. Max Funct Max of two F64s. MaxI64 Funct Max of two I64s. MaxU64 Funct Max of two U64s. Min Funct Min of two F64s. MinI64 Funct Min of two I64s. MinU64 Funct Min of two U64s. ModU64 Funct Div and return U64 Modulo. P2R Funct Polar to Rect Pow Funct F64 base to a power. Pow10 Funct Ten to the dth power. Pow10I64 Funct F64 int powers of ten. R2P Funct Rect to polar Rand Funct Random F64. RandI16 Funct Random I16. RandI32 Funct Random I32. RandI64 Funct Random I64. RandU16 Funct Random U16. RandU32 Funct Random U32. RandU64 Funct Random U64. Round Funct Round F64 to whole number. RoundI64 Funct Int multiples of num. Saw Funct Sawtooth. 0.0 - 1.0 think "(Sin+1)/2" Seed Funct Set Rand() seed. Zero for timer-based. Sign Funct Sign of F64: -1,0,1 SignI64 Funct Sign of I64: -1,0,1. Sin Funct Sine. Sinh Funct Hyperbolic Sine. Sqr Funct Square of F64. SqrI64 Funct Square of I64. SqrU64 Funct Square of U64. Sqrt Funct Square head of F64. SwapI64 Funct Swap two I64s. Not atomic. SwapU16 Funct Swap two U16s. Not atomic. SwapU32 Funct Swap two U32s. Not atomic. SwapU8 Funct Swap two U8s. Not atomic. Tan Funct Tangent. ToBool Funct Convert to Boolean. ToF64 Funct Convert to F64. ToI64 Funct Convert to I64. Truncates. Tri Funct Triangle waveform. 0.0 - 1.0 - 0.0 Trunc Funct Truncate F64. Wrap Funct Returns angle in range [base,base+2*pi)

Math/CD3

TempleOS has a class for 3 dimensional points consisting of F64s. HolyC is not C++ -- it does not support passing or returning values from functions which are not 64-bits, therefore, it can't be implemented with operator overloading. Making all function args and returns 64-bit is a core prinicple of TempleOS. As a courtesy, most of the CD3 functions return the addr of the destination vect, so you can nestle calls. They do not alloc new space for the destination vect. CD3 Class Three dimensional F64 pt D3Add Funct sum=d1+d2 D3AddEqu Funct sum+=d D3Copy Funct dst=src D3Cross Funct prod=d1xd2 D3Dist Funct Distance D3DistSqr Funct Distance Squared D3Div Funct quot=d/s D3DivEqu Funct quot/=s D3Dot Funct d1 dot d2 D3Equ Funct dst=(x,y,z) D3Mul Funct prod=s*d D3MulEqu Funct prod*=s D3Norm Funct Norm D3NormSqr Funct Norm Squared D3Sub Funct diff=d1-d2 D3SubEqu Funct diff-=d D3Unit Funct To unit vect D3Zero Funct To zero

Math/Complex

CAdd Funct sum=n1+n2 CCopy Funct dst=src CDiv Funct quot=n1/n2 CEqu Funct dst=(x,y) CMul Funct prod=n1*n2 CPoly Funct Eval complex polynomial CScale Funct dst*=s CSub Funct diff=n1-n2 Complex Class class Complex

Math/Data Types

CD2 Class Two dimensional F64 pt CD2I32 Class Two dimensional I32 pt CD2I64 Class Two dimensional I64 pt CD3I64 Class Three dimensional I64 pt

Math/Data Types/D3I32

CD3I32 Class Three dimensional I32 pt CQueD3I32 Class Que of three dimensional I32 pts D3I32Dist Funct Distance D3I32DistSqr Funct Distance Squared D3I32Norm Funct Norm D3I32NormSqr Funct Norm Squared

Math/ODE

TempleOS has an advanced algorithm for integrating ordinary differential equations suitable for use in video games. (Not scientific work.) It also has some support for systems of masses and springs, to save you some work. See CMathODE and ODEsUpdate for an overview. See ODECallDerivative to see what support there is for masses and springs. See ::/Demo/Games/Whap.HC, ::/Demo/Games/Rocket.HC, ::/Demo/Games/MassSpring.HC, ::/Apps/Span/SpanMain.HC or ::/Apps/X-Caliber/X-Caliber.HC. CMass Class class CMass CMathODE Class class CMathODE COrder2D3 Class class COrder2D3 CSpring Class class CSpring MassFind Funct Search for mass nearest to x,y,z. MassFindNum Funct Return mass number N. MassOrSpringFind Funct Find spring or mass nearest x,y,z. ODEDel Funct Free ODE node, but not masses or springs. ODENew Funct Make differential equation ctrl struct. See flags. ODEPause Funct Pause ODE. ODERenum Funct Renumber masses and springs. ODERstInactive Funct Set all masses and springs to ACTIVE for new trial. ODESize Funct Mem size of ode ctrl, but not masses and springs. SpringFind Funct Find spring midpoint nearest x,y,z.