tp/libs/SSystem/SComponent/c_m3d_g_pla.cpp

71 lines
2.3 KiB
C++

//
// Generated By: dol2asm
// Translation Unit: c_m3d_g_pla
//
#include "SSystem/SComponent/c_m3d_g_pla.h"
#include "SSystem/SComponent/c_m3d.h"
#include "dol2asm.h"
#include "dolphin/types.h"
#include "msl_c/math.h"
//
// Declarations:
//
/* 8026F3DC-8026F408 269D1C 002C+00 0/0 3/3 0/0 .text __ct__8cM3dGPlaFPC4cXyzf */
cM3dGPla::cM3dGPla(const cXyz* pNormal, f32 pD) : mNormal(*pNormal), mD(pD) {}
/* 8026F408-8026F4C4 269D48 00BC+00 0/0 3/3 0/0 .text crossInfLin__8cM3dGPlaCFRC4cXyzRC4cXyzR4cXyz
*/
bool cM3dGPla::crossInfLin(const cXyz& pStart, const cXyz& pEnd, cXyz& out) const {
f32 tmp1 = (mD + PSVECDotProduct(&mNormal, &pStart));
f32 tmp2 = tmp1 - (mD + PSVECDotProduct(&mNormal, &pEnd));
if (fabsf(tmp2) < G_CM3D_F_ABS_MIN) {
out = pEnd;
return false;
} else {
cM3d_InDivPos2(&pStart, &pEnd, (tmp1 / tmp2), &out);
return true;
}
}
/* 8026F4C4-8026F52C 269E04 0068+00 0/0 1/1 0/0 .text SetupNP0__8cM3dGPlaFRC3VecRC3Vec */
void cM3dGPla::SetupNP0(const Vec& pNormal, const Vec& pPoint) {
mNormal = pNormal;
PSVECNormalize(&mNormal, &mNormal);
mD = -PSVECDotProduct(&mNormal, &pPoint);
}
/* 8026F52C-8026F57C 269E6C 0050+00 0/0 2/2 0/0 .text SetupNP__8cM3dGPlaFRC3VecRC3Vec */
void cM3dGPla::SetupNP(const Vec& pNormal, const Vec& pPoint) {
mNormal = pNormal;
mD = -PSVECDotProduct(&mNormal, &pPoint);
}
/* 8026F57C-8026F5D4 269EBC 0058+00 0/0 2/2 0/0 .text getCrossY__8cM3dGPlaCFRC4cXyzPf */
bool cM3dGPla::getCrossY(const cXyz& pPoint, f32* pOut) const {
if (fabsf(mNormal.y) < G_CM3D_F_ABS_MIN) {
return false;
} else {
*pOut = (-mNormal.x * pPoint.x - mNormal.z * pPoint.z - mD) / mNormal.y;
return true;
}
}
/* 8026F5D4-8026F624 269F14 0050+00 0/0 1/1 0/0 .text getCrossYLessD__8cM3dGPlaCFRC3VecPf
*/
bool cM3dGPla::getCrossYLessD(const Vec& pPoint, f32* pOut) const {
if (fabsf(mNormal.y) < G_CM3D_F_ABS_MIN) {
return false;
} else {
*pOut = (-mNormal.x * pPoint.x - mNormal.z * pPoint.z) / mNormal.y;
return true;
}
}
/* 8026F624-8026F648 269F64 0024+00 0/0 1/1 0/0 .text Set__8cM3dGPlaFPC8cM3dGPla */
void cM3dGPla::Set(const cM3dGPla* pOther) {
*this = *pOther;
}