ogeom-offset 0.9.9

Offsetting, shelling, sweeping, lofting and draft
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
//! The solid offset and the shells cut from it.
#![allow(clippy::unwrap_used, clippy::expect_used, reason = "test code")]

use ogeom_core::Tolerances;
use ogeom_math::{Frame, Point};
use ogeom_topo::{Filter, ShapeType, explore};

const T: Tolerances = Tolerances::millimetres();

fn fine() -> ogeom_mesh::Deflection {
    ogeom_mesh::Deflection {
        chord: 1e-4,
        ..ogeom_mesh::Deflection::default()
    }
}

fn volume(model: &ogeom_topo::Model, shape: &ogeom_topo::Shape) -> f64 {
    ogeom_algo::volume_properties(model, shape, fine(), T)
        .unwrap()
        .mass
}

#[test]
fn a_box_offset_outward_is_the_bigger_box() {
    let mut model = ogeom_topo::Model::new();
    let block = ogeom_algo::make_box(&mut model, Frame::WORLD, (2.0, 2.0, 2.0), T).unwrap();
    let result = ogeom_offset::offset_shape(&mut model, &block.shape, 0.5, T).unwrap();

    let diagnosis = ogeom_algo::check(&model, &result.shape, T).unwrap();
    assert!(diagnosis.is_valid(), "{:?}", diagnosis.problems);
    let measured = volume(&model, &result.shape);
    assert!(
        (measured - 27.0).abs() < 1e-9,
        "outward box offset volume {measured} against 27"
    );
    // Topology preserved one-for-one.
    let faces = explore(&model, &result.shape, Filter::OfType(ShapeType::Face)).unwrap();
    assert_eq!(faces.len(), 6);
}

#[test]
fn a_box_offset_inward_is_the_smaller_box() {
    let mut model = ogeom_topo::Model::new();
    let block = ogeom_algo::make_box(&mut model, Frame::WORLD, (2.0, 2.0, 2.0), T).unwrap();
    let result = ogeom_offset::offset_shape(&mut model, &block.shape, -0.5, T).unwrap();
    let measured = volume(&model, &result.shape);
    assert!(
        (measured - 1.0).abs() < 1e-9,
        "inward box offset volume {measured} against 1"
    );
}

#[test]
fn a_cylinder_offset_grows_radius_and_caps_alike() {
    let mut model = ogeom_topo::Model::new();
    let drum = ogeom_algo::make_cylinder(&mut model, Frame::WORLD, 1.0, 2.0, T).unwrap();
    let result = ogeom_offset::offset_shape(&mut model, &drum.shape, 0.5, T).unwrap();

    let diagnosis = ogeom_algo::check(&model, &result.shape, T).unwrap();
    assert!(diagnosis.is_valid(), "{:?}", diagnosis.problems);
    let expected = core::f64::consts::PI * 1.5 * 1.5 * 3.0;
    let measured = volume(&model, &result.shape);
    assert!(
        (measured - expected).abs() < 5e-3,
        "cylinder offset volume {measured} against {expected}"
    );
}

#[test]
fn an_offset_that_swallows_the_box_is_refused() {
    let mut model = ogeom_topo::Model::new();
    let block = ogeom_algo::make_box(&mut model, Frame::WORLD, (2.0, 2.0, 2.0), T).unwrap();
    assert!(ogeom_offset::offset_shape(&mut model, &block.shape, -1.5, T).is_err());
}

/// The face of `solid` whose interior contains `probe`.
fn face_at(
    model: &ogeom_topo::Model,
    solid: &ogeom_topo::Shape,
    probe: Point,
) -> ogeom_topo::Shape {
    explore(model, solid, Filter::OfType(ShapeType::Face))
        .unwrap()
        .into_iter()
        .find(|f| {
            ogeom_algo::classify_on_face(model, f, probe, fine(), T)
                .map(|c| c == ogeom_algo::Containment::In)
                .unwrap_or(false)
        })
        .expect("the solid has a face there")
}

