Import std.math.geometry
Sphere
struct
Public Struct Sphere Implements Equatable, Printable
A ball: the points no further from its Center than its Radius.
Examples
Local ball = Sphere(Vec3(0, 0, 0), 1)
Expect(ball.Contains(Vec3(0.5, 0, 0)))
Expect(ball.Raycast(Ray(Vec3(0, 0, 5), Vec3(0, 0, -1))) == 4.0)std/math/geometry.fb, line 265
-
The point in its middle.
-
How far its surface is from its Center.
-
Whether the
pointis in the sphere or on its surface, by squares in Doubles, which no Float's square overflows. -
Whether the two have a point in common, by squares in Doubles.
-
Whether the
boxand the sphere have a point in common. -
How far along the
rayit first meets the sphere, worked out in Doubles from where theraycomes nearest the center, as Ray Tracing Gems' chapter 7 has it, so a sphere far off or small, or a short Direction, loses nothing to rounding. -
Its parts, as "Sphere((0, 0, 0), 1)".
Report an issue with this page or with FutureBlitz on GitHub.