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/vec.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
22struct Vec;
23
24extern const f32 G_CM3D_F_ABS_MIN;
25
26static void cM3d_InDivPos1(const Vec*, const Vec*, f32, Vec*);
27void cM3d_InDivPos2(const Vec*, const Vec*, f32, Vec*);
30bool cM3d_Len3dSqPntAndSegLine(const cM3dGLin*, const Vec*, Vec*, f32*);
33void cM3d_VectorProduct(const cXyz*, const cXyz*, const cXyz*, cXyz*);
34void cM3d_CalcPla(const Vec*, const Vec*, const Vec*, Vec*, f32*);
35bool cM3d_Cross_AabAab(const cM3dGAab*, const cM3dGAab*);
36bool cM3d_Cross_AabCyl(const cM3dGAab*, const cM3dGCyl*);
37bool cM3d_Cross_AabSph(const cM3dGAab*, const cM3dGSph*);
38static int cM3d_Check_LinLin(const cM3dGLin*, const cM3dGLin*, f32*, f32*);
39static bool cM3d_CrossInfLineVsInfPlane_proc(f32, f32, const Vec*, const Vec*, Vec*);
40bool cM3d_Cross_LinPla(const cM3dGLin*, const cM3dGPla*, Vec*, bool, bool);
41bool cM3d_Cross_MinMaxBoxLine(const Vec*, const Vec*, const Vec*, const Vec*);
42static bool cM3d_InclusionCheckPosIn3PosBox3d(const Vec*, const Vec*, const Vec*, const Vec*, f32);
44static bool cM3d_CrossX_Tri(const cM3dGTri*, const Vec*, f32);
45static bool cM3d_CrossX_Tri(const cM3dGTri*, const Vec*);
46static bool cM3d_CrossX_LinTri_proc(const cM3dGTri*, const Vec*);
47bool cM3d_CrossY_Tri(const cM3dGTri*, const Vec*);
48static bool cM3d_CrossY_LinTri_proc(const cM3dGTri*, const Vec*);
49bool cM3d_CrossY_Tri(const Vec&, const Vec&, const Vec&, const cM3dGPla&, const Vec*);
50bool cM3d_CrossY_Tri_Front(const Vec&, const Vec&, const Vec&, const Vec*);
51static bool cM3d_CrossY_Tri(const cM3dGTri*, const Vec*, f32*);
52static bool cM3d_CrossY_Tri(const cM3dGTri*, const Vec*, f32);
53static bool cM3d_CrossY_Tri(const cM3dGTri*, const Vec*, const cM3d_Range*, f32*);
54static bool cM3d_CrossZ_Tri(const cM3dGTri*, const Vec*, f32);
55static bool cM3d_CrossZ_Tri(const cM3dGTri*, const Vec*);
56static bool cM3d_CrossZ_LinTri_proc(const cM3dGTri*, const Vec*);
57bool cM3d_Cross_LinTri(const cM3dGLin*, const cM3dGTri*, Vec*, bool, bool);
58static bool cM3d_Cross_LinTri_Easy(const cM3dGTri*, const Vec*);
59static bool cM3d_Cross_SphPnt(const cM3dGSph*, const Vec*);
60bool cM3d_Cross_LinSph(const cM3dGLin*, const cM3dGSph*, Vec*);
61int cM3d_Cross_LinSph_CrossPos(const cM3dGSph&, const cM3dGLin&, Vec*, Vec*);
62bool cM3d_Cross_CylSph(const cM3dGCyl*, const cM3dGSph*, f32*);
63bool cM3d_Cross_CylSph(const cM3dGCyl*, const cM3dGSph*, Vec*, f32*);
64bool cM3d_Cross_SphSph(const cM3dGSph*, const cM3dGSph*, f32*);
65static bool cM3d_Cross_SphSph(const cM3dGSph*, const cM3dGSph*, f32*, f32*);
66bool cM3d_Cross_SphSph(const cM3dGSph*, const cM3dGSph*, Vec*);
67static void cM3d_CalcSphVsTriCrossPoint(const cM3dGSph*, const cM3dGTri*, Vec*);
68bool cM3d_Cross_SphTri(const cM3dGSph*, const cM3dGTri*, Vec*);
69inline bool cM3d_Cross_SphTri(const cM3dGSph* param_0, const cM3dGTri* param_1) {
71}
72bool cM3d_Cross_CylCyl(const cM3dGCyl*, const cM3dGCyl*, f32*);
73bool cM3d_Cross_CylCyl(const cM3dGCyl*, const cM3dGCyl*, Vec*);
74bool cM3d_Cross_CylTri(const cM3dGCyl*, const cM3dGTri*, Vec*);
75int cM3d_Cross_CylLin(const cM3dGCyl*, const cM3dGLin*, Vec*, Vec*);
76static int cM3d_Cross_CylPntPnt(const cM3dGCyl*, const Vec*, const Vec*, Vec*, Vec*);
77static bool cM3d_Cross_CylPnt(const cM3dGCyl*, const Vec*);
78bool cM3d_Cross_CpsCps(const cM3dGCps&, const cM3dGCps&, Vec*);
79bool cM3d_Cross_CpsCyl(const cM3dGCps&, const cM3dGCyl&, Vec*);
80static void cM3d_Cross_CpsSph_CrossPos(const cM3dGCps&, const cM3dGSph&, const Vec&, Vec*);
81bool cM3d_Cross_CpsSph(const cM3dGCps&, const cM3dGSph&, Vec*);
82bool cM3d_Cross_TriTri(const cM3dGTri&, const cM3dGTri&, Vec*);
84void cM3d_CalcVecAngle(const Vec&, short*, short*);
85void cM3d_CalcVecZAngle(const Vec&, csXyz*);
86static void cM3d_PlaneCrossLineProcWork(f32, f32, f32, f32, f32, f32, f32, f32*, f32*);
87static int cM3d_2PlaneCrossLine(const cM3dGPla&, const cM3dGPla&, cM3dGLin*);
88BOOL cM3d_3PlaneCrossPos(const cM3dGPla&, const cM3dGPla&, const cM3dGPla&, Vec*);
90f32 cM3d_lineVsPosSuisenCross(const Vec&, const Vec&, const Vec&, Vec*);
91int cM3d_2PlaneLinePosNearPos(const cM3dGPla&, const cM3dGPla&, const Vec*, Vec*);
92void cM3d_CrawVec(const Vec&, const Vec&, Vec*);
93
94inline bool cM3d_IsZero(f32 f) {
95 return fabsf(f) < G_CM3D_F_ABS_MIN;
96}
97// this is the inline cM3d_IsZero but inverted. Sometimes this will get a match where the regular cM3d_IsZero inline won't
99 return !(fabsf(param_0) < G_CM3D_F_ABS_MIN);
100}
101
102inline f32 cM3d_LenSq(const Vec* a, const Vec* b) {
103 return VECSquareDistance(a, b);
104}
105
106#endif
T cLib_calcTimer(T *value)
Definition c_lib.h:74
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:98
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:94
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:102
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:38
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:27
float f32
Definition types.h:22