Sphere

Description

struct Tinman.Core.Math.Sphere

Represents a sphere in 3D space.

Public / Constants

Undefined


public static readonly attribute Undefined → (Sphere)

An undefined sphere.

Zero


public static readonly attribute Zero → (Sphere)

A sphere with radius zero, centered at the coordinate origin.

Public / Constructors

Sphere

2 overloads


public constructor Sphere1 → (1)

radius in : float64

The sphere radius. If less than zero, the sphere will be undefined.

Creates a new instance of Sphere.


public constructor Sphere2 → (2)

center in : Vec3D

The sphere center.

radius in : float64

[>=0]
The sphere radius.

Creates a new instance of Sphere.

Public / Methods

Contains

2 overloads


[Pure]
public method Contains1 → (1)

sphere in : Sphere

The sphere to test.

returns → bool

true if the given sphere is contained in this one,
false if not.

Checks if this sphere contains the given one.


[Pure]
public method Contains2 → (2)

center in : Vec3D

Center of the sphere to test.

radius opt : float64 = 0

Radius of the sphere to test.

returns → bool

true if the given sphere is contained in this one,
false if not.

Checks if this sphere contains the given one.

Distance​Range


[Pure]
public method DistanceRange → (1)

point in : Vec3D

The point.

returns → RangeD

The distance range.

Computes the distance between the given point in and this sphere.

Dot


[Pure]
public method Dot → (2)

origin in : Vec3D

The origin point.

direction in : Vec3D

The unit-length direction vector.

returns → RangeD

The dot product range.

Computes the dot product range of this sphere.

The dot product range is defined as follows:

dot    = dot(Center - origin, direction)
result = [-dot .. +dot]

Grow

2 overloads


[Pure]
public method Grow1 → (1)

sphere in : Sphere

The sphere to contain.

returns → Sphere

The resulting sphere.

Grows this sphere so that it contains the given one.

If this sphere is undefined, the given sphere in will be returned.


[Pure]
public method Grow2 → (2)

center in : Vec3D

Center of the sphere to contain.

radius opt : float64 = 0

Radius of the sphere to contain.

returns → Sphere

The resulting sphere.

Grows this sphere so that it contains the given one.

Intersects

2 overloads


[Pure]
public method Intersects1 → (1)

sphere in : Sphere

The sphere to test.

returns → bool

true if the given sphere intersects with this one,
false if not.

Checks if this sphere intersects with the given one.


[Pure]
public method Intersects2 → (2)

center in : Vec3D

Center of the sphere to test.

radius opt : float64 = 0

Radius of the sphere to test.

returns → bool

true if the given sphere intersects with this one,
false if not.

Checks if this sphere intersects with the given one.

Scale


[Pure]
public method Scale → (1)

factor in : float64

The scale factor.

returns → Sphere

The scaled sphere.

Scales this sphere.

Translate


[Pure]
public method Translate → (1)

offset in : Vec3D

The translation offset.

returns → Sphere

The translated sphere.

Translates this sphere.

Public / Attributes

Center


public readonly attribute Center → (Vec3D)

The sphere center or Vec3D.Undefined if undefined.

Is​Undefined


public attribute IsUndefined → (get)

value : bool

true if this sphere has an undefined value, false if not.

Checks if this sphere has an undefined value.

See also

Sphere.Undefined

Radius


public readonly attribute Radius → (float64)

The sphere radius or Maths.NanD if undefined.

Volume


public attribute Volume → (get)

value : float64

[>=0]
The sphere volume.

Returns the volume of this sphere.

Serialization

Serializer


public static readonly attribute Serializer → (ITypeSerializer<Sphere>)

The serialization helper object for values of Sphere.