Skip to content

Commit baa3be1

Browse files
committed
fmt
1 parent bd40c43 commit baa3be1

2 files changed

Lines changed: 29 additions & 61 deletions

File tree

iOverlay/src/core/extract.rs

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,13 @@ impl OverlayGraph<'_> {
121121
let direction = is_hole == clockwise;
122122
let start_data = StartPathData::new(direction, link, left_top_link);
123123

124-
self.find_contour(&start_data, direction, visited_state, &mut buffer.visited, &mut buffer.points);
124+
self.find_contour(
125+
&start_data,
126+
direction,
127+
visited_state,
128+
&mut buffer.visited,
129+
&mut buffer.points,
130+
);
125131
let (is_valid, is_modified) = buffer.points.validate(
126132
self.options.min_output_area,
127133
self.options.preserve_output_collinear,
@@ -190,14 +196,7 @@ impl OverlayGraph<'_> {
190196

191197
// Find a closed tour
192198
while node_id != last_node_id {
193-
link_id = GraphUtil::next_link(
194-
self.links,
195-
self.nodes,
196-
link_id,
197-
node_id,
198-
clockwise,
199-
&visited,
200-
);
199+
link_id = GraphUtil::next_link(self.links, self.nodes, link_id, node_id, clockwise, &visited);
201200

202201
let link = unsafe {
203202
// Safety: `link_id` is always derived from a previous in-bounds index or
@@ -244,7 +243,13 @@ impl OverlayGraph<'_> {
244243
let direction = is_hole == clockwise;
245244
let start_data = StartPathData::new(direction, link, left_top_link);
246245

247-
self.find_contour(&start_data, direction, visited_state, &mut buffer.visited, &mut buffer.points);
246+
self.find_contour(
247+
&start_data,
248+
direction,
249+
visited_state,
250+
&mut buffer.visited,
251+
&mut buffer.points,
252+
);
248253
let (is_valid, _) = buffer.points.validate(
249254
self.options.min_output_area,
250255
self.options.preserve_output_collinear,

iOverlay/tests/ocg_tests.rs

Lines changed: 14 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,7 @@ mod tests {
7575
let mut opts = IntOverlayOptions::ogc();
7676
opts.output_direction = ContourDirection::Clockwise;
7777

78-
let mut overlay = Overlay::with_contours_custom(
79-
&subj_paths,
80-
&clip_paths,
81-
opts,
82-
Default::default(),
83-
);
78+
let mut overlay = Overlay::with_contours_custom(&subj_paths, &clip_paths, opts, Default::default());
8479

8580
let result = overlay.overlay(OverlayRule::Difference, FillRule::EvenOdd);
8681

@@ -196,12 +191,8 @@ mod tests {
196191

197192
let subj_paths = int_shape![[[0, 3], [0, 0], [3, 0], [3, 2], [1, 2], [1, 1], [2, 1], [2, 3]]];
198193

199-
let mut overlay = Overlay::with_contours_custom(
200-
&subj_paths,
201-
&[],
202-
IntOverlayOptions::ogc(),
203-
Default::default(),
204-
);
194+
let mut overlay =
195+
Overlay::with_contours_custom(&subj_paths, &[], IntOverlayOptions::ogc(), Default::default());
205196

206197
let result = overlay.overlay(OverlayRule::Union, FillRule::EvenOdd);
207198

@@ -224,14 +215,9 @@ mod tests {
224215
// │ │
225216
// 0 └───────────────┘
226217

227-
let subj_paths = int_shape![
228-
[[0, 4], [0, 0], [4, 0], [4, 3], [3, 3], [3, 4]]
229-
];
218+
let subj_paths = int_shape![[[0, 4], [0, 0], [4, 0], [4, 3], [3, 3], [3, 4]]];
230219

231-
let clip_paths = int_shape![
232-
[[1, 2], [1, 1], [2, 1], [2, 2]],
233-
[[2, 3], [2, 2], [3, 2], [3, 3]],
234-
];
220+
let clip_paths = int_shape![[[1, 2], [1, 1], [2, 1], [2, 2]], [[2, 3], [2, 2], [3, 2], [3, 3]],];
235221

236222
let mut overlay = Overlay::with_contours_custom(
237223
&subj_paths,
@@ -262,14 +248,9 @@ mod tests {
262248
// │ │
263249
// 0 └───────────────┘
264250

265-
let subj_paths = int_shape![
266-
[[0, 4], [0, 0], [4, 0], [4, 4]]
267-
];
251+
let subj_paths = int_shape![[[0, 4], [0, 0], [4, 0], [4, 4]]];
268252

269-
let clip_paths = int_shape![
270-
[[1, 2], [1, 1], [2, 1], [2, 2]],
271-
[[2, 3], [2, 2], [3, 2], [3, 3]],
272-
];
253+
let clip_paths = int_shape![[[1, 2], [1, 1], [2, 1], [2, 2]], [[2, 3], [2, 2], [3, 2], [3, 3]],];
273254

274255
let mut overlay = Overlay::with_contours_custom(
275256
&subj_paths,
@@ -300,24 +281,14 @@ mod tests {
300281
// │ │
301282
// 0 └───────────────┘
302283

303-
let subj_paths = int_shape![
304-
[[0, 4], [0, 0], [4, 0], [4, 4]]
305-
];
284+
let subj_paths = int_shape![[[0, 4], [0, 0], [4, 0], [4, 4]]];
306285

307-
let clip_paths = int_shape![
308-
[[1, 2], [1, 1], [2, 1], [2, 2]],
309-
[[2, 3], [2, 2], [3, 2], [3, 3]],
310-
];
286+
let clip_paths = int_shape![[[1, 2], [1, 1], [2, 1], [2, 2]], [[2, 3], [2, 2], [3, 2], [3, 3]],];
311287

312288
let mut opts = IntOverlayOptions::ogc();
313289
opts.output_direction = ContourDirection::Clockwise;
314290

315-
let mut overlay = Overlay::with_contours_custom(
316-
&subj_paths,
317-
&clip_paths,
318-
opts,
319-
Default::default(),
320-
);
291+
let mut overlay = Overlay::with_contours_custom(&subj_paths, &clip_paths, opts, Default::default());
321292

322293
let result = overlay.overlay(OverlayRule::Difference, FillRule::EvenOdd);
323294

@@ -346,12 +317,8 @@ mod tests {
346317
[[1, 3], [1, 2], [2, 2], [2, 3]],
347318
];
348319

349-
let mut overlay = Overlay::with_contours_custom(
350-
&subj_paths,
351-
&[],
352-
IntOverlayOptions::ogc(),
353-
Default::default(),
354-
);
320+
let mut overlay =
321+
Overlay::with_contours_custom(&subj_paths, &[], IntOverlayOptions::ogc(), Default::default());
355322

356323
let result = overlay.overlay(OverlayRule::Union, FillRule::EvenOdd);
357324

@@ -373,12 +340,8 @@ mod tests {
373340
[[-1, -2], [-2, -1], [0, 0], [1, 2], [2, 1], [0, 0]],
374341
];
375342

376-
let mut overlay = Overlay::with_contours_custom(
377-
&subj_paths,
378-
&[],
379-
IntOverlayOptions::ogc(),
380-
Default::default(),
381-
);
343+
let mut overlay =
344+
Overlay::with_contours_custom(&subj_paths, &[], IntOverlayOptions::ogc(), Default::default());
382345

383346
let result = overlay.overlay(OverlayRule::Union, FillRule::EvenOdd);
384347

0 commit comments

Comments
 (0)