#[test]
fn a_shelled_box_keeps_its_walls_and_opens_its_top() {
    let mut model = ogeom_topo::Model::new();
    let block = ogeom_algo::make_box(&mut model, Frame::WORLD, (2.0, 2.0, 2.0), T).unwrap();
    let top = face_at(&model, &block.shape, Point::new(1.0, 1.0, 2.0));

    let t = 0.2;
    let result =
        ogeom_offset::make_thick_solid(&mut model, &block.shape, std::slice::from_ref(&top), t, T)
            .unwrap();

    let diagnosis = ogeom_algo::check(&model, &result.shape, T).unwrap();
    assert!(diagnosis.is_valid(), "{:?}", diagnosis.problems);

    let expected = 8.0 - 1.6 * 1.6 * 1.8;
    let measured = volume(&model, &result.shape);
    assert!(
        (measured - expected).abs() < 1e-9,
        "box shell volume {measured} against {expected}"
    );

    // Five outer walls, the top ring, and five cavity walls.
    let faces = explore(&model, &result.shape, Filter::OfType(ShapeType::Face)).unwrap();
    assert_eq!(faces.len(), 11);
    assert!(result.history.is_deleted(&top));

    // The cavity is real: its centre is outside the material.
    let inside =
        ogeom_algo::classify_in_solid_exact(&model, &result.shape, Point::new(1.0, 1.0, 1.0), T)
            .unwrap();
    assert_eq!(inside, ogeom_algo::Containment::Out);
    // And the wall is material.
    let wall =
        ogeom_algo::classify_in_solid_exact(&model, &result.shape, Point::new(0.1, 1.0, 1.0), T)
            .unwrap();
    assert_eq!(wall, ogeom_algo::Containment::In);
}

#[test]
fn a_shelled_cylinder_becomes_a_cup() {
    let mut model = ogeom_topo::Model::new();
    let drum = ogeom_algo::make_cylinder(&mut model, Frame::WORLD, 1.0, 2.0, T).unwrap();
    let top = face_at(&model, &drum.shape, Point::new(0.0, 0.0, 2.0));

    let t = 0.2;
    let result =
        ogeom_offset::make_thick_solid(&mut model, &drum.shape, std::slice::from_ref(&top), t, T)
            .unwrap();

    let diagnosis = ogeom_algo::check(&model, &result.shape, T).unwrap();
    assert!(diagnosis.is_valid(), "{:?}", diagnosis.problems);

    let pi = core::f64::consts::PI;
    let expected = pi * 2.0 - pi * 0.8 * 0.8 * 1.8;
    let measured = volume(&model, &result.shape);
    assert!(
        (measured - expected).abs() < 1e-3,
        "cup volume {measured} against {expected}"
    );
    assert!(result.history.is_deleted(&top));
}

/// A box with its top edge filleted: the part whose offset meets a partial
/// cylinder, arcs with vertices, and vertices seated on curved faces.
fn filleted_box(model: &mut ogeom_topo::Model) -> ogeom_topo::Shape {
    let block = ogeom_algo::make_box(model, Frame::WORLD, (2.0, 2.0, 2.0), T).unwrap();
    let edge = explore(model, &block.shape, Filter::OfType(ShapeType::Edge))
        .unwrap()
        .into_iter()
        .find(|e| {
            ogeom_algo::edge_vertices(model, e)
                .unwrap()
                .is_some_and(|(a, b)| {
                    let p = |v: &ogeom_topo::Shape| {
                        model
                            .node(v)
                            .and_then(|n| n.data().as_vertex().map(|d| d.point))
                            .unwrap()
                    };
                    let (pa, pb) = (p(&a), p(&b));
                    (pa.x - 2.0).abs() < 1e-9
                        && (pa.z - 2.0).abs() < 1e-9
                        && (pb.x - 2.0).abs() < 1e-9
                        && (pb.z - 2.0).abs() < 1e-9
                })
        })
        .expect("the box has that edge");
    ogeom_fillet::fillet_edge(model, &block.shape, &edge, 0.5, T)
        .unwrap()
        .shape
}

