31typedef float __attribute__((ext_vector_type(3))) VuoPoint3d;
35#define VuoList_VuoPoint3d_TYPE_DEFINED
51#define VuoPoint3d_SUPPORTS_COMPARISON
76static inline VuoPoint3d
VuoPoint3d_make(
float x,
float y,
float z) __attribute__((
const));
79 return (VuoPoint3d){x, y, z};
89 return (VuoPoint3d){ f[0], f[1], f[2] };
107static inline VuoBox VuoBox_make(VuoPoint3d center, VuoPoint3d size) __attribute__((
const));
110 return (
VuoBox){ center, size };
116static inline VuoBox VuoBox_makeWithPoints(
float xmin,
float xmax,
float ymin,
float ymax,
float zmin,
float zmax) __attribute__((
const));
120 (VuoPoint3d){ (xmin+xmax)/2.f, (ymin+ymax)/2.f, (zmin+zmax)/2.f },
121 (VuoPoint3d){ xmax-xmin, ymax-ymin, zmax-zmin }
144 return u.x*v.x+u.y*v.y+u.z*v.z;
153 return sqrtf(a.x*a.x + a.y*a.y + a.z*a.z);
162 return a / sqrtf(a.x * a.x + a.y * a.y + a.z * a.z);
168static inline VuoPoint3d
VuoPoint3d_add(VuoPoint3d a, VuoPoint3d b) __attribute__((
const));
177static inline VuoPoint3d
VuoPoint3d_subtract(VuoPoint3d a, VuoPoint3d b) __attribute__((
const));
190 return (a.x*a.x + a.y*a.y + a.z*a.z);
196static inline VuoPoint3d
VuoPoint3d_divide(VuoPoint3d a, VuoPoint3d b) __attribute__((
const));
214static inline VuoPoint3d
VuoPoint3d_min(
const VuoPoint3d l,
const VuoPoint3d r) __attribute__((
const));
226static inline VuoPoint3d
VuoPoint3d_max(
const VuoPoint3d l,
const VuoPoint3d r) __attribute__((
const));
241 if (fabs(a.x) < 0.000001)
242 a.x = copysign(0.000001, a.x);
243 if (fabs(a.y) < 0.000001)
244 a.y = copysign(0.000001, a.y);
245 if (fabs(a.z) < 0.000001)
246 a.z = copysign(0.000001, a.z);
256 return sqrtf((a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y) + (a.z-b.z)*(a.z-b.z));
262static inline VuoPoint3d
VuoPoint3d_lerp(VuoPoint3d a, VuoPoint3d b,
float t) __attribute__((
const));
265 return a * (1 - t) + b * t;
271static inline VuoPoint3d
VuoPoint3d_scale(VuoPoint3d a, VuoPoint3d b) __attribute__((
const));
285static inline VuoPoint3d
VuoPoint3d_mod(VuoPoint3d a, VuoPoint3d b) __attribute__((
const));
289 a.x - b.x * floorf(a.x / b.x),
290 a.y - b.y * floorf(a.y / b.y),
291 a.z - b.z * floorf(a.z / b.z)
301 p.x =
VuoReal_spring(timeSinceDrop, dropPosition.x, restingPosition.x, period, damping);
302 p.y =
VuoReal_spring(timeSinceDrop, dropPosition.y, restingPosition.y, period, damping);
303 p.z =
VuoReal_spring(timeSinceDrop, dropPosition.z, restingPosition.z, period, damping);
322static inline VuoPoint3d
VuoPoint3d_clampn(VuoPoint3d point, VuoPoint3d limitA, VuoPoint3d limitB)
342 return (VuoPoint3d) {
352static inline VuoPoint3d
VuoPoint3d_snap(VuoPoint3d a, VuoPoint3d center, VuoPoint3d snap)
355 return (VuoPoint3d) {
356 center.x + nonzeroSnap.x * (int)round( (a.x-center.x) / nonzeroSnap.x ),
357 center.y + nonzeroSnap.y * (
int)round( (a.y-center.y) / nonzeroSnap.y ),
358 center.z + nonzeroSnap.z * (int)round( (a.z-center.z) / nonzeroSnap.z )
367 float xmin, ymin, zmin, xmax, ymax, zmax;
372 xmin = fmin(a.center.x - extents_a.x, b.center.x - extents_b.x);
373 xmax = fmax(a.center.x + extents_a.x, b.center.x + extents_b.x);
375 ymin = fmin(a.center.y - extents_a.y, b.center.y - extents_b.y);
376 ymax = fmax(a.center.y + extents_a.y, b.center.y + extents_b.y);
378 zmin = fmin(a.center.z - extents_a.z, b.center.z - extents_b.z);
379 zmax = fmax(a.center.z + extents_a.z, b.center.z + extents_b.z);
389 VuoPoint3d exents = (VuoPoint3d){aabb.size.x / 2.f, aabb.size.y / 2.f};
390 VuoPoint3d min = aabb.center - exents;
391 VuoPoint3d max = aabb.center + exents;
393 return point.x > min.x && point.x < max.x &&
394 point.y > min.y && point.y < max.y &&
395 point.z > min.z && point.z < max.z;
406 return fabs(dist.x) * 2 < size.x &&
407 fabs(dist.y) * 2 < size.y &&
408 fabs(dist.z) * 2 < size.z;