1use std::sync::Arc;
6
7use super::SdfNode;
8
9impl SdfNode {
10 #[must_use]
14 #[inline]
15 pub fn union(self, other: Self) -> Self {
16 Self::Union {
17 a: Arc::new(self),
18 b: Arc::new(other),
19 }
20 }
21
22 #[must_use]
24 #[inline]
25 pub fn intersection(self, other: Self) -> Self {
26 Self::Intersection {
27 a: Arc::new(self),
28 b: Arc::new(other),
29 }
30 }
31
32 #[must_use]
34 #[inline]
35 pub fn subtract(self, other: Self) -> Self {
36 Self::Subtraction {
37 a: Arc::new(self),
38 b: Arc::new(other),
39 }
40 }
41
42 #[must_use]
44 #[inline]
45 pub fn smooth_union(self, other: Self, k: f32) -> Self {
46 Self::SmoothUnion {
47 a: Arc::new(self),
48 b: Arc::new(other),
49 k,
50 }
51 }
52
53 #[must_use]
55 #[inline]
56 pub fn smooth_intersection(self, other: Self, k: f32) -> Self {
57 Self::SmoothIntersection {
58 a: Arc::new(self),
59 b: Arc::new(other),
60 k,
61 }
62 }
63
64 #[must_use]
66 #[inline]
67 pub fn smooth_subtract(self, other: Self, k: f32) -> Self {
68 Self::SmoothSubtraction {
69 a: Arc::new(self),
70 b: Arc::new(other),
71 k,
72 }
73 }
74
75 #[must_use]
77 #[inline]
78 pub fn chamfer_union(self, other: Self, r: f32) -> Self {
79 Self::ChamferUnion {
80 a: Arc::new(self),
81 b: Arc::new(other),
82 r,
83 }
84 }
85
86 #[must_use]
88 #[inline]
89 pub fn chamfer_intersection(self, other: Self, r: f32) -> Self {
90 Self::ChamferIntersection {
91 a: Arc::new(self),
92 b: Arc::new(other),
93 r,
94 }
95 }
96
97 #[must_use]
99 #[inline]
100 pub fn chamfer_subtract(self, other: Self, r: f32) -> Self {
101 Self::ChamferSubtraction {
102 a: Arc::new(self),
103 b: Arc::new(other),
104 r,
105 }
106 }
107
108 #[must_use]
110 #[inline]
111 pub fn stairs_union(self, other: Self, r: f32, n: f32) -> Self {
112 Self::StairsUnion {
113 a: Arc::new(self),
114 b: Arc::new(other),
115 r,
116 n,
117 }
118 }
119
120 #[must_use]
122 #[inline]
123 pub fn stairs_intersection(self, other: Self, r: f32, n: f32) -> Self {
124 Self::StairsIntersection {
125 a: Arc::new(self),
126 b: Arc::new(other),
127 r,
128 n,
129 }
130 }
131
132 #[must_use]
134 #[inline]
135 pub fn stairs_subtract(self, other: Self, r: f32, n: f32) -> Self {
136 Self::StairsSubtraction {
137 a: Arc::new(self),
138 b: Arc::new(other),
139 r,
140 n,
141 }
142 }
143
144 #[must_use]
146 #[inline]
147 pub fn xor(self, other: Self) -> Self {
148 Self::XOR {
149 a: Arc::new(self),
150 b: Arc::new(other),
151 }
152 }
153
154 #[must_use]
156 #[inline]
157 pub fn morph(self, other: Self, t: f32) -> Self {
158 Self::Morph {
159 a: Arc::new(self),
160 b: Arc::new(other),
161 t,
162 }
163 }
164
165 #[must_use]
167 #[inline]
168 pub fn columns_union(self, other: Self, r: f32, n: f32) -> Self {
169 Self::ColumnsUnion {
170 a: Arc::new(self),
171 b: Arc::new(other),
172 r,
173 n,
174 }
175 }
176
177 #[must_use]
179 #[inline]
180 pub fn columns_intersection(self, other: Self, r: f32, n: f32) -> Self {
181 Self::ColumnsIntersection {
182 a: Arc::new(self),
183 b: Arc::new(other),
184 r,
185 n,
186 }
187 }
188
189 #[must_use]
191 #[inline]
192 pub fn columns_subtract(self, other: Self, r: f32, n: f32) -> Self {
193 Self::ColumnsSubtraction {
194 a: Arc::new(self),
195 b: Arc::new(other),
196 r,
197 n,
198 }
199 }
200
201 #[must_use]
203 #[inline]
204 pub fn pipe(self, other: Self, r: f32) -> Self {
205 Self::Pipe {
206 a: Arc::new(self),
207 b: Arc::new(other),
208 r,
209 }
210 }
211
212 #[must_use]
214 #[inline]
215 pub fn engrave(self, other: Self, r: f32) -> Self {
216 Self::Engrave {
217 a: Arc::new(self),
218 b: Arc::new(other),
219 r,
220 }
221 }
222
223 #[must_use]
225 #[inline]
226 pub fn groove(self, other: Self, ra: f32, rb: f32) -> Self {
227 Self::Groove {
228 a: Arc::new(self),
229 b: Arc::new(other),
230 ra,
231 rb,
232 }
233 }
234
235 #[must_use]
237 #[inline]
238 pub fn tongue(self, other: Self, ra: f32, rb: f32) -> Self {
239 Self::Tongue {
240 a: Arc::new(self),
241 b: Arc::new(other),
242 ra,
243 rb,
244 }
245 }
246
247 #[must_use]
249 #[inline]
250 pub fn exp_smooth_union(self, other: Self, k: f32) -> Self {
251 Self::ExpSmoothUnion {
252 a: Arc::new(self),
253 b: Arc::new(other),
254 k,
255 }
256 }
257
258 #[must_use]
260 #[inline]
261 pub fn exp_smooth_intersection(self, other: Self, k: f32) -> Self {
262 Self::ExpSmoothIntersection {
263 a: Arc::new(self),
264 b: Arc::new(other),
265 k,
266 }
267 }
268
269 #[must_use]
271 #[inline]
272 pub fn exp_smooth_subtract(self, other: Self, k: f32) -> Self {
273 Self::ExpSmoothSubtraction {
274 a: Arc::new(self),
275 b: Arc::new(other),
276 k,
277 }
278 }
279}