Go to the documentation of this file.
22 #include <sys/cdefs.h>
29 #define R_DEG 182.04444443623349541909523793743
30 #define R_RAD 10430.37835
46 #define vec3f_dot(x1, y1, z1, x2, y2, z2, w) { \
47 register float __x __asm__("fr0") = (x1); \
48 register float __y __asm__("fr1") = (y1); \
49 register float __z __asm__("fr2") = (z1); \
50 register float __w __asm__("fr3"); \
51 register float __a __asm__("fr4") = (x2); \
52 register float __b __asm__("fr5") = (y2); \
53 register float __c __asm__("fr6") = (z2); \
54 register float __d __asm__("fr7"); \
55 __asm__ __volatile__( \
60 : "f" (__x), "f" (__y), "f" (__z), "f" (__w), \
61 "f" (__a), "f" (__b), "f" (__c), "f" (__d) \
77 #define vec3f_length(x, y, z, w) { \
78 register float __x __asm__("fr0") = (x); \
79 register float __y __asm__("fr1") = (y); \
80 register float __z __asm__("fr2") = (z); \
81 register float __w __asm__("fr3"); \
82 __asm__ __volatile__( \
87 : "f" (__x), "f" (__y), "f" (__z), "f" (__w) \
106 #define vec3f_distance(x1, y1, z1, x2, y2, z2, w) { \
107 register float __x __asm__("fr0") = (x2-x1); \
108 register float __y __asm__("fr1") = (y2-y1); \
109 register float __z __asm__("fr2") = (z2-z1); \
110 register float __w __asm__("fr3"); \
111 __asm__ __volatile__( \
116 : "f" (__x), "f" (__y), "f" (__z), "f" (__w) \
132 #define vec3f_normalize(x, y, z) { \
133 register float __x __asm__("fr0") = x; \
134 register float __y __asm__("fr1") = y; \
135 register float __z __asm__("fr2") = z; \
136 __asm__ __volatile__( \
143 : "=f" (__x), "=f" (__y), "=f" (__z) \
144 : "0" (__x), "1" (__y), "2" (__z) \
146 x = __x; y = __y; z = __z; \
166 #define vec3f_sub_normalize(x1, y1, z1, x2, y2, z2, x3, y3, z3) { \
167 register float __x __asm__("fr0") = x1 - x2; \
168 register float __y __asm__("fr1") = y1 - y2; \
169 register float __z __asm__("fr2") = z1 - z2; \
170 __asm__ __volatile__( \
177 : "=f" (__x), "=f" (__y), "=f" (__z) \
178 : "0" (__x), "1" (__y), "2" (__z) \
180 x3 = __x; y3 = __y; z3 = __z; \
197 #define vec3f_rotr_xy(px, py, pz, cx, cy, cz, r) { \
198 register float __px __asm__("fr0") = px; \
199 register float __py __asm__("fr1") = py; \
200 register float __cx __asm__("fr4") = cx; \
201 register float __cy __asm__("fr5") = cy; \
202 register float __r __asm__("fr6") = r; \
203 register float __s __asm__("fr7") = R_RAD; \
204 __asm__ __volatile__( \
220 : "+f" (__cx), "+f" (__cy) \
221 : "f" (__px), "f" (__py), "f" (__r), "f" (__s) ); \
222 px = __cx; py = __cy; \
239 #define vec3f_rotr_xz(px, py, pz, cx, cy, cz, r) { \
240 register float __px __asm__("fr0") = px; \
241 register float __pz __asm__("fr1") = pz; \
242 register float __cx __asm__("fr4") = cx; \
243 register float __cz __asm__("fr5") = cz; \
244 register float __r __asm__("fr6") = r; \
245 register float __s __asm__("fr7") = R_RAD; \
246 __asm__ __volatile__( \
262 : "+f" (__cx), "+f" (__cz) \
263 : "f" (__px), "f" (__pz), "f" (__r), "f" (__s) ); \
264 px = __cx; pz = __cz; \
281 #define vec3f_rotr_yz(px, py, pz, cx, cy, cz, r) { \
282 register float __py __asm__("fr0") = py; \
283 register float __pz __asm__("fr1") = pz; \
284 register float __cy __asm__("fr4") = cy; \
285 register float __cz __asm__("fr5") = cz; \
286 register float __r __asm__("fr6") = r; \
287 register float __s __asm__("fr7") = R_RAD; \
288 __asm__ __volatile__( \
304 : "+f" (__cy), "+f" (__cz) \
305 : "f" (__py), "f" (__pz), "f" (__r), "f" (__s) ); \
306 py = __cy; pz = __cz; \
323 #define vec3f_rotd_xy(px, py, pz, cx, cy, cz, r) { \
324 register float __px __asm__("fr0") = px; \
325 register float __pz __asm__("fr1") = pz; \
326 register float __cx __asm__("fr4") = cx; \
327 register float __cz __asm__("fr5") = cz; \
328 register float __r __asm__("fr6") = r; \
329 register float __s __asm__("fr7") = R_DEG; \
330 __asm__ __volatile__( \
346 : "+f" (__cx), "+f" (__cz) \
347 : "f" (__px), "f" (__pz), "f" (__r), "f" (__s) ); \
348 px = __cx; pz = __cz; \
365 #define vec3f_rotd_xz(px, py, pz, cx, cy, cz, r) { \
366 register float __px __asm__("fr0") = px; \
367 register float __pz __asm__("fr1") = pz; \
368 register float __cx __asm__("fr4") = cx; \
369 register float __cz __asm__("fr5") = cz; \
370 register float __r __asm__("fr6") = r; \
371 register float __s __asm__("fr7") = R_DEG; \
372 __asm__ __volatile__( \
388 : "+f" (__cx), "+f" (__cz) \
389 : "f" (__px), "f" (__pz), "f" (__r), "f" (__s) ); \
390 px = __cx; pz = __cz; \
407 #define vec3f_rotd_yz(px, py, pz, cx, cy, cz, r) { \
408 register float __py __asm__("fr0") = py; \
409 register float __pz __asm__("fr1") = pz; \
410 register float __cy __asm__("fr4") = cy; \
411 register float __cz __asm__("fr5") = cz; \
412 register float __r __asm__("fr6") = r; \
413 register float __s __asm__("fr7") = R_DEG; \
414 __asm__ __volatile__( \
430 : "+f" (__cy), "+f" (__cz) \
431 : "f" (__py), "f" (__pz), "f" (__r), "f" (__s) ); \
432 py = __cy; pz = __cz; \
float z
Definition: vec3f.h:26
float y
Definition: vec3f.h:26
float x
Definition: vec3f.h:26