Struct Sphere
- Namespace
- MathAssertions.Geometry3D
- Assembly
- MathAssertions.dll
Sphere defined by center and radius. The radius is intended to be non-negative; the computed properties remain well-defined as polynomials in the radius for negative values, but the verdict is signed for Volume (the cubic in the radius flips sign) and unsigned for SurfaceArea (the quadratic in the radius is always non-negative). Validation of the radius is left to the caller.
public readonly record struct Sphere : IEquatable<Sphere>
- Implements
- Inherited Members
- Extension Methods
Constructors
Sphere(Vector3, float)
Sphere defined by center and radius. The radius is intended to be non-negative; the computed properties remain well-defined as polynomials in the radius for negative values, but the verdict is signed for Volume (the cubic in the radius flips sign) and unsigned for SurfaceArea (the quadratic in the radius is always non-negative). Validation of the radius is left to the caller.
public Sphere(Vector3 Center, float Radius)
Parameters
Properties
Center
Center of the sphere in 3-space.
public Vector3 Center { get; init; }
Property Value
Radius
Radius of the sphere.
public float Radius { get; init; }
Property Value
SurfaceArea
Surface area of the sphere: 4 * pi * r^2.
public float SurfaceArea { get; }
Property Value
Volume
Volume of the sphere: 4 / 3 * pi * r^3.
public float Volume { get; }