#[test]
fn a_filleted_box_offsets_with_its_blend() {
    let pi = core::f64::consts::PI;
    for (w, side, blend) in [(0.2, 2.4, 0.7), (-0.2, 1.6, 0.3)] {
        let mut model = ogeom_topo::Model::new();
        let part = filleted_box(&mut model);
        let result = ogeom_offset::offset_shape(&mut model, &part, w, T).unwrap();
        let diagnosis = ogeom_algo::check(&model, &result.shape, T).unwrap();
        assert!(diagnosis.is_valid(), "{:?}", diagnosis.problems);
        let expected = side * side * side - (1.0 - pi / 4.0) * blend * blend * side;
        let measured = volume(&model, &result.shape);
        assert!(
            (measured - expected).abs() < 2e-3,
            "offset {w}: volume {measured} against {expected}"
        );
        // Topology preserved: still seven faces.
        assert_eq!(
            explore(&model, &result.shape, Filter::OfType(ShapeType::Face))
                .unwrap()
                .len(),
            7
        );
    }
}

#[test]
fn a_filleted_box_shells_blend_and_all() {
    let mut model = ogeom_topo::Model::new();
    let part = filleted_box(&mut model);
    let bottom = face_at(&model, &part, Point::new(1.0, 1.0, 0.0));
    let t = 0.2;
    let result =
        ogeom_offset::make_thick_solid(&mut model, &part, std::slice::from_ref(&bottom), t, T)
            .unwrap();
    let diagnosis = ogeom_algo::check(&model, &result.shape, T).unwrap();
    assert!(diagnosis.is_valid(), "{:?}", diagnosis.problems);

    let pi = core::f64::consts::PI;
    let outer = 8.0 - (1.0 - pi / 4.0) * 0.25 * 2.0;
    let cavity = 1.6 * 1.6 * 1.8 - (1.0 - pi / 4.0) * 0.09 * 1.6;
    let expected = outer - cavity;
    let measured = volume(&model, &result.shape);
    assert!(
        (measured - expected).abs() < 2e-3,
        "filleted shell volume {measured} against {expected}"
    );
    assert!(result.history.is_deleted(&bottom));
}

#[test]
fn a_cone_offsets_to_the_parallel_cone_apex_and_all() {
    // Base radius 3, height 4: the 3-4-5 cone. Offset by 0.5, the lateral
    // surface becomes the parallel cone, the base drops by the amount, and
    // the apex (a vertex with no normal to offer) lands on the parallel
    // cone's own apex, 0.5 / sin over the old one.
    let mut model = ogeom_topo::Model::new();
    let cone = ogeom_algo::make_cone(&mut model, Frame::WORLD, 3.0, 0.0, 4.0, T).unwrap();
    let result = ogeom_offset::offset_shape(&mut model, &cone.shape, 0.5, T).unwrap();
    let diagnosis = ogeom_algo::check(&model, &result.shape, T).unwrap();
    assert!(diagnosis.is_valid(), "{:?}", diagnosis.problems);

    // Radius 4 at the moved base, apex height 32/6 above it.
    let pi = core::f64::consts::PI;
    let expected = pi / 3.0 * 16.0 * (16.0 / 3.0);
    let measured = volume(&model, &result.shape);
    assert!(
        (measured - expected).abs() < 1e-2,
        "offset cone volume {measured} against {expected}"
    );
    assert_eq!(
        explore(&model, &result.shape, Filter::OfType(ShapeType::Face))
            .unwrap()
            .len(),
        2
    );
    // The apex vertex itself: at 29/6 above the original base plane.
    let apex = explore(&model, &result.shape, Filter::OfType(ShapeType::Vertex))
        .unwrap()
        .into_iter()
        .any(|v| {
            model
                .node(&v)
                .and_then(|n| n.data().as_vertex().map(|d| d.point))
                .is_some_and(|p| (p.z - 29.0 / 6.0).abs() < 1e-6 && p.x.hypot(p.y) < 1e-6)
        });
    assert!(apex, "the apex rode the parallel cone");
}

