Table of Contents

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

Center Vector3

Center of the sphere in 3-space.

Radius float

Radius of the sphere.

Properties

Center

Center of the sphere in 3-space.

public Vector3 Center { get; init; }

Property Value

Vector3

Radius

Radius of the sphere.

public float Radius { get; init; }

Property Value

float

SurfaceArea

Surface area of the sphere: 4 * pi * r^2.

public float SurfaceArea { get; }

Property Value

float

Volume

Volume of the sphere: 4 / 3 * pi * r^3.

public float Volume { get; }

Property Value

float