Sphere Unit { get; set; }

robot_2Generated
code_blocksInput

Description

The Unit property of the Sphere struct represents a standard unit sphere. This sphere is centered at the origin of the coordinate system and has a radius of 1. It is a static property, meaning it is shared across all instances of the Sphere struct and can be accessed without creating an instance of Sphere.

Usage

Use the Unit property when you need a reference to a standard unit sphere in your calculations or simulations. This can be particularly useful in scenarios involving physics simulations, collision detection, or any geometric computations where a unit sphere is required.

Example

// Accessing the Unit sphere
Sphere unitSphere = Sphere.Unit;

// Example usage: Checking if a point is inside the unit sphere
Vector3 point = new Vector3(0.5f, 0.5f, 0.5f);
bool isInside = unitSphere.Contains(ref point);

// Example usage: Tracing a ray against the unit sphere
Ray ray = new Ray(Vector3.Zero, Vector3.One);
float distance;
bool hit = unitSphere.Trace(ray, 100.0f, out distance);