#[test]
fn a_rim_filleted_cylinder_offsets_with_its_toroidal_band() {
    // The fillet's torus keeps its centre circle and grows its tube, which
    // preserves the tangencies, so the offset part is the rim-filleted
    // version of the offset cylinder, and the same closed form prices it.
    let mut model = ogeom_topo::Model::new();
    let (radius, height, blend, w) = (2.0, 4.0, 0.5, 0.3);
    let drum = ogeom_algo::make_cylinder(&mut model, Frame::WORLD, radius, height, T).unwrap();
    let rim = explore(&model, &drum.shape, Filter::OfType(ShapeType::Edge))
        .unwrap()
        .into_iter()
        .find(|e| {
            ogeom_algo::edge_vertices(&model, e)
                .unwrap()
                .is_some_and(|(a, _)| {
                    model
                        .node(&a)
                        .and_then(|n| n.data().as_vertex().map(|d| d.point))
                        .is_some_and(|p| {
                            (p.z - height).abs() < 1e-9 && (p.x.hypot(p.y) - radius).abs() < 1e-6
                        })
                })
        })
        .expect("the drum has its top rim");
    let part = ogeom_fillet::fillet_edge(&mut model, &drum.shape, &rim, blend, T)
        .unwrap()
        .shape;

    let result = ogeom_offset::offset_shape(&mut model, &part, w, T).unwrap();
    let diagnosis = ogeom_algo::check(&model, &result.shape, T).unwrap();
    assert!(diagnosis.is_valid(), "{:?}", diagnosis.problems);

    let pi = core::f64::consts::PI;
    let (r, h, b) = (radius + w, height + 2.0 * w, blend + w);
    let removed =
        2.0 * pi * (r * b * b - b * b * b / 2.0 - (r - b) * pi * b * b / 4.0 - b * b * b / 3.0);
    let expected = pi * r * r * h - removed;
    let measured = volume(&model, &result.shape);
    assert!(
        (measured - expected).abs() < 5e-3,
        "offset rim-filleted drum volume {measured} against {expected}"
    );
    // Topology preserved: both caps, the wall, and the band.
    assert_eq!(
        explore(&model, &result.shape, Filter::OfType(ShapeType::Face))
            .unwrap()
            .len(),
        4
    );
}

#[test]
fn a_filleted_box_shells_open_at_its_blended_top() {
    // The fillet-then-shell workflow with the opening tangent to its blend:
    // the top face melts into the band along the tangency line, so the
    // kept-in-place cavity would tear the shared vertices. The tangent
    // construction offsets everything together and drills the opening back
    // out; the rim at the tangent side is the tapering strip a true
    // constant-thickness wall has there.
    let mut model = ogeom_topo::Model::new();
    let part = filleted_box(&mut model);
    let top = face_at(&model, &part, Point::new(1.0, 0.5, 2.0));
    let t = 0.2;
    let result =
        ogeom_offset::make_thick_solid(&mut model, &part, std::slice::from_ref(&top), t, T)
            .unwrap();
    let diagnosis = ogeom_algo::check(&model, &result.shape, T).unwrap();
    assert!(diagnosis.is_valid(), "{:?}", diagnosis.problems);

    // Solid minus cavity minus the punched opening above the cavity's top:
    // its cross-section spans to the cavity band's own tangency line.
    let pi = core::f64::consts::PI;
    let solid = 8.0 - (1.0 - pi / 4.0) * 0.25 * 2.0;
    let cavity = 1.6 * 1.6 * 1.6 - (1.0 - pi / 4.0) * 0.09 * 1.6;
    let punched = 1.6 * 1.3 * t;
    let expected = solid - cavity - punched;
    let measured = volume(&model, &result.shape);
    assert!(
        (measured - expected).abs() < 2e-3,
        "tangent shell volume {measured} against {expected}"
    );

    // The wall probed where each regime lives: a side wall, the emptied
    // cavity, the opening, and the tapering rim past the tangency line.
    let probes = [
        (Point::new(0.1, 1.0, 1.0), ogeom_algo::Containment::In),
        (Point::new(1.0, 1.0, 1.0), ogeom_algo::Containment::Out),
        (Point::new(1.0, 1.0, 1.9), ogeom_algo::Containment::Out),
        (Point::new(1.6, 1.0, 1.9), ogeom_algo::Containment::In),
        (Point::new(1.9, 1.0, 1.0), ogeom_algo::Containment::In),
    ];
    for (probe, want) in probes {
        let got = ogeom_algo::classify_in_solid_exact(&model, &result.shape, probe, T).unwrap();
        assert_eq!(got, want, "probe at {probe:?}");
    }
    assert!(result.history.is_deleted(&top));
}

