34 static inline f32 epsilon() {
return 32.0f * FLT_EPSILON; }
35 static inline f32 PI() {
return 3.1415927f; }
42 root = 0.5f * root * (3.0f -
x * (root * root));
54 root = 0.5f * root * (3.0f -
x * (root * root));
62 static inline double epsilon() {
return 32.0f * FLT_EPSILON; }
63 static inline double one() {
return 1.0; }
64 static inline double atan2(
double x,
double y) { return ::atan2(
x,
y); }
65 static inline double asin(
double x) { return ::asin(
x); }
66 static inline double halfPI() {
return 1.5707963267948966; }
86 void set(
double x_,
double y_,
double z_) {
116 *((
s32*)
this) = *((
s32*)&b);
130 const __REGISTER
f32* v_a = vec_a;
131 __REGISTER
f32* v_b = vec_b;
137 psq_l a_x, 0(v_a), 0, 0
139 psq_st a_x, 0(v_b), 0, 0
153 return 0.5f * root * (3.0f - mag * (root * root));
159 __REGISTER
f32 a_x_y;
160 __REGISTER
f32 b_x_y;
167 psq_l a_x_y, 0(
a), 0, 0
168 psq_l b_x_y, 0(b), 0, 0
169 ps_mul x_y, a_x_y, b_x_y
170 psq_st x_y, 0(dst), 0, 0
172 dst[2] =
a[2] * b[2];
194 operator const Vec*()
const {
return (
Vec*)&
x; }
210 void set(U x_, U y_, U z_) {
268 return inv_norm * sq;
272 f32 sq = other.squared();
283 return VECMag((
Vec*)
this);
290 __REGISTER
f32* dst = &
x;
294 psq_l x_y, 0(dst), 0, 0
295 psq_l
z, 8(dst), 1, 0
296 ps_muls0 x_y, x_y, sc
297 psq_st x_y, 0(dst), 0, 0
299 psq_st zres, 8(dst), 1, 0
306 __REGISTER
const f32*
src = &other.
x;
309 __REGISTER
f32* dst = &
x;
313 psq_l x_y, 0(
src), 0, 0
314 psq_l
z, 8(
src), 1, 0
315 ps_muls0 x_y, x_y, sc
316 psq_st x_y, 0(dst), 0, 0
318 psq_st zres, 8(dst), 1, 0
329 __REGISTER
f32* rdst = &dst->
x;
330 const __REGISTER
f32*
src = &
x;
335 psq_l x_y, 0(
src), 0, 0
337 psq_st x_y, 0(rdst), 0, 0
346 negateInternal(
this);
362 VECCrossProduct(
a, b, *
this);
371 scale(inv_norm * len);
372 return inv_norm * sq;
376 f32 sq = other.squared();
382 scale(inv_norm * len, other);
383 return inv_norm * sq;
392 f32 fVar5 = param_5 * param_5;
393 f32 fVar6 = fVar5 * param_5;
394 f32 fVar8 = 1.0f + (2.0f * fVar6 - 3.0f * fVar5);
395 f32 fVar9 = -2.0f * fVar6 + 3.0f * fVar5;
396 f32 fVar7 = param_5 + (fVar6 - 2.0f * fVar5);
397 f32 fVar4 = fVar6 - fVar5;
398 x = fVar8 * param_1.
x + fVar9 * param_4.
x + fVar7 * param_2.
x + fVar4 * param_3.
x;
399 y = fVar8 * param_1.
y + fVar9 * param_4.
y + fVar7 * param_2.
y + fVar4 * param_3.
y;
400 z = fVar8 * param_1.
z + fVar9 * param_4.
z + fVar7 * param_2.
z + fVar4 * param_3.
z;
409 template <
typename U>
414 template <
typename U>
420 template <
typename U>
446 return (
x >= other.
x) && (
y >= other.
y) ?
true :
false;
450 return x * other.
x +
y * other.
y;
508 if (!this->isValid()) {
510 this->
i.setMin(box.
i);
511 this->
i.setMin(box.
f);
512 this->
f.setMax(box.
i);
513 this->
f.setMax(box.
f);
static int min(int a, int b)
Definition JHIComm.cpp:155
void JMAVECScaleAdd(__REGISTER const Vec *vec1, __REGISTER const Vec *vec2, __REGISTER Vec *dst, __REGISTER f32 scale)
Definition JMath.cpp:73
const void * src
Definition __os.h:116
signed short int s16
Definition types.h:9
float f32
Definition types.h:25
signed long s32
Definition types.h:11
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:128
float fsqrt_step(float mag)
Definition JGeometry.h:150
void mulInternal(__REGISTER const f32 *a, __REGISTER const f32 *b, __REGISTER float *dst)
Definition JGeometry.h:157
void C_VECSubtract(__REGISTER const Vec *a, __REGISTER const Vec *b, __REGISTER Vec *ab)
Definition JMath.h:216
f32 C_VECDotProduct(__REGISTER const Vec *a, __REGISTER const Vec *b)
Definition JMath.h:253
f32 C_VECSquareMag(__REGISTER const Vec *v)
Definition JMath.h:236
void C_VECAdd(__REGISTER const Vec *a, __REGISTER const Vec *b, __REGISTER Vec *ab)
Definition JMath.h:196
Definition JGeometry.h:499
void set(const TVec2< f32 > &i, const TVec2< f32 > &f)
Definition JGeometry.h:518
void set(const TBox< TVec2< T > > &other)
Definition JGeometry.h:517
TBox2(f32 x0, f32 y0, f32 x1, f32 y1)
Definition JGeometry.h:505
void set(f32 x0, f32 y0, f32 x1, f32 y1)
Definition JGeometry.h:519
TBox2()
Definition JGeometry.h:500
void absolute()
Definition JGeometry.h:507
TBox2(const TVec2< f32 > &_i, const TVec2< f32 > &_f)
Definition JGeometry.h:501
TVec2< f32 > f
Definition JGeometry.h:495
void addPos(const TVec2< f32 > &pos)
Definition JGeometry.h:484
bool intersect(const TBox< TVec2< f32 > > &other)
Definition JGeometry.h:489
f32 getHeight() const
Definition JGeometry.h:476
bool isValid() const
Definition JGeometry.h:478
f32 getWidth() const
Definition JGeometry.h:475
void addPos(f32 x, f32 y)
Definition JGeometry.h:480
Definition JGeometry.h:466
TBox(const TBox &other)
Definition JGeometry.h:468
TBox()
Definition JGeometry.h:467
T i
Definition JGeometry.h:470
T f
Definition JGeometry.h:470
static double one()
Definition JGeometry.h:63
static double halfPI()
Definition JGeometry.h:66
static double epsilon()
Definition JGeometry.h:62
static double atan2(double x, double y)
Definition JGeometry.h:64
static double asin(double x)
Definition JGeometry.h:65
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
static f32 sqrt(f32 x)
Definition JGeometry.h:47
Definition JGeometry.h:11
static T clamp(T v, T min, T max)
Definition JGeometry.h:12
Definition JGeometry.h:405
void set(const U x, const U y)
Definition JGeometry.h:415
bool isAbove(const TVec2< T > &other) const
Definition JGeometry.h:445
void setMax(const TVec2< f32 > &max)
Definition JGeometry.h:433
void add(const TVec2< T > &other)
Definition JGeometry.h:440
void set(T v)
Definition JGeometry.h:412
f32 squared() const
Definition JGeometry.h:453
f32 dot(const TVec2< T > &other) const
Definition JGeometry.h:449
TVec2(const U x, const U y)
Definition JGeometry.h:410
TVec2()
Definition JGeometry.h:406
void setMin(const TVec2< f32 > &min)
Definition JGeometry.h:426
TVec2(T v)
Definition JGeometry.h:407
void set(const TVec2< U > &other)
Definition JGeometry.h:421
T x
Definition JGeometry.h:461
T y
Definition JGeometry.h:462
f32 length() const
Definition JGeometry.h:457
void scale(double b)
Definition JGeometry.h:97
void set(double x_, double y_, double z_)
Definition JGeometry.h:86
double x
Definition JGeometry.h:84
TVec3< double > & operator*=(double b)
Definition JGeometry.h:92
void mul(const TVec3< f32 > &a)
Definition JGeometry.h:226
f32 squared() const
Definition JGeometry.h:257
void cross(const TVec3< f32 > &a, const TVec3< f32 > &b)
Definition JGeometry.h:361
TVec3< f32 > & operator+=(const TVec3< f32 > &b)
Definition JGeometry.h:240
void mul(const TVec3< f32 > &a, const TVec3< f32 > &b)
Definition JGeometry.h:222
TVec3(const TVec3< f32 > &i_vec)
Definition JGeometry.h:182
f32 normalize(const TVec3< f32 > &other)
Definition JGeometry.h:271
TVec3()
Definition JGeometry.h:191
void scale(__REGISTER f32 sc, const TVec3< f32 > &other)
Definition JGeometry.h:304
f32 length() const
Definition JGeometry.h:282
void negate()
Definition JGeometry.h:345
TVec3(const Vec &i_vec)
Definition JGeometry.h:178
TVec3(U x, U y, U z)
Definition JGeometry.h:187
bool isZero() const
Definition JGeometry.h:357
f32 setLength(f32 len)
Definition JGeometry.h:365
f32 setLength(const TVec3< f32 > &other, f32 len)
Definition JGeometry.h:375
TVec3< f32 > & operator=(const Vec &b)
Definition JGeometry.h:230
f32 normalize()
Definition JGeometry.h:261
void sub(const TVec3< f32 > &a, const TVec3< f32 > &b)
Definition JGeometry.h:353
void scaleAdd(__REGISTER f32 sc, const TVec3< f32 > &a, const TVec3< f32 > &b)
Definition JGeometry.h:323
void sub(const TVec3< f32 > &b)
Definition JGeometry.h:349
void zero()
Definition JGeometry.h:220
void scale(__REGISTER f32 sc)
Definition JGeometry.h:286
void set(const TVec3< U > &other)
Definition JGeometry.h:197
TVec3< f32 > & operator=(const TVec3< f32 > &b)
Definition JGeometry.h:235
void negateInternal(TVec3< f32 > *dst)
Definition JGeometry.h:327
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:390
TVec3< f32 > operator+(const TVec3< f32 > &b)
Definition JGeometry.h:245
void set(U x_, U y_, U z_)
Definition JGeometry.h:210
void set(const Vec &other)
Definition JGeometry.h:203
f32 dot(const TVec3< f32 > &other) const
Definition JGeometry.h:386
void add(const TVec3< f32 > &b)
Definition JGeometry.h:216
TVec3()
Definition JGeometry.h:108
s16 x
Definition JGeometry.h:106
void set(s16 x_, s16 y_, s16 z_)
Definition JGeometry.h:121
TVec3 & operator=(const TVec3 &b)
Definition JGeometry.h:114
TVec3(s16 x, s16 y, s16 z)
Definition JGeometry.h:110
Definition JGeometry.h:70
T x
Definition JGeometry.h:71
void set(const TVec3 &other)
Definition JGeometry.h:75
T z
Definition JGeometry.h:73
T y
Definition JGeometry.h:72