Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
Loading...
Searching...
No Matches
c_m3d.h
Go to the documentation of this file.
1#ifndef C_M3D_H_
2#define C_M3D_H_
3
4#include "math.h"
5#include "dolphin/mtx.h"
6
7class cM3dGAab;
8class cM3dGCps;
9class cM3dGCyl;
10class cM3dGLin;
11class cM3dGPla;
12class cM3dGSph;
13class cM3dGTri;
14class csXyz;
15class cXyz;
16
17struct cM3d_Range {
18 /* 0x0 */ f32 mMin;
19 /* 0x4 */ f32 mMax;
20};
21
22#define G_CM3D_F_INF (1000000000.0f)
23extern const f32 G_CM3D_F_ABS_MIN;
24
25static void cM3d_InDivPos1(const Vec*, const Vec*, f32, Vec*);
26void cM3d_InDivPos2(const Vec*, const Vec*, f32, Vec*);
29bool cM3d_Len3dSqPntAndSegLine(const cM3dGLin*, const Vec*, Vec*, f32*);
32void cM3d_VectorProduct(const cXyz*, const cXyz*, const cXyz*, cXyz*);
33void cM3d_CalcPla(const Vec*, const Vec*, const Vec*, Vec*, f32*);
34bool cM3d_Cross_AabAab(const cM3dGAab*, const cM3dGAab*);
35bool cM3d_Cross_AabCyl(const cM3dGAab*, const cM3dGCyl*);
36bool cM3d_Cross_AabSph(const cM3dGAab*, const cM3dGSph*);
37static int cM3d_Check_LinLin(const cM3dGLin*, const cM3dGLin*, f32*, f32*);
38static bool cM3d_CrossInfLineVsInfPlane_proc(f32, f32, const Vec*, const Vec*, Vec*);
39bool cM3d_Cross_LinPla(const cM3dGLin*, const cM3dGPla*, Vec*, bool, bool);
40bool cM3d_Cross_MinMaxBoxLine(const Vec*, const Vec*, const Vec*, const Vec*);
41static bool cM3d_InclusionCheckPosIn3PosBox3d(const Vec*, const Vec*, const Vec*, const Vec*, f32);
43static bool cM3d_CrossX_Tri(const cM3dGTri*, const Vec*, f32);
44static bool cM3d_CrossX_Tri(const cM3dGTri*, const Vec*);
45static bool cM3d_CrossX_LinTri_proc(const cM3dGTri*, const Vec*);
46bool cM3d_CrossY_Tri(const cM3dGTri*, const Vec*);
47static bool cM3d_CrossY_LinTri_proc(const cM3dGTri*, const Vec*);
48bool cM3d_CrossY_Tri(const Vec&, const Vec&, const Vec&, const cM3dGPla&, const Vec*);
49bool cM3d_CrossY_Tri_Front(const Vec&, const Vec&, const Vec&, const Vec*);
50static bool cM3d_CrossY_Tri(const cM3dGTri*, const Vec*, f32*);
51static bool cM3d_CrossY_Tri(const cM3dGTri*, const Vec*, f32);
52static bool cM3d_CrossY_Tri(const cM3dGTri*, const Vec*, const cM3d_Range*, f32*);
53static bool cM3d_CrossZ_Tri(const cM3dGTri*, const Vec*, f32);
54static bool cM3d_CrossZ_Tri(const cM3dGTri*, const Vec*);
55static bool cM3d_CrossZ_LinTri_proc(const cM3dGTri*, const Vec*);
56bool cM3d_Cross_LinTri(const cM3dGLin*, const cM3dGTri*, Vec*, bool, bool);
57static bool cM3d_Cross_LinTri_Easy(const cM3dGTri*, const Vec*);
58static bool cM3d_Cross_SphPnt(const cM3dGSph*, const Vec*);
59bool cM3d_Cross_LinSph(const cM3dGLin*, const cM3dGSph*, Vec*);
60int cM3d_Cross_LinSph_CrossPos(const cM3dGSph&, const cM3dGLin&, Vec*, Vec*);
61bool cM3d_Cross_CylSph(const cM3dGCyl*, const cM3dGSph*, f32*);
62bool cM3d_Cross_CylSph(const cM3dGCyl*, const cM3dGSph*, Vec*, f32*);
63bool cM3d_Cross_SphSph(const cM3dGSph*, const cM3dGSph*, f32*);
64static bool cM3d_Cross_SphSph(const cM3dGSph*, const cM3dGSph*, f32*, f32*);
65bool cM3d_Cross_SphSph(const cM3dGSph*, const cM3dGSph*, Vec*);
66static void cM3d_CalcSphVsTriCrossPoint(const cM3dGSph*, const cM3dGTri*, Vec*);
67bool cM3d_Cross_SphTri(const cM3dGSph*, const cM3dGTri*, Vec*);
68inline bool cM3d_Cross_SphTri(const cM3dGSph* param_0, const cM3dGTri* param_1) {
69 return cM3d_Cross_SphTri(param_0, param_1, NULL);
70}
71bool cM3d_Cross_CylCyl(const cM3dGCyl*, const cM3dGCyl*, f32*);
72bool cM3d_Cross_CylCyl(const cM3dGCyl*, const cM3dGCyl*, Vec*);
73bool cM3d_Cross_CylTri(const cM3dGCyl*, const cM3dGTri*, Vec*);
74int cM3d_Cross_CylLin(const cM3dGCyl*, const cM3dGLin*, Vec*, Vec*);
75static int cM3d_Cross_CylPntPnt(const cM3dGCyl*, const Vec*, const Vec*, Vec*, Vec*);
76static bool cM3d_Cross_CylPnt(const cM3dGCyl*, const Vec*);
77bool cM3d_Cross_CpsCps(const cM3dGCps&, const cM3dGCps&, Vec*);
78bool cM3d_Cross_CpsCyl(const cM3dGCps&, const cM3dGCyl&, Vec*);
79static void cM3d_Cross_CpsSph_CrossPos(const cM3dGCps&, const cM3dGSph&, const Vec&, Vec*);
80bool cM3d_Cross_CpsSph(const cM3dGCps&, const cM3dGSph&, Vec*);
81bool cM3d_Cross_TriTri(const cM3dGTri&, const cM3dGTri&, Vec*);
83void cM3d_CalcVecAngle(const Vec&, short*, short*);
84void cM3d_CalcVecZAngle(const Vec&, csXyz*);
85static void cM3d_PlaneCrossLineProcWork(f32, f32, f32, f32, f32, f32, f32, f32*, f32*);
86static int cM3d_2PlaneCrossLine(const cM3dGPla&, const cM3dGPla&, cM3dGLin*);
87BOOL cM3d_3PlaneCrossPos(const cM3dGPla&, const cM3dGPla&, const cM3dGPla&, Vec*);
89f32 cM3d_lineVsPosSuisenCross(const Vec&, const Vec&, const Vec&, Vec*);
90int cM3d_2PlaneLinePosNearPos(const cM3dGPla&, const cM3dGPla&, const Vec*, Vec*);
91void cM3d_CrawVec(const Vec&, const Vec&, Vec*);
92
93inline bool cM3d_IsZero(f32 f) {
94 return fabsf(f) < G_CM3D_F_ABS_MIN;
95}
96
97inline f32 cM3d_LenSq(const Vec* a, const Vec* b) {
98 return VECSquareDistance(a, b);
99}
100
101inline bool cM3d_Cross_LinSph(const cM3dGLin* lin_p, const cM3dGSph* sph_p) {
102 Vec sp10;
103 return cM3d_Cross_LinSph(lin_p, sph_p, &sp10);
104}
105
106inline bool cM3d_Cross_CylSph(const cM3dGCyl* cyl, const cM3dGSph* sph, Vec* out) {
107 f32 sp10;
108 return cM3d_Cross_CylSph(cyl, sph, out, &sp10);
109}
110
111#endif
bool cM3d_Cross_TriTri(const cM3dGTri &, const cM3dGTri &, Vec *)
Definition c_m3d.cpp:1858
static bool cM3d_CrossX_Tri(const cM3dGTri *, const Vec *, f32)
bool cM3d_Cross_LinTri(const cM3dGLin *, const cM3dGTri *, Vec *, bool, bool)
Definition c_m3d.cpp:995
static bool cM3d_Cross_SphPnt(const cM3dGSph *, const Vec *)
bool cM3d_CrossY_Tri_Front(const Vec &, const Vec &, const Vec &, const Vec *)
Definition c_m3d.cpp:837
bool cM3d_Cross_LinSph(const cM3dGLin *, const cM3dGSph *, Vec *)
Definition c_m3d.cpp:1026
bool cM3d_Cross_CpsCps(const cM3dGCps &, const cM3dGCps &, Vec *)
Definition c_m3d.cpp:1631
const f32 G_CM3D_F_ABS_MIN
Definition c_m3d.cpp:15
bool cM3d_Cross_CpsCyl(const cM3dGCps &, const cM3dGCyl &, Vec *)
Definition c_m3d.cpp:1702
void cM3d_CrawVec(const Vec &, const Vec &, Vec *)
Definition c_m3d.cpp:2090
static bool cM3d_Cross_LinTri_Easy(const cM3dGTri *, const Vec *)
static void cM3d_CalcSphVsTriCrossPoint(const cM3dGSph *, const cM3dGTri *, Vec *)
Definition c_m3d.cpp:1238
static bool cM3d_CrossInfLineVsInfPlane_proc(f32, f32, const Vec *, const Vec *, Vec *)
f32 cM3d_VectorProduct2d(f32, f32, f32, f32, f32, f32)
Definition c_m3d.cpp:95
static void cM3d_PlaneCrossLineProcWork(f32, f32, f32, f32, f32, f32, f32, f32 *, f32 *)
Definition c_m3d.cpp:1982
bool cM3d_Len3dSqPntAndSegLine(const cM3dGLin *, const Vec *, Vec *, f32 *)
Definition c_m3d.cpp:61
static bool cM3d_CrossX_LinTri_proc(const cM3dGTri *, const Vec *)
bool cM3d_Cross_AabCyl(const cM3dGAab *, const cM3dGCyl *)
Definition c_m3d.cpp:153
static int cM3d_Cross_CylPntPnt(const cM3dGCyl *, const Vec *, const Vec *, Vec *, Vec *)
static int cM3d_Check_LinLin(const cM3dGLin *, const cM3dGLin *, f32 *, f32 *)
Definition c_m3d.cpp:196
bool cM3d_IsZero(f32 f)
Definition c_m3d.h:93
bool cM3d_Cross_AabSph(const cM3dGAab *, const cM3dGSph *)
Definition c_m3d.cpp:171
bool cM3d_Cross_SphTri(const cM3dGSph *, const cM3dGTri *, Vec *)
Definition c_m3d.cpp:1251
static bool cM3d_InclusionCheckPosIn3PosBox2d(f32, f32, f32, f32, f32, f32, f32, f32, f32)
static void cM3d_InDivPos1(const Vec *, const Vec *, f32, Vec *)
Definition c_m3d.cpp:17
void cM3d_CalcPla(const Vec *, const Vec *, const Vec *, Vec *, f32 *)
Definition c_m3d.cpp:107
bool cM3d_Cross_CpsTri(const cM3dGCps &, cM3dGTri, Vec *)
Definition c_m3d.cpp:1918
int cM3d_Cross_LinSph_CrossPos(const cM3dGSph &, const cM3dGLin &, Vec *, Vec *)
Definition c_m3d.cpp:1094
bool cM3d_Cross_CylSph(const cM3dGCyl *, const cM3dGSph *, f32 *)
Definition c_m3d.cpp:1138
static bool cM3d_InclusionCheckPosIn3PosBox3d(const Vec *, const Vec *, const Vec *, const Vec *, f32)
Definition c_m3d.cpp:571
f32 cM3d_LenSq(const Vec *a, const Vec *b)
Definition c_m3d.h:97
bool cM3d_Cross_CylCyl(const cM3dGCyl *, const cM3dGCyl *, f32 *)
Definition c_m3d.cpp:1315
bool cM3d_Len2dSqPntAndSegLine(f32, f32, f32, f32, f32, f32, f32 *, f32 *, f32 *)
Definition c_m3d.cpp:39
static int cM3d_2PlaneCrossLine(const cM3dGPla &, const cM3dGPla &, cM3dGLin *)
int cM3d_Cross_CylLin(const cM3dGCyl *, const cM3dGLin *, Vec *, Vec *)
Definition c_m3d.cpp:1437
f32 cM3d_Len2dSq(f32, f32, f32, f32)
Definition c_m3d.cpp:29
f32 cM3d_SignedLenPlaAndPos(const cM3dGPla *, const Vec *)
Definition c_m3d.cpp:86
bool cM3d_Cross_MinMaxBoxLine(const Vec *, const Vec *, const Vec *, const Vec *)
Definition c_m3d.cpp:404
static bool cM3d_Cross_CylPnt(const cM3dGCyl *, const Vec *)
Definition c_m3d.cpp:1618
void cM3d_CalcVecZAngle(const Vec &, csXyz *)
Definition c_m3d.cpp:1975
bool cM3d_Cross_SphSph(const cM3dGSph *, const cM3dGSph *, f32 *)
Definition c_m3d.cpp:1191
static void cM3d_Cross_CpsSph_CrossPos(const cM3dGCps &, const cM3dGSph &, const Vec &, Vec *)
int cM3d_2PlaneLinePosNearPos(const cM3dGPla &, const cM3dGPla &, const Vec *, Vec *)
Definition c_m3d.cpp:2079
void cM3d_VectorProduct(const cXyz *, const cXyz *, const cXyz *, cXyz *)
Definition c_m3d.cpp:99
bool cM3d_Cross_CpsSph(const cM3dGCps &, const cM3dGSph &, Vec *)
Definition c_m3d.cpp:1837
bool cM3d_Cross_CylTri(const cM3dGCyl *, const cM3dGTri *, Vec *)
Definition c_m3d.cpp:1375
void cM3d_CalcVecAngle(const Vec &, short *, short *)
bool cM3d_Cross_AabAab(const cM3dGAab *, const cM3dGAab *)
Definition c_m3d.cpp:139
static bool cM3d_CrossY_LinTri_proc(const cM3dGTri *, const Vec *)
static bool cM3d_CrossZ_Tri(const cM3dGTri *, const Vec *, f32)
void cM3d_InDivPos2(const Vec *, const Vec *, f32, Vec *)
Definition c_m3d.cpp:23
BOOL cM3d_3PlaneCrossPos(const cM3dGPla &, const cM3dGPla &, const cM3dGPla &, Vec *)
Definition c_m3d.cpp:2024
f32 cM3d_lineVsPosSuisenCross(const cM3dGLin *, const Vec *, Vec *)
Definition c_m3d.cpp:2041
bool cM3d_Cross_LinPla(const cM3dGLin *, const cM3dGPla *, Vec *, bool, bool)
Definition c_m3d.cpp:259
static bool cM3d_CrossZ_LinTri_proc(const cM3dGTri *, const Vec *)
bool cM3d_CrossY_Tri(const cM3dGTri *, const Vec *)
Definition c_m3d.cpp:753
Definition c_m3d_g_aab.h:9
Definition c_m3d_g_cps.h:13
Definition c_m3d_g_cyl.h:16
Definition c_m3d_g_lin.h:8
Definition c_m3d_g_pla.h:8
Definition c_m3d_g_sph.h:15
Definition c_m3d_g_tri.h:14
Definition c_sxyz.h:10
int BOOL
Definition types.h:33
float f32
Definition types.h:25
a
Definition k_cos.c:89
float fabsf(float f)
Definition math.h:52
Definition mtx.h:13
Definition c_m3d.h:17
f32 mMax
Definition c_m3d.h:19
f32 mMin
Definition c_m3d.h:18
Definition c_xyz.h:7