#[test]
fn a_negative_thickness_builds_the_walls_outward() {
    // The box becomes its own cavity: half-unit walls grow around it, the
    // top stays open, and the arithmetic is the outer block less the box
    // that was there.
    let mut model = ogeom_topo::Model::new();
    let block = ogeom_algo::make_box(&mut model, Frame::WORLD, (8.0, 6.0, 4.0), T).unwrap();
    let top = explore(&model, &block.shape, Filter::OfType(ShapeType::Face))
        .unwrap()
        .into_iter()
        .find(|f| {
            let d = model.node(f).and_then(|n| n.data().as_face());
            let Some(d) = d else { return false };
            let Some(ogeom_geom::SurfaceGeometry::Plane(p)) = model.geometry().surface(d.surface)
            else {
                return false;
            };
            let placed = f.transform(model.datums()).unwrap();
            let origin = placed.apply(p.plane().frame().origin());
            let n = placed.apply_vector(p.plane().normal().vector());
            (n.z - 1.0).abs() < 1e-9 && (origin.z - 4.0).abs() < 1e-9
        })
        .expect("the top face");
    let shelled = ogeom_offset::make_thick_solid(
        &mut model,
        &block.shape,
        std::slice::from_ref(&top),
        -0.5,
        T,
    )
    .unwrap();
    let diagnosis = ogeom_algo::check(&model, &shelled.shape, T).unwrap();
    assert!(diagnosis.is_valid(), "{:?}", diagnosis.problems);
    // Outer 9 by 7 by 4.5, less the 8 by 6 by 4 cavity, still open above it.
    let expected = 9.0 * 7.0 * 4.5 - 8.0 * 6.0 * 4.0;
    let measured = volume(&model, &shelled.shape);
    assert!(
        (measured - expected).abs() < 1e-6,
        "outward shell volume {measured} against {expected}"
    );
}

/// The arc join: 1 mm walls grown outward round a 20 x 20 x 10 block open
/// at the top are the block's rolling-ball parallel body cut at the top,
/// less the block: a cylinder of the wall's thickness about every vertical
/// and bottom edge, a ball's eighth at each bottom corner. Inward, round a
/// convex block, the arc join is the intersection join.
#[test]
fn a_thickness_joins_its_walls_by_intersection_or_arc() {
    use ogeom_offset::{Join, make_thick_solid_with};
    let top_of = |model: &ogeom_topo::Model, block: &ogeom_topo::Shape| {
        explore(model, block, Filter::OfType(ShapeType::Face))
            .unwrap()
            .into_iter()
            .find(|f| {
                let b = ogeom_algo::shape_bounds(model, f, T).unwrap();
                (b.low().unwrap().z - 10.0).abs() < 1e-6
            })
            .expect("the top face")
    };
    let pi = core::f64::consts::PI;
    for (thickness, join, want) in [
        (-1.0, Join::Arc, 1200.0 + 30.0 * pi + 2.0 / 3.0 * pi),
        (-1.0, Join::Intersection, 22.0 * 22.0 * 11.0 - 4000.0),
        (1.0, Join::Arc, 4000.0 - 18.0 * 18.0 * 9.0),
    ] {
        let mut model = ogeom_topo::Model::new();
        let block = ogeom_algo::make_box(&mut model, Frame::WORLD, (20.0, 20.0, 10.0), T)
            .unwrap()
            .shape;
        let top = top_of(&model, &block);
        let shelled = make_thick_solid_with(
            &mut model,
            &block,
            std::slice::from_ref(&top),
            thickness,
            join,
            T,
        )
        .unwrap_or_else(|e| panic!("{thickness} {join:?}: {e}"));
        let diagnosis = ogeom_algo::check(&model, &shelled.shape, T).unwrap();
        assert!(
            diagnosis.is_valid(),
            "{thickness} {join:?}: {:?}",
            diagnosis.problems
        );
        let measured = volume(&model, &shelled.shape);
        assert!(
            (measured - want).abs() < want * 1e-4,
            "{thickness} {join:?}: {measured} against {want}"
        );
    }
}

