Bounds
La référence est en anglais : elle est générée à partir des commentaires du code, écrits en anglais.
public struct Bounds : IEquatable<Bounds>, IFormattableNamespace NodeWorld.Flux.
An axis-aligned box: center and extents (half size).
Constructors
Bounds
public Bounds(Vector3 center, Vector3 size)The box of this center and size.
Properties
center
public Vector3 center { get; set; }The center of the box.
size
public Vector3 size { get; set; }The size of the box (twice the extents).
extents
public Vector3 extents { get; set; }Half the size of the box.
min
public Vector3 min { get; set; }The corner with the smallest x, y and z.
max
public Vector3 max { get; set; }The corner with the largest x, y and z.
Methods
SetMinMax
public void SetMinMax(Vector3 min, Vector3 max)Makes it the box from min to max.
Encapsulate
public void Encapsulate(Vector3 point)Grows the box to hold point.
public void Encapsulate(Bounds bounds)Grows the box to hold bounds.
Expand
public void Expand(float amount)Grows the size by amount on every axis.
public void Expand(Vector3 amount)Grows the size by amount, axis by axis.
Contains
public bool Contains(Vector3 point)point is inside the box or on its faces.
Intersects
public bool Intersects(Bounds bounds)The two boxes overlap or touch.
ClosestPoint
public Vector3 ClosestPoint(Vector3 point)The point of the box nearest to point (point itself when inside).
SqrDistance
public float SqrDistance(Vector3 point)The squared distance from point to the box (0 inside).
IntersectRay
public bool IntersectRay(Ray ray, out float distance)Slab test: true if the ray hits the box; distance is 0 when the origin is inside.
public bool IntersectRay(Ray ray)The ray hits the box.
Equals
public bool Equals(Bounds other)The two boxes have the same center and extents.
public override bool Equals(object other)other is a box with the same center and extents.
GetHashCode
public override int GetHashCode()A hash of the center and the extents.
ToString
public override string ToString()"Center: (x, y, z), Extents: (x, y, z)", with 2 decimals.
public string ToString(string format)The same text with the numbers in format.
public string ToString(string format, IFormatProvider formatProvider)The same text with the numbers in format (F2 when empty) and formatProvider (the invariant culture when null).
Operators
operator ==
public static bool operator ==(Bounds lhs, Bounds rhs)The two boxes have the same center and extents.
operator !=
public static bool operator !=(Bounds lhs, Bounds rhs)The two boxes differ.
