tp/libs/SSystem/SComponent/c_m3d_g_pla.cpp

63 lines
1.9 KiB
C++

/* c_m3d_g_pla.cpp autogenerated by split.py v0.3 at 2021-01-01 14:50:54.810233 */
#include "SComponent/c_m3d_g_pla.h"
#include "SComponent/c_m3d.h"
#include "msl_c/math.h"
extern f32 lbl_80450AEC[4]; // array to force 2 step load, MSL_C.PPCEABI.bare.H::__f32_epsilon
extern f32 lbl_80451180;
// __ct__8cM3dGPlaFPC4cXyzf
cM3dGPla::cM3dGPla(const cXyz* pNormal, f32 pD) : mNormal(*pNormal), mD(pD) {}
// 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) < lbl_80451180) {
out = pEnd;
return false;
} else {
cM3d_InDivPos2(&pStart, &pEnd, (tmp1 / tmp2), &out);
return true;
}
}
// SetupNP0__8cM3dGPlaFRC3VecRC3Vec
void cM3dGPla::SetupNP0(const Vec& pNormal, const Vec& pPoint) {
mNormal = pNormal;
PSVECNormalize(&mNormal, &mNormal);
mD = -PSVECDotProduct(&mNormal, &pPoint);
}
// SetupNP__8cM3dGPlaFRC3VecRC3Vec
void cM3dGPla::SetupNP(const Vec& pNormal, const Vec& pPoint) {
mNormal = pNormal;
mD = -PSVECDotProduct(&mNormal, &pPoint);
}
// getCrossY__8cM3dGPlaCFRC4cXyzPf
bool cM3dGPla::getCrossY(const cXyz& pPoint, f32* pOut) const {
if (fabsf(mNormal.y) < lbl_80451180) {
return false;
} else {
*pOut = (-mNormal.x * pPoint.x - mNormal.z * pPoint.z - mD) / mNormal.y;
return true;
}
}
// getCrossYLessD__8cM3dGPlaCFRC3VecPf
bool cM3dGPla::getCrossYLessD(const Vec& pPoint, f32* pOut) const {
if (fabsf(mNormal.y) < lbl_80451180) {
return false;
} else {
*pOut = (-mNormal.x * pPoint.x - mNormal.z * pPoint.z) / mNormal.y;
return true;
}
}
// Set__8cM3dGPlaFPC8cM3dGPla
void cM3dGPla::Set(const cM3dGPla* pOther) {
*this = *pOther;
}