Table of Contents

Struct BoundingSphere

Namespace
HelixToolkit.Maths
Assembly
HelixToolkit.Maths.dll

Represents a bounding sphere in three dimensional space.

public struct BoundingSphere : IEquatable<BoundingSphere>, IFormattable
Implements
Inherited Members
Extension Methods

Constructors

BoundingSphere(Vector3, float)

Initializes a new instance of the BoundingSphere struct.

public BoundingSphere(Vector3 center, float radius)

Parameters

center Vector3

The center of the sphere in three dimensional space.

radius float

The radius of the sphere.

Fields

Center

The center of the sphere in three dimensional space.

public Vector3 Center

Field Value

Vector3

Empty

public static readonly BoundingSphere Empty

Field Value

BoundingSphere

Radius

The radius of the sphere.

public float Radius

Field Value

float

Methods

Contains(ref BoundingBox)

Determines whether the current objects contains a BoundingBox.

public ContainmentType Contains(ref BoundingBox box)

Parameters

box BoundingBox

The box to test.

Returns

ContainmentType

The type of containment the two objects have.

Contains(ref BoundingSphere)

Determines whether the current objects contains a BoundingSphere.

public ContainmentType Contains(ref BoundingSphere sphere)

Parameters

sphere BoundingSphere

The sphere to test.

Returns

ContainmentType

The type of containment the two objects have.

Contains(ref Vector3)

Determines whether the current objects contains a point.

public ContainmentType Contains(ref Vector3 point)

Parameters

point Vector3

The point to test.

Returns

ContainmentType

The type of containment the two objects have.

Contains(ref Vector3, ref Vector3, ref Vector3)

Determines whether the current objects contains a triangle.

public ContainmentType Contains(ref Vector3 vertex1, ref Vector3 vertex2, ref Vector3 vertex3)

Parameters

vertex1 Vector3

The first vertex of the triangle to test.

vertex2 Vector3

The second vertex of the triangle to test.

vertex3 Vector3

The third vertex of the triangle to test.

Returns

ContainmentType

The type of containment the two objects have.

Equals(BoundingSphere)

Determines whether the specified Vector4 is equal to this instance.

public readonly bool Equals(BoundingSphere value)

Parameters

value BoundingSphere

The Vector4 to compare with this instance.

Returns

bool

true if the specified Vector4 is equal to this instance; otherwise, false.

Equals(ref BoundingSphere)

Determines whether the specified Vector4 is equal to this instance.

public readonly bool Equals(ref BoundingSphere value)

Parameters

value BoundingSphere

The Vector4 to compare with this instance.

Returns

bool

true if the specified Vector4 is equal to this instance; otherwise, false.

Equals(object?)

Determines whether the specified object is equal to this instance.

public override readonly bool Equals(object? obj)

Parameters

obj object

The object to compare with this instance.

Returns

bool

true if the specified object is equal to this instance; otherwise, false.

FromBox(BoundingBox)

Constructs a BoundingSphere from a given box.

public static BoundingSphere FromBox(BoundingBox box)

Parameters

box BoundingBox

The box that will designate the extents of the sphere.

Returns

BoundingSphere

The newly constructed bounding sphere.

FromBox(ref BoundingBox, out BoundingSphere)

Constructs a BoundingSphere from a given box.

public static void FromBox(ref BoundingBox box, out BoundingSphere result)

Parameters

box BoundingBox

The box that will designate the extents of the sphere.

result BoundingSphere

When the method completes, the newly constructed bounding sphere.

FromPoints(Vector3[])

Constructs a BoundingSphere that fully contains the given points.

public static BoundingSphere FromPoints(Vector3[] points)

Parameters

points Vector3[]

The points that will be contained by the sphere.

Returns

BoundingSphere

The newly constructed bounding sphere.

FromPoints(Vector3[], out BoundingSphere)

Constructs a BoundingSphere that fully contains the given points.

public static void FromPoints(Vector3[] points, out BoundingSphere result)

Parameters

points Vector3[]

The points that will be contained by the sphere.

result BoundingSphere

When the method completes, contains the newly constructed bounding sphere.

FromPoints(Vector3[], int, int, out BoundingSphere)

Constructs a BoundingSphere that fully contains the given points.

public static void FromPoints(Vector3[] points, int start, int count, out BoundingSphere result)

Parameters

points Vector3[]

The points that will be contained by the sphere.

start int

The start index from points array to start compute the bounding sphere.

count int

The count of points to process to compute the bounding sphere.

result BoundingSphere

When the method completes, contains the newly constructed bounding sphere.

Exceptions

ArgumentNullException

points

ArgumentOutOfRangeException

start or count

GetHashCode()

Returns a hash code for this instance.

public override readonly int GetHashCode()

Returns

int

A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

Intersects(BoundingBox)

Determines if there is an intersection between the current object and a BoundingBox.

