Voxvision  1
Creating and manipulating voxel octrees
voxvision.h
Go to the documentation of this file.
1 
6 #ifndef VOXVISION_H
7 #define VOXVISION_H
8 
9 #define VOX_MODULE_PATH "/usr/local/share/voxvision/modules/"
10 #define VOX_DATA_PATH "/usr/local/share/voxvision/data/"
11 
15 #define SSE_INTRIN
16 
17 #define VOX_VERSION_MAJOR 0
18 #define VOX_VERSION_MINOR 34
19 #define VOX_VERSION "0.34"
20 #define VOX_EXPORT __attribute__((visibility ("default")))
21 
22 // Types
23 /*
24  Data type layout:
25  1) vox_dot
26 
27  ----+---+---+------
28  | | | | |
29  | x | y | z | XXX |
30  | | | | |
31  ----+---+---+------
32 
33  0..........96....128
34 
35  2) vox_quat
36 
37  ----+---+---+----
38  | | | | |
39  | 1 | i | j | k |
40  | | | | |
41  ----+---+---+----
42  0..............128
43 */
44 
45 #if defined(SSE_INTRIN)
46 #include <xmmintrin.h>
47 #include <smmintrin.h>
48 typedef float vox_dot[4] __attribute__ ((aligned (16)));
49 typedef float vox_quat[4] __attribute__ ((aligned (16)));
50 #define vox_alloc(size) aligned_alloc (16, ((size) + 0xf) & ~(size_t)0xf);
51 #define vox_dot_copy(d1, d2) _mm_store_ps (d1, _mm_load_ps (d2))
52 #define vox_dot_equalp(d1, d2) !(_mm_movemask_ps (_mm_load_ps (d1) != _mm_load_ps(d2)) & 7)
53 #define vox_dot_set(dot, x, y, z) _mm_store_ps (dot, _mm_set_ps (0, z, y, x))
54 #define vox_quat_copy(q1, q2) _mm_store_ps (q1, _mm_load_ps (q2))
55 #define vox_quat_set(q, w, i, j, k) _mm_store_ps (q, _mm_set_ps (k, j, i, w))
56 #else
57 typedef float vox_dot[3];
58 typedef float vox_quat[4];
59 #define vox_alloc(size) malloc (size)
60 #define vox_dot_copy(d1, d2) memcpy (d1, d2, sizeof (vox_dot))
61 #define vox_dot_set(dot, x, y, z) do { \
62  dot[0] = x; \
63  dot[1] = y; \
64  dot[2] = z; \
65  } while (0)
66 #define vox_dot_equalp(d1, d2) (memcmp (d1, d2, sizeof (vox_dot)) == 0)
67 #define vox_quat_copy(q1, q2) memcpy (q1, q2, sizeof (vox_quat))
68 #define vox_quat_set(q, w, i, j, k) do { \
69  q[0] = w; \
70  q[1] = i; \
71  q[2] = j; \
72  q[3] = k; \
73  } while (0)
74 #endif
75 
79 struct vox_box
80 {
81  vox_dot min;
82  vox_dot max;
83 };
84 #include <string.h>
85 #define vox_box_copy(b1, b2) memcpy ((b1), (b2), sizeof (struct vox_box))
86 
87 #endif
Structure representing a box.
Definition: voxvision.h:80
vox_dot max
maximal coordinate
Definition: voxvision.h:82
vox_dot min
minimal coordinate
Definition: voxvision.h:81