32typedef float __attribute__((ext_vector_type(4))) VuoPoint4d;
34#define VuoPoint4d_SUPPORTS_COMPARISON
65static inline VuoPoint4d
VuoPoint4d_make(
float x,
float y,
float z,
float w) __attribute__((
const));
68 return (VuoPoint4d){x, y, z, w};
78 return (VuoPoint4d){ f[0], f[1], f[2], f[3] };
99static inline VuoPoint3d
VuoPoint4d_to3d(VuoPoint4d p) __attribute__((
const));
102 return (VuoPoint3d){p.x, p.y, p.z};
110static inline VuoPoint4d
VuoPoint3d_to4d1(VuoPoint3d p) __attribute__((
const));
113 return (VuoPoint4d){p.x, p.y, p.z, 1};
136 return u.x*v.x + u.y*v.y + u.z*v.z + u.w*v.w;
146 return sqrtf(a.x*a.x + a.y*a.y + a.z*a.z + a.w*a.w);
155 VuoPoint3d p = a.xyz / sqrtf(a.x * a.x + a.y * a.y + a.z * a.z);
156 return (VuoPoint4d){p.x, p.y, p.z, a.w};
165 return a / sqrtf(a.x * a.x + a.y * a.y + a.z * a.z + a.w * a.w);
171static inline VuoPoint4d
VuoPoint4d_add(VuoPoint4d a, VuoPoint4d b) __attribute__((
const));
180static inline VuoPoint4d
VuoPoint4d_subtract(VuoPoint4d a, VuoPoint4d b) __attribute__((
const));
192 return (a.x*a.x + a.y*a.y + a.z*a.z + a.w*a.w);
199static inline VuoPoint4d
VuoPoint4d_divide(VuoPoint4d a, VuoPoint4d b) __attribute__((
const));
217static inline VuoPoint4d
VuoPoint4d_scale(VuoPoint4d a, VuoPoint4d b) __attribute__((
const));
229 if (fabs(a.x) < 0.000001)
230 a.x = copysign(0.000001, a.x);
231 if (fabs(a.y) < 0.000001)
232 a.y = copysign(0.000001, a.y);
233 if (fabs(a.z) < 0.000001)
234 a.z = copysign(0.000001, a.z);
235 if (fabs(a.w) < 0.000001)
236 a.w = copysign(0.000001, a.w);
246 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) + (a.w-b.w)*(a.w-b.w));
252static inline VuoPoint4d
VuoPoint4d_min(
const VuoPoint4d l,
const VuoPoint4d r) __attribute__((
const));
265static inline VuoPoint4d
VuoPoint4d_max(
const VuoPoint4d l,
const VuoPoint4d r) __attribute__((
const));
278static inline VuoPoint4d
VuoPoint4d_snap(VuoPoint4d a, VuoPoint4d center, VuoPoint4d snap) __attribute__((
const));
279static inline VuoPoint4d
VuoPoint4d_snap(VuoPoint4d a, VuoPoint4d center, VuoPoint4d snap)
282 return (VuoPoint4d) {
283 center.x + nonzeroSnap.x * (int)round((a.x-center.x) / nonzeroSnap.x),
284 center.y + nonzeroSnap.y * (
int)round((a.y-center.y) / nonzeroSnap.y),
285 center.z + nonzeroSnap.z * (int)round((a.z-center.z) / nonzeroSnap.z),
286 center.w + nonzeroSnap.w * (
int)round((a.w-center.w) / nonzeroSnap.w)
294static inline VuoPoint4d
VuoPoint4d_clampn(VuoPoint4d point, VuoPoint4d limitA, VuoPoint4d limitB)