31 typedef float __attribute__((ext_vector_type(4))) VuoPoint4d;
35 #define VuoList_VuoPoint4d_TYPE_DEFINED
42 #define VuoPoint4d_SUPPORTS_COMPARISON
68 static inline VuoPoint4d
VuoPoint4d_make(
float x,
float y,
float z,
float w) __attribute__((
const));
71 return (VuoPoint4d){x, y, z, w};
81 return (VuoPoint4d){ f[0], f[1], f[2], f[3] };
102 static inline VuoPoint3d
VuoPoint4d_to3d(VuoPoint4d p) __attribute__((
const));
105 return (VuoPoint3d){p.x, p.y, p.z};
113 static inline VuoPoint4d
VuoPoint3d_to4d1(VuoPoint3d p) __attribute__((
const));
116 return (VuoPoint4d){p.x, p.y, p.z, 1};
139 return u.x*v.x + u.y*v.y + u.z*v.z + u.w*v.w;
149 return sqrtf(a.x*a.x + a.y*a.y + a.z*a.z + a.w*a.w);
158 VuoPoint3d p = a.xyz / sqrtf(a.x * a.x + a.y * a.y + a.z * a.z);
159 return (VuoPoint4d){p.x, p.y, p.z, a.w};
168 return a / sqrtf(a.x * a.x + a.y * a.y + a.z * a.z + a.w * a.w);
174 static inline VuoPoint4d
VuoPoint4d_add(VuoPoint4d a, VuoPoint4d b) __attribute__((
const));
183 static inline VuoPoint4d
VuoPoint4d_subtract(VuoPoint4d a, VuoPoint4d b) __attribute__((
const));
195 return (a.x*a.x + a.y*a.y + a.z*a.z + a.w*a.w);
202 static inline VuoPoint4d
VuoPoint4d_divide(VuoPoint4d a, VuoPoint4d b) __attribute__((
const));
211 static inline VuoPoint4d
VuoPoint4d_multiply(VuoPoint4d a,
float b) __attribute__((
const));
220 static inline VuoPoint4d
VuoPoint4d_scale(VuoPoint4d a, VuoPoint4d b) __attribute__((
const));
232 if (fabs(a.x) < 0.000001)
233 a.x = copysign(0.000001, a.x);
234 if (fabs(a.y) < 0.000001)
235 a.y = copysign(0.000001, a.y);
236 if (fabs(a.z) < 0.000001)
237 a.z = copysign(0.000001, a.z);
238 if (fabs(a.w) < 0.000001)
239 a.w = copysign(0.000001, a.w);
246 static inline float VuoPoint4d_distance(VuoPoint4d a, VuoPoint4d b) __attribute__((
const));
249 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));
255 static inline VuoPoint4d
VuoPoint4d_min(
const VuoPoint4d l,
const VuoPoint4d r) __attribute__((
const));
268 static inline VuoPoint4d
VuoPoint4d_max(
const VuoPoint4d l,
const VuoPoint4d r) __attribute__((
const));
281 static inline VuoPoint4d
VuoPoint4d_snap(VuoPoint4d a, VuoPoint4d center, VuoPoint4d snap) __attribute__((
const));
282 static inline VuoPoint4d
VuoPoint4d_snap(VuoPoint4d a, VuoPoint4d center, VuoPoint4d snap)
285 return (VuoPoint4d) {
286 center.x + nonzeroSnap.x * (int)round((a.x-center.x) / nonzeroSnap.x),
287 center.y + nonzeroSnap.y * (
int)round((a.y-center.y) / nonzeroSnap.y),
288 center.z + nonzeroSnap.z * (int)round((a.z-center.z) / nonzeroSnap.z),
289 center.w + nonzeroSnap.w * (
int)round((a.w-center.w) / nonzeroSnap.w)
297 static inline VuoPoint4d
VuoPoint4d_clampn(VuoPoint4d point, VuoPoint4d limitA, VuoPoint4d limitB)