Table of Contents

Class BoundingFrustum

Namespace
Microsoft.Xna.Framework
Assembly
MonoGame.Framework.dll

Defines a viewing frustum for intersection operations.

public class BoundingFrustum : IEquatable<BoundingFrustum>
Inheritance
BoundingFrustum
Implements
Inherited Members

Constructors

BoundingFrustum(Matrix)

Constructs the frustum by extracting the view planes from a matrix.

public BoundingFrustum(Matrix value)

Parameters

value Matrix

Combined matrix which usually is (View * Projection).

Fields

CornerCount

The number of corner points in the frustum.

public const int CornerCount = 8

Field Value

int

PlaneCount

The number of planes in the frustum.

public const int PlaneCount = 6

Field Value

int

Properties

Bottom

Gets the bottom plane of the frustum.

public Plane Bottom { get; }

Property Value

Plane

Far

Gets the far plane of the frustum.

public Plane Far { get; }

Property Value

Plane

Left

Gets the left plane of the frustum.

public Plane Left { get; }

Property Value

Plane

Matrix

Gets or sets the Matrix of the frustum.

public Matrix Matrix { get; set; }

Property Value

Matrix

Near

Gets the near plane of the frustum.

public Plane Near { get; }

Property Value

Plane

Right

Gets the right plane of the frustum.

public Plane Right { get; }

Property Value

Plane

Top

Gets the top plane of the frustum.

public Plane Top { get; }

Property Value

Plane

Methods

Contains(BoundingBox)

Containment test between this BoundingFrustum and specified BoundingBox.

public ContainmentType Contains(BoundingBox box)

Parameters

box BoundingBox

A BoundingBox for testing.

Returns

ContainmentType

Result of testing for containment between this BoundingFrustum and specified BoundingBox.

Contains(ref BoundingBox, out ContainmentType)

Containment test between this BoundingFrustum and specified BoundingBox.

public void Contains(ref BoundingBox box, out ContainmentType result)

Parameters

box BoundingBox

A BoundingBox for testing.

result ContainmentType

Result of testing for containment between this BoundingFrustum and specified BoundingBox as an output parameter.

Contains(BoundingFrustum)

Containment test between this BoundingFrustum and specified BoundingFrustum.

public ContainmentType Contains(BoundingFrustum frustum)

Parameters

frustum BoundingFrustum

A BoundingFrustum for testing.

Returns

ContainmentType

Result of testing for containment between this BoundingFrustum and specified BoundingFrustum.

Contains(BoundingSphere)

Containment test between this BoundingFrustum and specified BoundingSphere.

public ContainmentType Contains(BoundingSphere sphere)

Parameters

sphere BoundingSphere

A BoundingSphere for testing.

Returns

ContainmentType

Result of testing for containment between this BoundingFrustum and specified BoundingSphere.

Contains(ref BoundingSphere, out ContainmentType)

Containment test between this BoundingFrustum and specified BoundingSphere.

public void Contains(ref BoundingSphere sphere, out ContainmentType result)

Parameters

sphere BoundingSphere

A BoundingSphere for testing.

result ContainmentType

Result of testing for containment between this BoundingFrustum and specified BoundingSphere as an output parameter.

Contains(Vector3)

Containment test between this BoundingFrustum and specified Vector3.

public ContainmentType Contains(Vector3 point)

Parameters

point Vector3

A Vector3 for testing.

Returns

ContainmentType

Result of testing for containment between this BoundingFrustum and specified Vector3.

Contains(ref Vector3, out ContainmentType)

Containment test between this BoundingFrustum and specified Vector3.

public void Contains(ref Vector3 point, out ContainmentType result)

Parameters

point Vector3

A Vector3 for testing.

result ContainmentType

Result of testing for containment between this BoundingFrustum and specified Vector3 as an output parameter.

Equals(BoundingFrustum)

Compares whether current instance is equal to specified BoundingFrustum.

public bool Equals(BoundingFrustum other)

Parameters

other BoundingFrustum

The BoundingFrustum to compare.

Returns

bool

true if the instances are equal; false otherwise.

Equals(object)

Compares whether current instance is equal to specified BoundingFrustum.

public override bool Equals(object obj)

Parameters

obj object

The object to compare.

Returns

bool

true if the instances are equal; false otherwise.

GetCorners()

Returns a copy of internal corners array.

public Vector3[] GetCorners()

Returns

Vector3[]

The array of corners.

GetCorners(Vector3[])

