Vixen
02b45cc4
csharp
public readonly struct BoundingBox

An axis-aligned bounding box, stored as its two extreme corners. The workhorse of culling, spatial queries and broad-phase collision.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

An empty box has Minimum above Maximum — see Empty. That is not a degenerate case to guard against, it is the identity for Merge, which is what makes accumulating a bound over a loop work without a special case for the first item.

Fields and properties (8)

  • public const int CornerCount

    How many corners a box has.

  • public readonly Vector3 Minimum

    The corner with the smallest coordinates.

  • public readonly Vector3 Maximum

    The corner with the largest coordinates.

  • public static BoundingBox Empty

    The box that contains nothing: inverted bounds, so merging anything into it yields exactly that thing. Start every accumulation here.

  • public Vector3 Center

    The midpoint.

  • public Vector3 Size

    The full width, height and depth.

  • public Vector3 Extent

    Half the size — the distance from the centre to a face along each axis.

  • public bool IsEmpty

    Whether the box contains nothing.

Methods (21)

  • public BoundingBox(Vector3 minimum, Vector3 maximum)

    Builds a box from its extreme corners.

  • public static BoundingBox FromPoints(ReadOnlySpan<Vector3> points)

    The tightest box containing every point.

  • public static BoundingBox FromSphere(BoundingSphere sphere)

    The tightest box containing a sphere.

  • public static BoundingBox Merge(BoundingBox left, BoundingBox right)

    The tightest box containing both.

  • public static BoundingBox Merge(BoundingBox box, Vector3 point)

    The tightest box containing this one and a point.

  • public void GetCorners(Span<Vector3> destination)

    The eight corners, in a fixed order: −X first, then −Y, then −Z varying fastest.

  • public bool Contains(Vector3 point)

    Whether a point is inside or on the boundary.

  • public ContainmentType Contains(BoundingBox other)

    How another box sits relative to this one.

  • public ContainmentType Contains(BoundingSphere sphere)

    How a sphere sits relative to this box.

  • public bool Intersects(BoundingBox other)

    Whether two boxes overlap at all.

  • public bool Intersects(BoundingSphere sphere)

    Whether a sphere overlaps this box.

  • public PlaneIntersectionType Intersects(Plane plane)

    Which side of a plane the box is on.

  • public static BoundingBox Transform(BoundingBox box, in Matrix4x4 matrix)

    The tightest axis-aligned box containing this one after a transform.

  • public static bool NearEqual(BoundingBox left, BoundingBox right, float tolerance = 1E-06)

    Whether two boxes agree to within a tolerance.

  • public static bool operator ==(BoundingBox left, BoundingBox right)

    Exact equality, IEEE semantics. See NearEqual.

  • public static bool operator !=(BoundingBox left, BoundingBox right)

    The negation of op_Equality.

  • public bool Equals(BoundingBox other)

    Indicates whether the current object is equal to another object of the same type.

  • public override bool Equals(object? obj)

    Indicates whether this instance and a specified object are equal.

  • public override int GetHashCode()

    Returns the hash code for this instance.

  • public override string ToString()

    Returns the fully qualified type name of this instance.

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

    Formats the value of the current instance using the specified format.

Used by (119, showing 40)

  • ArenaThirdPersonShooter
  • BakeBenchmarksVixen.Benchmarks.Navigation
  • BoundingFrustumVixen.Core.Mathematics
  • BoundingSphereVixen.Core.Mathematics
  • BuilderVixen.Rendering
  • CameraConfinerVixen.Engine
  • CapturedIrradianceFillerTestsVixen.Rendering.Tests
  • ClusterCullingDeviceTestsVixen.Graphics.Golden.Tests
  • ClusterGridVixen.Rendering
  • ClusteredLightingTestsVixen.Rendering.Tests
  • CompactHeightfieldVixen.Navigation
  • CompositorAssetTestsVixen.Rendering.Tests
  • ConstraintGizmosVixen.Animation
  • ContourSetVixen.Navigation
  • DebugDrawVixen.Engine
  • DebugDrawShapeTestsVixen.Engine.Tests
  • DistanceFieldAoImageTestsVixen.Graphics.Golden.Tests
  • DistanceFieldInstanceVixen.Rendering.DistanceFields
  • DistanceFieldInstanceTestsVixen.Rendering.DistanceFields.Tests
  • EditMeshVixen.Geometry
  • EditMeshTestsVixen.Geometry.Tests
  • FoliageChunkVixen.Foliage
  • FoliageVolumeTestsVixen.Foliage.Tests
  • GlobalDistanceFieldVixen.Rendering.DistanceFields
  • GlobalDistanceFieldTestsVixen.Rendering.DistanceFields.Tests
  • GlobalDistanceFieldTextureVixen.Rendering
  • GlobalDistanceFieldTextureTestsVixen.Rendering.Tests
  • GpuClusterCullingVixen.Rendering
  • GrassRendererVixen.Rendering.Terrain
  • HeightFieldPlacementVixen.Physics
  • HeightFieldShapeTestsVixen.Physics.Tests
  • HeightfieldVixen.Navigation
  • HeightfieldTestsVixen.Navigation.Tests
  • IndirectDiffuseImageTestsVixen.Graphics.Golden.Tests
  • IrradianceBounceDeviceTestsVixen.Graphics.Golden.Tests
  • IrradianceCaptureDeviceTestsVixen.Graphics.Golden.Tests
  • IrradianceCoarseningTestsVixen.Rendering.IrradianceFields.Tests
  • IrradianceConvergenceTestsVixen.Rendering.IrradianceFields.Tests
  • IrradianceFieldVixen.Rendering.IrradianceFields
  • IrradianceFieldRendererVixen.Rendering