public bool Intersects(BoundingBox box)

Parameters

box BoundingBox

The box to test.

Returns

bool

Whether the two objects intersected.

Intersects(ref BoundingBox)

Determines if there is an intersection between the current object and a BoundingBox.

public bool Intersects(ref BoundingBox box)

Parameters

box BoundingBox

The box to test.

Returns

bool

Whether the two objects intersected.

Intersects(BoundingSphere)

Determines if there is an intersection between the current object and a BoundingSphere.

public bool Intersects(BoundingSphere sphere)

Parameters

sphere BoundingSphere

The sphere to test.

Returns

bool

Whether the two objects intersected.

Intersects(ref BoundingSphere)

Determines if there is an intersection between the current object and a BoundingSphere.

public bool Intersects(ref BoundingSphere sphere)

Parameters

sphere BoundingSphere

The sphere to test.

Returns

bool

Whether the two objects intersected.

Intersects(ref Ray)

Determines if there is an intersection between the current object and a Ray.

public bool Intersects(ref Ray ray)

Parameters

ray Ray

The ray to test.

Returns

bool

Whether the two objects intersected.

Intersects(ref Ray, out Vector3)

Determines if there is an intersection between the current object and a Ray.

public bool Intersects(ref Ray ray, out Vector3 point)

Parameters

ray Ray

The ray to test.

point Vector3

When the method completes, contains the point of intersection, or Zero if there was no intersection.

Returns

bool

Whether the two objects intersected.

Intersects(ref Ray, out float)

Determines if there is an intersection between the current object and a Ray.

public bool Intersects(ref Ray ray, out float distance)

Parameters

ray Ray

The ray to test.

distance float

When the method completes, contains the distance of the intersection, or 0 if there was no intersection.

Returns

bool

Whether the two objects intersected.

Intersects(ref Plane)

Determines if there is an intersection between the current object and a Plane.

public PlaneIntersectionType Intersects(ref Plane plane)

Parameters

plane Plane

The plane to test.

Returns

PlaneIntersectionType

Whether the two objects intersected.

Intersects(ref Vector3, ref Vector3, ref Vector3)

Determines if there is an intersection between the current object and a triangle.

public bool Intersects(ref Vector3 vertex1, ref Vector3 vertex2, ref Vector3 vertex3)

Parameters

vertex1 Vector3

The first vertex of the triangle to test.

vertex2 Vector3

The second vertex of the triangle to test.

vertex3 Vector3

The third vertex of the triangle to test.

Returns

bool

Whether the two objects intersected.

Merge(BoundingSphere, BoundingSphere)

Constructs a BoundingSphere that is the as large as the total combined area of the two specified spheres.

public static BoundingSphere Merge(BoundingSphere value1, BoundingSphere value2)

Parameters

value1 BoundingSphere

The first sphere to merge.

value2 BoundingSphere

The second sphere to merge.

Returns

BoundingSphere

The newly constructed bounding sphere.

Merge(ref BoundingSphere, ref BoundingSphere, out BoundingSphere)

Constructs a BoundingSphere that is the as large as the total combined area of the two specified spheres.

public static void Merge(ref BoundingSphere value1, ref BoundingSphere value2, out BoundingSphere result)

Parameters

value1 BoundingSphere

The first sphere to merge.

value2 BoundingSphere

The second sphere to merge.

result BoundingSphere

When the method completes, contains the newly constructed bounding sphere.

ToString()

Returns a string that represents this instance.

public override readonly string ToString()

Returns

string

A string that represents this instance.

ToString(IFormatProvider)

Returns a string that represents this instance.

public readonly string ToString(IFormatProvider formatProvider)

Parameters

formatProvider IFormatProvider

The format provider.

Returns

string

A string that represents this instance.

ToString(string)

Returns a string that represents this instance.

public readonly string ToString(string format)

Parameters

format string

The format.

Returns

string

A string that represents this instance.

ToString(string?, IFormatProvider?)

Returns a string that represents this instance.

public readonly string ToString(string? format, IFormatProvider? formatProvider)

Parameters

format string

The format.

formatProvider IFormatProvider

The format provider.

Returns

string

A string that represents this instance.

Operators

operator ==(BoundingSphere, BoundingSphere)

Tests for equality between two objects.

public static bool operator ==(BoundingSphere left, BoundingSphere right)

Parameters

left BoundingSphere

The first value to compare.

right BoundingSphere

The second value to compare.

Returns

bool

true if left has the same value as right; otherwise, false.

operator !=(BoundingSphere, BoundingSphere)

Tests for inequality between two objects.

public static bool operator !=(BoundingSphere left, BoundingSphere right)

Parameters

left BoundingSphere

The first value to compare.

right BoundingSphere

The second value to compare.

Returns

bool

true if left has a different value than right; otherwise, false.