5#include "JSystem/JGeometry.hpp"
7static f32 minDegree = 0.0f;
8static f32 maxDegree = 360.0f;
10static f32 flt_8060FC80[1816];
20 f32 getRandom(f32, f32);
21 s32 getRandom(s32, s32);
22 f32 getRandomDegree();
23 void calcRandomVec(TVec3f *, f32, f32);
24 u8 isHalfProbability();
25 f32 getSignHalfProbability();
26 void getRandomVector(TVec3f *, f32);
27 void addRandomVector(TVec3f *,
const TVec3f &, f32);
28 void turnRandomVector(TVec3f *,
const TVec3f &, f32);
29 f32 getInterpolateValue(f32, f32, f32);
30 f32 getLinerValue(f32, f32, f32, f32);
31 f32 getLinerValueFromMinMax(f32, f32, f32, f32, f32);
32 f32 getEaseInValue(f32, f32, f32, f32);
33 f32 getEaseOutValue(f32, f32, f32, f32);
34 f32 getEaseInOutValue(f32, f32, f32, f32);
35 f32 getScaleWithReactionValueZeroToOne(f32, f32, f32);
38 void separateScalarAndDirection(f32 *pScalar, TVec3f *pDirection,
const TVec3f &rSrc);
40 void makeAxisFrontUp(TVec3f *, TVec3f *,
const TVec3f &,
const TVec3f &);
41 void makeAxisFrontSide(TVec3f *, TVec3f *,
const TVec3f &,
const TVec3f &);
42 void makeAxisUpFront(TVec3f *, TVec3f *,
const TVec3f &,
const TVec3f &);
43 void makeAxisUpSide(TVec3f *, TVec3f *,
const TVec3f &,
const TVec3f &);
44 void makeAxisVerticalZX(TVec3f *,
const TVec3f &);
45 void makeAxisCrossPlane(TVec3f *, TVec3f *,
const TVec3f &);
46 bool makeAxisAndCosignVecToVec(TVec3f *, f32 *,
const TVec3f &,
const TVec3f &);
47 f32 calcPerpendicFootToLine(TVec3f *,
const TVec3f &,
const TVec3f &,
const TVec3f &);
48 f32 calcPerpendicFootToLineInside(TVec3f *,
const TVec3f &,
const TVec3f &,
const TVec3f &);
50 void blendQuatUpFront(TQuat4f *,
const TVec3f &,
const TVec3f &,
float,
float);
52 void clampLength(TVec3f *,
const TVec3f &, f32);
53 f32 convergeRadian(f32, f32, f32);
54 bool isInRange(f32, f32, f32);
56 f32 calcRotateY(f32, f32);
58 f32 calcDistanceXY(
const TVec3f &,
const TVec3f &);
60 void rotateVecDegree(TVec3f *,
const TVec3f &, f32);
62 bool isNearZero(f32, f32);
63 bool isNearZero(
const TVec3f &, f32);
65 bool isSameDirection(
const TVec3f &,
const TVec3f &,
float);
66 bool isOppositeDirection(
const TVec3f &,
const TVec3f &, f32);
68 f32 diffAngleAbs(f32, f32);
69 f32 diffAngleAbs(
const TVec3f &,
const TVec3f &);
70 f32 diffAngleAbsHorizontal(
const TVec3f &,
const TVec3f &,
const TVec3f &);
71 f32 diffAngleSignedHorizontal(
const TVec3f &,
const TVec3f &,
const TVec3f &);
72 f32 normalizeAngleAbs(f32);
73 bool isAngleBetween(f32, f32, f32);
74 f32 blendAngle(f32, f32, f32);
76 _GXColor lerp(_GXColor, _GXColor, f32);
81 f32 vecKillElement(
const TVec3f &,
const TVec3f &, TVec3f *);
82 void vecScaleAdd(
const TVec3f *,
const TVec3f *, f32);
83 void PSvecBlend(
const TVec3f *,
const TVec3f *, TVec3f *, f32, f32);
84 void vecBlend(
const TVec3f &,
const TVec3f &, TVec3f *, f32);
86 s32 vecBlendSphere(
const TVec3f &,
const TVec3f &, TVec3f *, f32);
88 void blendColor(_GXColor *,
const _GXColor &,
const _GXColor &, f32);
89 void blendVec(Vec *,
const Vec &,
const Vec &, f32);
91 int getMinAbsElementIndex(
const TVec3f &);
92 f32 getMaxElement(
const TVec3f &);
93 f32 getMaxAbsElement(
const TVec3f &);
94 int getMaxElementIndex(
const TVec3f &);
95 int getMaxAbsElementIndex(
const TVec3f &);
96 f32 diffAngleAbsFast(
const TVec3f &,
const TVec3f &);
98 bool isNearAngleRadian(
const TVec3f &,
const TVec3f &,
float);
99 bool isNearAngleDegree(
const TVec3f &,
const TVec3f &,
float);
100 bool isNearAngleRadianHV(
const TVec3f &,
const TVec3f &,
const TVec3f &,
float,
float);
101 bool isNearAngleDegreeHV(
const TVec3f &,
const TVec3f &,
const TVec3f &,
float,
float);
105 void normalize(TVec2f *);
106 void normalize(TVec3f *);
107 void normalize(
const TVec3f &, TVec3f *);
109 f32 normalize(f32, f32, f32);
111 bool normalizeOrZero(TVec2f *);
112 bool normalizeOrZero(TVec3f *);
113 bool normalizeOrZero(
const TVec3f &, TVec3f *);
115 bool isNan(
const TVec3f &);
120 f32 clamp(f32, f32, f32);
122 f32 getScaleWithReactionValueZeroToOne(f32, f32, f32);
124 void calcReboundVelocity(TVec3f *,
const TVec3f &, f32, f32);
126 void getRotatedAxisZ(TVec3f *,
const TVec3f &);
127 void getRotatedAxisY(TVec3f *,
const TVec3f &);
129 void turnVecToVecCosOnPlane(TVec3f *,
const TVec3f &,
const TVec3f &, f32);
131 void turnVecToPlane(TVec3f *,
const TVec3f &,
const TVec3f &);
137 static f32 max(f32 x, f32 y) {
138 return x >= y ? x : y;
144 inline TVec3f createVecAndScale(
const TVec3f &rSrc, f32 scalar) {
150 inline TVec3f createNegatedVecAndScale(
const TVec3f &rSrc, f32 scalar) {
151 return rSrc.negateInline() % scalar;
156 inline TVec3f createVecAndScaleByAndAdd(
const TVec3f &rSrc,
const TVec3f &rOtherVec) {
158 vec.scaleInline(120.0f);
160 TVec3f other_vec(rOtherVec);
161 other_vec.addInline3(vec);
165 inline TVec3f createVecAndScaleByAndAdd_2(
const TVec3f &rSrc,
const TVec3f &rOtherVec) {
167 vec.scaleInline(120.0f);
169 TVec3f other_vec(rOtherVec);
170 other_vec.addInline_5(vec);
174 inline TVec3f negateVector(TVec3f &rVec) {
178 inline void createVecScaleAndApply(
const TVec3f &rSrc, TVec3f &rDest, f32 scalar) {
179 rDest += createVecAndScale(rSrc, scalar);
182 inline TVec3f addTwoScalarVecs(
const TVec3f &rSrcVector_One,
const TVec3f &rSrcVector_Two, f32 scalar_one, f32 scalar_two) {
183 TVec3f vec_one(rSrcVector_One);
184 vec_one.scale(scalar_one);
185 f32 scale_2 = scalar_two;
186 TVec3f vec_two(rSrcVector_Two);
187 vec_two.scale(scale_2);
193 inline TVec3f multVec(
const TVec3f &rSrc, f32 mult, f32 mult_2) {
194 TVec3f vec_one(rSrc);
196 TVec3f vec_two(vec_one);
201 inline TVec3f multVec(
const TVec3f &rSrc, f32 mult) {
207 inline TVec3f multAndAddVec(
const TVec3f &rSrc,
const TVec3f &rSrc_2, f32 mult, f32 mult_2) {
208 TVec3f vec_one(rSrc);
210 TVec3f vec_two(rSrc_2);
217 inline TVec3f multVecNoCtor(
const TVec3f& rSrc, f32 mult) {
221 inline TVec3f addVec(
const TVec3f& rSrc,
const TVec3f& rBase) {
223 hurr.addInline6(rSrc);
227 inline f32 subtractFromSum(f32 lhs, f32 rhs, f32 sub) {
228 return (rhs + lhs) - sub;
231 inline f32 divideFromDiff(f32 lhs, f32 rhs, f32 div) {
232 return (lhs - rhs) / div;
235 inline f32 modAndAdd(f32 a1, f32 a2) {
236 return a1 + (f32)fmod(360.0f + a2, 360.0f);
239 inline f32 modAndAdd(f32 a1, f32 a2, f32 a3) {
240 return a1 + (f32)fmod(a3 + a2, a3);
243 inline f32 modAndSubtract(f32 a1, f32 a3, f32 a4) {
244 f32 mod = fmod((a3 + (a1 - a4)), a3);
248 inline f32 add(f32 lhs, f32 rhs) {
252 inline f32 negFloat(f32 val) {
253 return (val < 0.0f) ? -val : val;
256 inline s32 mod(s32 val, s32 mod) {
260 f32 repeat(f32 a1, f32 a2, f32 a3) {
261 f64 mod = fmod(a3 + (a1 - a2), a3);
265 inline void subtractAndSet(TVec3f &a1,
const TVec3f &a2,
const TVec3f *a3) {
269 inline void multAndSet(TVec3f *a1,
const TVec3f &a2, f32 a3) {
270 a1->set<f32>(a2 * a3);
273 inline int getRemainder(
int ra,
int rb) {
274 int quotient = ra / rb;
276 int remainder = ra - quotient;
284f32 PSVECKillElement(
const Vec *,
const Vec *,
const Vec *);