/// A solid moved by a location offsets, shells and moves its faces where
/// it stands, as the same solid built there does.
#[test]
fn a_located_solid_is_edited_where_it_stands() {
    let located = |model: &mut ogeom_topo::Model| {
        let block = ogeom_algo::make_box(model, Frame::WORLD, (2.0, 2.0, 2.0), T)
            .unwrap()
            .shape;
        model.placed(
            &block,
            ogeom_math::Transform::translation(ogeom_math::Vector::new(5.0, 0.0, 0.0)),
        )
    };
    let holds = |model: &ogeom_topo::Model, built: &ogeom_algo::Built, want: f64| {
        assert!(
            ogeom_algo::check(model, &built.shape, T)
                .unwrap()
                .is_valid()
        );
        let got = volume(model, &built.shape);
        assert!((got - want).abs() < 1e-9, "{got} against {want}");
        let bounds = ogeom_algo::shape_bounds(model, &built.shape, T).unwrap();
        assert!(bounds.low().unwrap().x > 4.0, "{bounds:?}");
    };
    let mut model = ogeom_topo::Model::new();
    let block = located(&mut model);
    let grown = ogeom_offset::offset_shape(&mut model, &block, 0.2, T).unwrap();
    holds(&model, &grown, 2.4_f64.powi(3));

    let mut model = ogeom_topo::Model::new();
    let block = located(&mut model);
    let top = face_at(&model, &block, Point::new(6.0, 1.0, 2.0));
    let shell = ogeom_offset::make_thick_solid(&mut model, &block, &[top], 0.2, T).unwrap();
    holds(&model, &shell, 8.0 - 1.6 * 1.6 * 1.8);

    let mut model = ogeom_topo::Model::new();
    let block = located(&mut model);
    let top = face_at(&model, &block, Point::new(6.0, 1.0, 2.0));
    let lift = ogeom_math::Transform::translation(ogeom_math::Vector::new(0.0, 0.0, 0.5));
    let raised = ogeom_offset::move_faces(&mut model, &block, &[top], &lift, T).unwrap();
    holds(&model, &raised, 10.0);
}

/// An offset or a wall that passes through the part is refused, not built
/// inside out.
#[test]
fn an_offset_through_the_part_is_refused() {
    for depth in [1.05, 1.2, 1.49] {
        let mut model = ogeom_topo::Model::new();
        let block = ogeom_algo::make_box(&mut model, Frame::WORLD, (2.0, 3.0, 4.0), T)
            .unwrap()
            .shape;
        assert!(ogeom_offset::offset_shape(&mut model, &block, -depth, T).is_err());
        let top = face_at(&model, &block, Point::new(1.0, 1.5, 4.0));
        assert!(ogeom_offset::make_thick_solid(&mut model, &block, &[top], depth, T).is_err());
        assert!(ogeom_offset::make_thick_solid(&mut model, &block, &[], depth, T).is_err());
    }
}