34 static inline f32 epsilon() {
return 32.0f * FLT_EPSILON; }
35 static inline f32 PI() {
return 3.1415927f; }
41 return 0.5f * root * (3.0f -
x * (root * root));
47 static inline double epsilon() {
return 32.0f * FLT_EPSILON; }
48 static inline double one() {
return 1.0; }
51 static inline double halfPI() {
return 1.5707963267948966; }
71 void set(
double x_,
double y_,
double z_) {
101 *((
s32*)
this) = *((
s32*)&b);
114 const register f32* v_a = vec_a;
115 register f32* v_b = vec_b;
122 psq_l a_x, 0(v_a), 0, 0
124 psq_st a_x, 0(v_b), 0, 0
137 return 0.5f * root * (3.0f - mag * (root * root));
157 operator const Vec*()
const {
return (
Vec*)&
x; }
184 register f32* dst = &
x;
185 const register f32* srca = &
a.x;
186 const register f32* srcb = &b.
x;
195 psq_l a_x_y, 0(srca), 0, 0
196 psq_l b_x_y, 0(srcb), 0, 0
197 ps_mul x_y, a_x_y, b_x_y
198 psq_st x_y, 0(dst), 0, 0
244 if (sq <= FLT_EPSILON * 32.0f) {
257 f32 sq = other.squared();
258 if (sq <= FLT_EPSILON * 32.0f) {
272 return VECMag((
Vec*)
this);
278 register f32* dst = &
x;
282 psq_l x_y, 0(dst), 0, 0
283 psq_l
z, 8(dst), 1, 0
284 ps_muls0 x_y, x_y,
sc
285 psq_st x_y, 0(dst), 0, 0
287 psq_st zres, 8(dst), 1, 0
293 register const f32*
src = &other.
x;
296 register f32* dst = &
x;
300 psq_l x_y, 0(
src), 0, 0
301 psq_l
z, 8(
src), 1, 0
302 ps_muls0 x_y, x_y,
sc
303 psq_st x_y, 0(dst), 0, 0
305 psq_st zres, 8(dst), 1, 0
315 register f32* rdst = &dst->
x;
321 psq_l x_y, 0(
src), 0, 0
323 psq_st x_y, 0(rdst), 0, 0
332 negateInternal(
this);
344 return squared() <= 32.0f * FLT_EPSILON;
348 VECCrossProduct(
a, b, *
this);
353 if (sq <= FLT_EPSILON * 32.0f) {
366 f32 sq = other.squared();
372 scale(inv_norm * len, other);
373 return inv_norm * sq;
377 register const f32* pThis = &
x;
378 register const f32* pOther = &other.
x;
381 register f32 otheryz;
382 register f32 otherxy;
386 psq_l thisyz, 4(pThis), 0, 0
387 psq_l otheryz, 4(pOther), 0, 0
388 ps_mul thisyz, thisyz, otheryz
389 psq_l thisxy, 0(pThis), 0, 0
390 psq_l otherxy, 0(pOther), 0, 0
391 ps_madd otheryz, thisxy, otherxy, thisyz
392 ps_sum0 res, otheryz, thisyz, thisyz
400 f32 fVar5 = param_5 * param_5;
401 f32 fVar6 = fVar5 * param_5;
402 f32 fVar8 = 1.0f + (2.0f * fVar6 - 3.0f * fVar5);
403 f32 fVar9 = -2.0f * fVar6 + 3.0f * fVar5;
404 f32 fVar7 = param_5 + (fVar6 - 2.0f * fVar5);
405 f32 fVar4 = fVar6 - fVar5;
406 x = fVar8 * param_1.
x + fVar9 * param_4.
x + fVar7 * param_2.
x + fVar4 * param_3.
x;
407 y = fVar8 * param_1.
y + fVar9 * param_4.
y + fVar7 * param_2.
y + fVar4 * param_3.
y;
408 z = fVar8 * param_1.
z + fVar9 * param_4.
z + fVar7 * param_2.
z + fVar4 * param_3.
z;
450 return (
x >= other.
x) && (
y >= other.
y) ?
true :
false;
454 return x * other.
x +
y * other.
y;
514 if (!this->isValid()) {
516 this->
i.setMin(box.
i);
517 this->
i.setMin(box.
f);
518 this->
f.setMax(box.
i);
519 this->
f.setMax(box.
f);
static int min(int a, int b)
Definition JHIComm.cpp:156
void JMAVECScaleAdd(register const Vec *vec1, register const Vec *vec2, register Vec *dst, register f32 scale)
Definition JMath.cpp:84
const void * src
Definition __os.h:116
static u8 sc[12]
Definition d_a_e_bi.cpp:996
static u8 pos[12]
Definition d_a_obj_kago.cpp:839
double x double x
Definition e_atan2.c:58
static const static double double zero
Definition e_atan2.c:50
double x double y
Definition e_atan2.c:58
double y1
Definition e_pow.c:163
double v
Definition e_pow.c:163
void setTVec3f(const f32 *vec_a, f32 *vec_b)
Definition JGeometry.h:113
float fsqrt_step(float mag)
Definition JGeometry.h:135
f32 C_VECSquareMag(const Vec *v)
Definition JMath.h:215
void C_VECAdd(register const Vec *a, register const Vec *b, register Vec *ab)
Definition JMath.h:175
void C_VECSubtract(register const Vec *a, register const Vec *b, register Vec *ab)
Definition JMath.h:195
Definition JGeometry.h:508
void set(const TVec2< f32 > &i, const TVec2< f32 > &f)
Definition JGeometry.h:524
TBox2(f32 x0, f32 y0, f32 x1, f32 y1)
Definition JGeometry.h:511
void set(f32 x0, f32 y0, f32 x1, f32 y1)
Definition JGeometry.h:525
TBox2()
Definition JGeometry.h:509
TBox2(const TVec2< f32 > &i, const TVec2< f32 > &f)
Definition JGeometry.h:510
void set(const TBox2 &other)
Definition JGeometry.h:523
void absolute()
Definition JGeometry.h:513
TVec2< f32 > f
Definition JGeometry.h:504
void addPos(const TVec2< f32 > &pos)
Definition JGeometry.h:493
bool intersect(const TBox< TVec2< f32 > > &other)
Definition JGeometry.h:498
f32 getHeight() const
Definition JGeometry.h:485
bool isValid() const
Definition JGeometry.h:487
f32 getWidth() const
Definition JGeometry.h:484
void addPos(f32 x, f32 y)
Definition JGeometry.h:489
Definition JGeometry.h:475
TBox(const TBox &other)
Definition JGeometry.h:477
TBox()
Definition JGeometry.h:476
T i
Definition JGeometry.h:479
T f
Definition JGeometry.h:479
static double one()
Definition JGeometry.h:48
static double halfPI()
Definition JGeometry.h:51
static double epsilon()
Definition JGeometry.h:47
static double atan2(double x, double y)
Definition JGeometry.h:49
static double asin(double x)
Definition JGeometry.h:50
static f32 inv_sqrt(f32 x)
Definition JGeometry.h:36
static f32 clamp(f32 v, f32 min, f32 max)
Definition JGeometry.h:25
static f32 PI()
Definition JGeometry.h:35
static f32 epsilon()
Definition JGeometry.h:34
Definition JGeometry.h:11
static T clamp(T v, T min, T max)
Definition JGeometry.h:12
Definition JGeometry.h:413
bool isAbove(const TVec2< T > &other) const
Definition JGeometry.h:449
void setMax(const TVec2< f32 > &max)
Definition JGeometry.h:437
void add(const TVec2< T > &other)
Definition JGeometry.h:444
void set(T v)
Definition JGeometry.h:418
TVec2()
Definition JGeometry.h:414
f32 squared()
Definition JGeometry.h:457
void setMin(const TVec2< f32 > &min)
Definition JGeometry.h:430
TVec2(T v)
Definition JGeometry.h:415
T x
Definition JGeometry.h:470
T y
Definition JGeometry.h:471
TVec2(T x, T y)
Definition JGeometry.h:416
f32 dot(const TVec2< T > &other)
Definition JGeometry.h:453
void set(const TVec2 &other)
Definition JGeometry.h:425
f32 length()
Definition JGeometry.h:461
void set(T x, T y)
Definition JGeometry.h:420
void scale(double b)
Definition JGeometry.h:82
void set(double x_, double y_, double z_)
Definition JGeometry.h:71
double x
Definition JGeometry.h:69
TVec3< double > & operator*=(double b)
Definition JGeometry.h:77
void mul(const TVec3< f32 > &a)
Definition JGeometry.h:207
void normalize()
Definition JGeometry.h:242
void scaleAdd(register f32 sc, const TVec3< f32 > &a, const TVec3< f32 > &b)
Definition JGeometry.h:310
f32 squared() const
Definition JGeometry.h:238
void cross(const TVec3< f32 > &a, const TVec3< f32 > &b)
Definition JGeometry.h:347
TVec3< f32 > & operator+=(const TVec3< f32 > &b)
Definition JGeometry.h:221
void mul(const TVec3< f32 > &a, const TVec3< f32 > &b)
Definition JGeometry.h:183
void normalize(const TVec3< f32 > &other)
Definition JGeometry.h:256
TVec3(const TVec3< f32 > &i_vec)
Definition JGeometry.h:146
TVec3()
Definition JGeometry.h:154
void scale(register f32 sc)
Definition JGeometry.h:275
f32 length() const
Definition JGeometry.h:271
void negate()
Definition JGeometry.h:331
TVec3(const Vec &i_vec)
Definition JGeometry.h:142
bool isZero() const
Definition JGeometry.h:343
f32 setLength(const TVec3< f32 > &other, f32 len)
Definition JGeometry.h:365
TVec3< f32 > & operator=(const Vec &b)
Definition JGeometry.h:211
void setLength(f32 len)
Definition JGeometry.h:351
void sub(const TVec3< f32 > &a, const TVec3< f32 > &b)
Definition JGeometry.h:339
void set(const TVec3< f32 > &other)
Definition JGeometry.h:159
void sub(const TVec3< f32 > &b)
Definition JGeometry.h:335
void zero()
Definition JGeometry.h:181
TVec3(f32 x, f32 y, f32 z)
Definition JGeometry.h:150
TVec3< f32 > & operator=(const TVec3< f32 > &b)
Definition JGeometry.h:216
void negateInternal(TVec3< f32 > *dst)
Definition JGeometry.h:314
void cubic(const TVec3< f32 > ¶m_1, const TVec3< f32 > ¶m_2, const TVec3< f32 > ¶m_3, const TVec3< f32 > ¶m_4, f32 param_5)
Definition JGeometry.h:398
TVec3< f32 > operator+(const TVec3< f32 > &b)
Definition JGeometry.h:226
void set(const Vec &other)
Definition JGeometry.h:165
f32 dot(const TVec3< f32 > &other) const
Definition JGeometry.h:376
void scale(register f32 sc, const TVec3< f32 > &other)
Definition JGeometry.h:292
void set(f32 x_, f32 y_, f32 z_)
Definition JGeometry.h:171
void add(const TVec3< f32 > &b)
Definition JGeometry.h:177
TVec3()
Definition JGeometry.h:93
s16 x
Definition JGeometry.h:91
void set(s16 x_, s16 y_, s16 z_)
Definition JGeometry.h:106
TVec3 & operator=(const TVec3 &b)
Definition JGeometry.h:99
TVec3(s16 x, s16 y, s16 z)
Definition JGeometry.h:95
Definition JGeometry.h:55
T x
Definition JGeometry.h:56
void set(const TVec3 &other)
Definition JGeometry.h:60
T z
Definition JGeometry.h:58
T y
Definition JGeometry.h:57
Definition d_a_hozelda.cpp:18
signed short int s16
Definition types.h:6
float f32
Definition types.h:22
signed long s32
Definition types.h:8