Commit efe2f95e6eb6ab7191c6431064ed193f91bb5c98
1 parent
945ee13c
changes needed to compile and run the bimsim code
Showing
138 changed files
with
137 additions
and
25 deletions
Show diff stats
Too many changes.
To preserve performance only 100 of 138 files are displayed.
1 | -#ifndef RTS_QUAD_H | |
2 | -#define RTS_QUAD_H | |
1 | +#ifndef STIM_QUAD_H | |
2 | +#define STIM_QUAD_H | |
3 | 3 | |
4 | 4 | //enable CUDA_CALLABLE macro |
5 | -#include <stim/cuda/callable.h> | |
5 | +#include <stim/cuda/cudatools/callable.h> | |
6 | 6 | #include <stim/math/vector.h> |
7 | 7 | #include <stim/math/triangle.h> |
8 | 8 | #include <stim/math/quaternion.h> |
... | ... | @@ -13,7 +13,7 @@ |
13 | 13 | namespace stim{ |
14 | 14 | |
15 | 15 | //template for a quadangle class in ND space |
16 | -template <class T, int N = 3> | |
16 | +template <class T> | |
17 | 17 | struct quad |
18 | 18 | { |
19 | 19 | /* |
... | ... | @@ -30,9 +30,9 @@ struct quad |
30 | 30 | T B[N]; |
31 | 31 | T C[N];*/ |
32 | 32 | |
33 | - rts::vec<T, N> A; | |
34 | - rts::vec<T, N> X; | |
35 | - rts::vec<T, N> Y; | |
33 | + stim::vec<T> A; | |
34 | + stim::vec<T> X; | |
35 | + stim::vec<T> Y; | |
36 | 36 | |
37 | 37 | |
38 | 38 | CUDA_CALLABLE quad() |
... | ... | @@ -40,7 +40,7 @@ struct quad |
40 | 40 | |
41 | 41 | } |
42 | 42 | |
43 | - CUDA_CALLABLE quad(vec<T, N> a, vec<T, N> b, vec<T, N> c) | |
43 | + CUDA_CALLABLE quad(vec<T> a, vec<T> b, vec<T> c) | |
44 | 44 | { |
45 | 45 | |
46 | 46 | A = a; |
... | ... | @@ -52,20 +52,20 @@ struct quad |
52 | 52 | /******************************************************************* |
53 | 53 | Constructor - create a quad from a position, normal, and rotation |
54 | 54 | *******************************************************************/ |
55 | - CUDA_CALLABLE quad(rts::vec<T, N> c, rts::vec<T, N> normal, T width, T height, T theta) | |
55 | + CUDA_CALLABLE quad(stim::vec<T> c, stim::vec<T> normal, T width, T height, T theta) | |
56 | 56 | { |
57 | 57 | |
58 | 58 | //compute the X direction - start along world-space X |
59 | - Y = rts::vec<T, N>(0, 1, 0); | |
59 | + Y = stim::vec<T>(0, 1, 0); | |
60 | 60 | if(Y == normal) |
61 | - Y = rts::vec<T, N>(0, 0, 1); | |
61 | + Y = stim::vec<T>(0, 0, 1); | |
62 | 62 | |
63 | 63 | X = Y.cross(normal).norm(); |
64 | 64 | |
65 | 65 | std::cout<<X<<std::endl; |
66 | 66 | |
67 | 67 | //rotate the X axis by theta radians |
68 | - rts::quaternion<T> q; | |
68 | + stim::quaternion<T> q; | |
69 | 69 | q.CreateRotation(theta, normal); |
70 | 70 | X = q.toMatrix3() * X; |
71 | 71 | Y = normal.cross(X); |
... | ... | @@ -85,7 +85,7 @@ struct quad |
85 | 85 | } |
86 | 86 | |
87 | 87 | //boolean comparison |
88 | - bool operator==(const quad<T, N> & rhs) | |
88 | + bool operator==(const quad<T> & rhs) | |
89 | 89 | { |
90 | 90 | if(A == rhs.A && X == rhs.X && Y == rhs.Y) |
91 | 91 | return true; |
... | ... | @@ -96,21 +96,21 @@ struct quad |
96 | 96 | /******************************************* |
97 | 97 | Return the normal for the quad |
98 | 98 | *******************************************/ |
99 | - CUDA_CALLABLE rts::vec<T, N> n() | |
99 | + CUDA_CALLABLE stim::vec<T> n() | |
100 | 100 | { |
101 | 101 | return (X.cross(Y)).norm(); |
102 | 102 | } |
103 | 103 | |
104 | - CUDA_CALLABLE rts::vec<T, N> p(T a, T b) | |
104 | + CUDA_CALLABLE stim::vec<T> p(T a, T b) | |
105 | 105 | { |
106 | - rts::vec<T, N> result; | |
106 | + stim::vec<T> result; | |
107 | 107 | //given the two parameters a, b = [0 1], returns the position in world space |
108 | 108 | result = A + X * a + Y * b; |
109 | 109 | |
110 | 110 | return result; |
111 | 111 | } |
112 | 112 | |
113 | - CUDA_CALLABLE rts::vec<T, N> operator()(T a, T b) | |
113 | + CUDA_CALLABLE stim::vec<T> operator()(T a, T b) | |
114 | 114 | { |
115 | 115 | return p(a, b); |
116 | 116 | } |
... | ... | @@ -127,15 +127,15 @@ struct quad |
127 | 127 | |
128 | 128 | } |
129 | 129 | |
130 | - CUDA_CALLABLE quad<T, N> operator*(T rhs) | |
130 | + CUDA_CALLABLE quad<T> operator*(T rhs) | |
131 | 131 | { |
132 | 132 | //scales the plane by a scalar value |
133 | 133 | |
134 | 134 | //compute the center point |
135 | - rts::vec<T, N> c = A + X*0.5f + Y*0.5f; | |
135 | + stim::vec<T> c = A + X*0.5f + Y*0.5f; | |
136 | 136 | |
137 | 137 | //create the new quadangle |
138 | - quad<T, N> result; | |
138 | + quad<T> result; | |
139 | 139 | result.X = X * rhs; |
140 | 140 | result.Y = Y * rhs; |
141 | 141 | result.A = c - result.X*0.5f - result.Y*0.5f; |
... | ... | @@ -144,7 +144,7 @@ struct quad |
144 | 144 | |
145 | 145 | } |
146 | 146 | |
147 | - CUDA_CALLABLE T dist(vec<T, N> p) | |
147 | + CUDA_CALLABLE T dist(vec<T> p) | |
148 | 148 | { |
149 | 149 | //compute the distance between a point and this quad |
150 | 150 | |
... | ... | @@ -162,7 +162,7 @@ struct quad |
162 | 162 | return d1; |
163 | 163 | } |
164 | 164 | |
165 | - CUDA_CALLABLE T dist_max(vec<T, N> p) | |
165 | + CUDA_CALLABLE T dist_max(vec<T> p) | |
166 | 166 | { |
167 | 167 | T da = (A - p).len(); |
168 | 168 | T db = (A+X - p).len(); |
... | ... | @@ -176,7 +176,7 @@ struct quad |
176 | 176 | } //end namespace rts |
177 | 177 | |
178 | 178 | template <typename T, int N> |
179 | -std::ostream& operator<<(std::ostream& os, rts::quad<T, N> R) | |
179 | +std::ostream& operator<<(std::ostream& os, stim::quad<T> R) | |
180 | 180 | { |
181 | 181 | os<<R.str(); |
182 | 182 | return os; | ... | ... |
1 | +[General] | ... | ... |
No preview for this file type