Files
tp/include/SComponent/c_angle.h
T
lepelog 0cf65151b3 Split SComponent (#45)
* split c_math

* split c_angle

* split c_API_controller_pad

* split c_API_graphic

* split c_bg_s_chk

* c_bg_s_gnd_chk split

* more c_bg split

* split c_cc_d

* delete asm

* split c_cc_s

* split c_lib

* split c_m2d and c_m3d_g_aab

* split c_m3d_g_cir

* split c_m3d_g_cps

* split rest of c_m3d_g

* split c_m3d

* split c_malloc

* split c_request

* split c_sxyz

* split and partly decompile c_xyz

* format

* c_angle.h

* begin c_angle decomp

* c_angle

* progress adding stub classes for SComponent

* more c_m3d

* remove some asm and format

* more m3d headers

* more c_angle decomp

* c_lib headers

* add public to classes

* fix csXyz member names

* c_sxyz partly OK

* move Zero csXyz to c_sxyz header

* c_API_graphic

* delete some unused asm

* move math extern data, decompile some functions

* delete unused asm

* fix duplicated c_angle.h

* fix an inlined function name, add more inlined functions for c_angle.h (currently unused)

* format

Co-authored-by: Pheenoh <pheenoh@gmail.com>
2021-01-06 20:04:53 -05:00

104 lines
2.7 KiB
C++

#ifndef __C_ANGLE_H_
#define __C_ANGLE_H_
#include "SComponent/c_xyz.h"
#include "global.h"
class cSAngle {
private:
s16 mAngle;
public:
cSAngle() {}
cSAngle(const cSAngle&);
cSAngle(s16);
cSAngle(float);
s16 Val() const { return this->mAngle; }
// void Set(s16 angle) { this->mAngle = angle; }
void Val(const cSAngle&);
void Val(s16);
void Val(float);
float Degree(void) const;
float Radian(void) const;
float Norm(void) const;
s16 Abs(void) const;
s16 Inv(void) const;
float Sin(void) const;
float Cos(void) const;
cSAngle operator-(void) const;
cSAngle operator+(const cSAngle&) const;
cSAngle operator-(const cSAngle&) const;
void operator+=(const cSAngle&);
void operator-=(const cSAngle&);
cSAngle operator+(short) const;
cSAngle operator-(short) const;
void operator+=(short);
cSAngle operator*(float) const;
void operator*=(float);
bool operator<(const cSAngle& other) const { return mAngle < other.mAngle; }
bool operator>(const cSAngle& other) const { return mAngle > other.mAngle; }
operator s16(void) const { return mAngle; }
void operator=(const cSAngle& other) { mAngle = other.mAngle; }
static cSAngle getMaxNegative(void) { return cSAngle((s16)-0x8000); }
void mirrorAtMaxNeg(void) { *this = getMaxNegative() - *this; }
};
cSAngle operator+(short, const cSAngle&);
cSAngle operator-(short, const cSAngle&);
class cDegree {
private:
float mDegree;
public:
cDegree(float);
cDegree& Formal(void);
void Val(float);
float Radian(void) const;
float Sin(void) const;
float Cos(void) const;
float Tan(void) const;
};
class cSPolar {
private:
float mRadial;
cSAngle mAngle1;
cSAngle mAngle2;
public:
cSPolar() {}
cSPolar(const cXyz&);
cSPolar& Formal(void);
void Val(float, short, short);
void Val(const cXyz&);
cXyz Xyz(void) const;
void Globe(class cSGlobe*) const;
};
class cSGlobe {
private:
float mRadius;
cSAngle mAzimuth; // original: V
cSAngle mInclination; // original: U
public:
cSGlobe(const cSGlobe&);
cSGlobe(float, short, short);
cSGlobe(float, const cSAngle&, const cSAngle&);
cSGlobe(const cXyz&);
cSGlobe& Formal(void);
void Val(const cSGlobe&);
void Val(float, short, short);
void Val(float, const cSAngle&, const cSAngle&);
void Val(const cXyz&);
float R(void) const { return mRadius; }
const cSAngle& V(void) const { return mAzimuth; }
const cSAngle& U(void) const { return mInclination; }
cXyz Xyz(void) const;
void Polar(cSPolar*) const;
cXyz Norm(void) const;
cSGlobe& Invert(void);
};
#endif