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
22extern const f32 G_CM3D_F_ABS_MIN;
23
24static void cM3d_InDivPos1(const Vec*, const Vec*, f32, Vec*);
25void cM3d_InDivPos2(const Vec*, const Vec*, f32, Vec*);
28bool cM3d_Len3dSqPntAndSegLine(const cM3dGLin*, const Vec*, Vec*, f32*);
31void cM3d_VectorProduct(const cXyz*, const cXyz*, const cXyz*, cXyz*);
32void cM3d_CalcPla(const Vec*, const Vec*, const Vec*, Vec*, f32*);
33bool cM3d_Cross_AabAab(const cM3dGAab*, const cM3dGAab*);
34bool cM3d_Cross_AabCyl(const cM3dGAab*, const cM3dGCyl*);
35bool cM3d_Cross_AabSph(const cM3dGAab*, const cM3dGSph*);
36static int cM3d_Check_LinLin(const cM3dGLin*, const cM3dGLin*, f32*, f32*);
37static bool cM3d_CrossInfLineVsInfPlane_proc(f32, f32, const Vec*, const Vec*, Vec*);
38bool cM3d_Cross_LinPla(const cM3dGLin*, const cM3dGPla*, Vec*, bool, bool);
39bool cM3d_Cross_MinMaxBoxLine(const Vec*, const Vec*, const Vec*, const Vec*);
40static bool cM3d_InclusionCheckPosIn3PosBox3d(const Vec*, const Vec*, const Vec*, const Vec*, f32);
42static bool cM3d_CrossX_Tri(const cM3dGTri*, const Vec*, f32);
43static bool cM3d_CrossX_Tri(const cM3dGTri*, const Vec*);
44static bool cM3d_CrossX_LinTri_proc(const cM3dGTri*, const Vec*);
45bool cM3d_CrossY_Tri(const cM3dGTri*, const Vec*);
46static bool cM3d_CrossY_LinTri_proc(const cM3dGTri*, const Vec*);
47bool cM3d_CrossY_Tri(const Vec&, const Vec&, const Vec&, const cM3dGPla&, const Vec*);
48bool cM3d_CrossY_Tri_Front(const Vec&, const Vec&, const Vec&, const Vec*);
49static bool cM3d_CrossY_Tri(const cM3dGTri*, const Vec*, f32*);
50static bool cM3d_CrossY_Tri(const cM3dGTri*, const Vec*, f32);
51static bool cM3d_CrossY_Tri(const cM3dGTri*, const Vec*, const cM3d_Range*, f32*);
52static bool cM3d_CrossZ_Tri(const cM3dGTri*, const Vec*, f32);
53static bool cM3d_CrossZ_Tri(const cM3dGTri*, const Vec*);
54static bool cM3d_CrossZ_LinTri_proc(const cM3dGTri*, const Vec*);
55bool cM3d_Cross_LinTri(const cM3dGLin*, const cM3dGTri*, Vec*, bool, bool);
56static bool cM3d_Cross_LinTri_Easy(const cM3dGTri*, const Vec*);
57static bool cM3d_Cross_SphPnt(const cM3dGSph*, const Vec*);
58bool cM3d_Cross_LinSph(const cM3dGLin*, const cM3dGSph*, Vec*);
59int cM3d_Cross_LinSph_CrossPos(const cM3dGSph&, const cM3dGLin&, Vec*, Vec*);
60bool cM3d_Cross_CylSph(const cM3dGCyl*, const cM3dGSph*, f32*);
61bool cM3d_Cross_CylSph(const cM3dGCyl*, const cM3dGSph*, Vec*, f32*);
62bool cM3d_Cross_SphSph(const cM3dGSph*, const cM3dGSph*, f32*);
63static bool cM3d_Cross_SphSph(const cM3dGSph*, const cM3dGSph*, f32*, f32*);
64bool cM3d_Cross_SphSph(const cM3dGSph*, const cM3dGSph*, Vec*);
65static void cM3d_CalcSphVsTriCrossPoint(const cM3dGSph*, const cM3dGTri*, Vec*);
66bool cM3d_Cross_SphTri(const cM3dGSph*, const cM3dGTri*, Vec*);
67inline bool cM3d_Cross_SphTri(const cM3dGSph* param_0, const cM3dGTri* param_1) {
68 return cM3d_Cross_SphTri(param_0, param_1, NULL);
69}
70bool cM3d_Cross_CylCyl(const cM3dGCyl*, const cM3dGCyl*, f32*);
71bool cM3d_Cross_CylCyl(const cM3dGCyl*, const cM3dGCyl*, Vec*);
72bool cM3d_Cross_CylTri(const cM3dGCyl*, const cM3dGTri*, Vec*);
73int cM3d_Cross_CylLin(const cM3dGCyl*, const cM3dGLin*, Vec*, Vec*);
74static int cM3d_Cross_CylPntPnt(const cM3dGCyl*, const Vec*, const Vec*, Vec*, Vec*);
75static bool cM3d_Cross_CylPnt(const cM3dGCyl*, const Vec*);
76bool cM3d_Cross_CpsCps(const cM3dGCps&, const cM3dGCps&, Vec*);
77bool cM3d_Cross_CpsCyl(const cM3dGCps&, const cM3dGCyl&, Vec*);
78static void cM3d_Cross_CpsSph_CrossPos(const cM3dGCps&, const cM3dGSph&, const Vec&, Vec*);
79bool cM3d_Cross_CpsSph(const cM3dGCps&, const cM3dGSph&, Vec*);
80bool cM3d_Cross_TriTri(const cM3dGTri&, const cM3dGTri&, Vec*);
82void cM3d_CalcVecAngle(const Vec&, short*, short*);
83void cM3d_CalcVecZAngle(const Vec&, csXyz*);
84static void cM3d_PlaneCrossLineProcWork(f32, f32, f32, f32, f32, f32, f32, f32*, f32*);
85static int cM3d_2PlaneCrossLine(const cM3dGPla&, const cM3dGPla&, cM3dGLin*);
86BOOL cM3d_3PlaneCrossPos(const cM3dGPla&, const cM3dGPla&, const cM3dGPla&, Vec*);
88f32 cM3d_lineVsPosSuisenCross(const Vec&, const Vec&, const Vec&, Vec*);
89int cM3d_2PlaneLinePosNearPos(const cM3dGPla&, const cM3dGPla&, const Vec*, Vec*);
90void cM3d_CrawVec(const Vec&, const Vec&, Vec*);
91
92inline bool cM3d_IsZero(f32 f) {
93 return fabsf(f) < G_CM3D_F_ABS_MIN;
94}
95// this is the inline cM3d_IsZero but inverted. Sometimes this will get a match where the regular cM3d_IsZero inline won't
96inline bool cM3d_IsZero_inverted(f32 param_0) {
97 return !(fabsf(param_0) < G_CM3D_F_ABS_MIN);
98}
99
100inline f32 cM3d_LenSq(const Vec* a, const Vec* b) {
101 return VECSquareDistance(a, b);
102}
103
104#endif
bool cM3d_Cross_TriTri(const cM3dGTri &, const cM3dGTri &, Vec *)
Definition c_m3d.cpp:1977
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:1075
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:906
bool cM3d_Cross_LinSph(const cM3dGLin *, const cM3dGSph *, Vec *)
Definition c_m3d.cpp:1111
bool cM3d_Cross_CpsCps(const cM3dGCps &, const cM3dGCps &, Vec *)
Definition c_m3d.cpp:1742
const f32 G_CM3D_F_ABS_MIN
Definition c_m3d.cpp:16
bool cM3d_Cross_CpsCyl(const cM3dGCps &, const cM3dGCyl &, Vec *)
Definition c_m3d.cpp:1815
void cM3d_CrawVec(const Vec &, const Vec &, Vec *)
Definition c_m3d.cpp:2226
static bool cM3d_Cross_LinTri_Easy(const cM3dGTri *, const Vec *)
static void cM3d_CalcSphVsTriCrossPoint(const cM3dGSph *, const cM3dGTri *, Vec *)
Definition c_m3d.cpp:1337
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:107
bool cM3d_IsZero_inverted(f32 param_0)
Definition c_m3d.h:96
static void cM3d_PlaneCrossLineProcWork(f32, f32, f32, f32, f32, f32, f32, f32 *, f32 *)
Definition c_m3d.cpp:2107
bool cM3d_Len3dSqPntAndSegLine(const cM3dGLin *, const Vec *, Vec *, f32 *)
Definition c_m3d.cpp:70
static bool cM3d_CrossX_LinTri_proc(const cM3dGTri *, const Vec *)
bool cM3d_Cross_AabCyl(const cM3dGAab *, const cM3dGCyl *)
Definition c_m3d.cpp:172
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:219
bool cM3d_IsZero(f32 f)
Definition c_m3d.h:92
bool cM3d_Cross_AabSph(const cM3dGAab *, const cM3dGSph *)
Definition c_m3d.cpp:192
bool cM3d_Cross_SphTri(const cM3dGSph *, const cM3dGTri *, Vec *)
Definition c_m3d.cpp:1357
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:20
void cM3d_CalcPla(const Vec *, const Vec *, const Vec *, Vec *, f32 *)
Definition c_m3d.cpp:122
bool cM3d_Cross_CpsTri(const cM3dGCps &, cM3dGTri, Vec *)
Definition c_m3d.cpp:2039
int cM3d_Cross_LinSph_CrossPos(const cM3dGSph &, const cM3dGLin &, Vec *, Vec *)
Definition c_m3d.cpp:1181
bool cM3d_Cross_CylSph(const cM3dGCyl *, const cM3dGSph *, f32 *)
Definition c_m3d.cpp:1227
static bool cM3d_InclusionCheckPosIn3PosBox3d(const Vec *, const Vec *, const Vec *, const Vec *, f32)
Definition c_m3d.cpp:628
f32 cM3d_LenSq(const Vec *a, const Vec *b)
Definition c_m3d.h:100
bool cM3d_Cross_CylCyl(const cM3dGCyl *, const cM3dGCyl *, f32 *)
Definition c_m3d.cpp:1423
bool cM3d_Len2dSqPntAndSegLine(f32, f32, f32, f32, f32, f32, f32 *, f32 *, f32 *)
Definition c_m3d.cpp:47
static int cM3d_2PlaneCrossLine(const cM3dGPla &, const cM3dGPla &, cM3dGLin *)
int cM3d_Cross_CylLin(const cM3dGCyl *, const cM3dGLin *, Vec *, Vec *)
Definition c_m3d.cpp:1552
f32 cM3d_Len2dSq(f32, f32, f32, f32)
Definition c_m3d.cpp:35
f32 cM3d_SignedLenPlaAndPos(const cM3dGPla *, const Vec *)
Definition c_m3d.cpp:97
bool cM3d_Cross_MinMaxBoxLine(const Vec *, const Vec *, const Vec *, const Vec *)
Definition c_m3d.cpp:459
static bool cM3d_Cross_CylPnt(const cM3dGCyl *, const Vec *)
Definition c_m3d.cpp:1727
void cM3d_CalcVecZAngle(const Vec &, csXyz *)
Definition c_m3d.cpp:2099
bool cM3d_Cross_SphSph(const cM3dGSph *, const cM3dGSph *, f32 *)
Definition c_m3d.cpp:1284
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:2214
void cM3d_VectorProduct(const cXyz *, const cXyz *, const cXyz *, cXyz *)
Definition c_m3d.cpp:113
bool cM3d_Cross_CpsSph(const cM3dGCps &, const cM3dGSph &, Vec *)
Definition c_m3d.cpp:1954
bool cM3d_Cross_CylTri(const cM3dGCyl *, const cM3dGTri *, Vec *)
Definition c_m3d.cpp:1487
void cM3d_CalcVecAngle(const Vec &, short *, short *)
bool cM3d_Cross_AabAab(const cM3dGAab *, const cM3dGAab *)
Definition c_m3d.cpp:156
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:28
BOOL cM3d_3PlaneCrossPos(const cM3dGPla &, const cM3dGPla &, const cM3dGPla &, Vec *)
Definition c_m3d.cpp:2153
f32 cM3d_lineVsPosSuisenCross(const cM3dGLin *, const Vec *, Vec *)
Definition c_m3d.cpp:2172
bool cM3d_Cross_LinPla(const cM3dGLin *, const cM3dGPla *, Vec *, bool, bool)
Definition c_m3d.cpp:286
static bool cM3d_CrossZ_LinTri_proc(const cM3dGTri *, const Vec *)
bool cM3d_CrossY_Tri(const cM3dGTri *, const Vec *)
Definition c_m3d.cpp:816
Definition c_m3d_g_cps.h:13
Definition c_m3d_g_tri.h:14
a
Definition k_cos.c:89
float fabsf(float f)
Definition math.h:42
Definition d_a_hozelda.cpp:18
Definition d_a_npc_fguard.cpp:137
Definition d_a_npc_fguard.cpp:126
Definition d_a_tag_allmato.cpp:99
Definition d_a_npc_fguard.cpp:122
Definition d_a_tag_allmato.cpp:94
Definition c_m3d.h:17
f32 mMax
Definition c_m3d.h:19
f32 mMin
Definition c_m3d.h:18
Definition d_a_hozelda.cpp:20
Definition d_a_ep.cpp:66
int BOOL
Definition types.h:30
float f32
Definition types.h:22