Returns a copy of internal corners array.

public void GetCorners(Vector3[] corners)

Parameters

corners Vector3[]

The array which values will be replaced to corner values of this instance. It must have size of CornerCount.

GetHashCode()

Gets the hash code of this BoundingFrustum.

public override int GetHashCode()

Returns

int

Hash code of this BoundingFrustum.

Intersects(BoundingBox)

Gets whether or not a specified BoundingBox intersects with this BoundingFrustum.

public bool Intersects(BoundingBox box)

Parameters

box BoundingBox

A BoundingBox for intersection test.

Returns

bool

true if specified BoundingBox intersects with this BoundingFrustum; false otherwise.

Intersects(ref BoundingBox, out bool)

Gets whether or not a specified BoundingBox intersects with this BoundingFrustum.

public void Intersects(ref BoundingBox box, out bool result)

Parameters

box BoundingBox

A BoundingBox for intersection test.

result bool

true if specified BoundingBox intersects with this BoundingFrustum; false otherwise as an output parameter.

Intersects(BoundingFrustum)

Gets whether or not a specified BoundingFrustum intersects with this BoundingFrustum.

public bool Intersects(BoundingFrustum frustum)

Parameters

frustum BoundingFrustum

An other BoundingFrustum for intersection test.

Returns

bool

true if other BoundingFrustum intersects with this BoundingFrustum; false otherwise.

Intersects(BoundingSphere)

Gets whether or not a specified BoundingSphere intersects with this BoundingFrustum.

public bool Intersects(BoundingSphere sphere)

Parameters

sphere BoundingSphere

A BoundingSphere for intersection test.

Returns

bool

true if specified BoundingSphere intersects with this BoundingFrustum; false otherwise.

Intersects(ref BoundingSphere, out bool)

Gets whether or not a specified BoundingSphere intersects with this BoundingFrustum.

public void Intersects(ref BoundingSphere sphere, out bool result)

Parameters

sphere BoundingSphere

A BoundingSphere for intersection test.

result bool

true if specified BoundingSphere intersects with this BoundingFrustum; false otherwise as an output parameter.

Intersects(Plane)

Gets type of intersection between specified Plane and this BoundingFrustum.

public PlaneIntersectionType Intersects(Plane plane)

Parameters

plane Plane

A Plane for intersection test.

Returns

PlaneIntersectionType

A plane intersection type.

Intersects(ref Plane, out PlaneIntersectionType)

Gets type of intersection between specified Plane and this BoundingFrustum.

public void Intersects(ref Plane plane, out PlaneIntersectionType result)

Parameters

plane Plane

A Plane for intersection test.

result PlaneIntersectionType

A plane intersection type as an output parameter.

Intersects(Ray)

Gets the distance of intersection of Ray and this BoundingFrustum or null if no intersection happens.

public float? Intersects(Ray ray)

Parameters

ray Ray

A Ray for intersection test.

Returns

float?

Distance at which ray intersects with this BoundingFrustum or null if no intersection happens.

Intersects(ref Ray, out float?)

Gets the distance of intersection of Ray and this BoundingFrustum or null if no intersection happens.

public void Intersects(ref Ray ray, out float? result)

Parameters

ray Ray

A Ray for intersection test.

result float?

Distance at which ray intersects with this BoundingFrustum or null if no intersection happens as an output parameter.

ToString()

Returns a string representation of this BoundingFrustum in the format: {Near:[nearPlane] Far:[farPlane] Left:[leftPlane] Right:[rightPlane] Top:[topPlane] Bottom:[bottomPlane]}

public override string ToString()

Returns

string

string representation of this BoundingFrustum.

Operators

operator ==(BoundingFrustum, BoundingFrustum)

Compares whether two BoundingFrustum instances are equal.

public static bool operator ==(BoundingFrustum a, BoundingFrustum b)

Parameters

a BoundingFrustum

BoundingFrustum instance on the left of the equal sign.

b BoundingFrustum

BoundingFrustum instance on the right of the equal sign.

Returns

bool

true if the instances are equal; false otherwise.

operator !=(BoundingFrustum, BoundingFrustum)

Compares whether two BoundingFrustum instances are not equal.

public static bool operator !=(BoundingFrustum a, BoundingFrustum b)

Parameters

a BoundingFrustum

BoundingFrustum instance on the left of the not equal sign.

b BoundingFrustum

BoundingFrustum instance on the right of the not equal sign.

Returns

bool

true if the instances are not equal; false otherwise.