MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/Imath / sphere3_example

Function sphere3_example

website/examples/Sphere3.cpp:4–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2#include <cassert>
3
4void
5sphere3_example ()
6{
7 Imath::V3f center (1.0f, 1.0f, 1.0f);
8 float radius = 2.0f;
9 Imath::Sphere3f s (center, radius);
10
11 assert (s.center == center);
12 assert (s.radius == radius);
13
14 Imath::Line3f line (
15 Imath::V3f (0.0f, 0.0f, 0.0f), Imath::V3f (1.0f, 1.0f, 1.0f));
16
17 Imath::V3f v;
18 assert (s.intersect (line, v));
19
20 assert (
21 v.equalWithAbsError (Imath::V3f (2.1547f, 2.1547f, 2.1547f), 1e-6f));
22}

Callers 1

mainFunction · 0.85

Calls 2

intersectMethod · 0.80
equalWithAbsErrorMethod · 0.80

Tested by

no test coverage detected