OBB class
Class representing an oriented bounding box (OBB). Similar to an AABB, it's a rectangular block but with an arbitrary orientation. When using {@link OBB#fromPoints}, the implementation tries to provide a tight-fitting oriented bounding box. In many cases, the result is better than an AABB or bounding sphere but worse than a convex hull. However, it's more efficient to work with OBBs compared to convex hulls. In general, OBB's are a good compromise between performance and tightness.
@author {@link https://github.com/Mugen87|Mugen87}
Constructors
Properties
-
a
→ Map<
String, dynamic> -
final
-
absR
→ List<
List< double> > -
final
-
b
→ Map<
String, dynamic> -
final
- center ↔ Vector3
-
latefinal
-
eigenDecomposition
→ Map<
String, Matrix3> -
final
- halfSizes ↔ Vector3
-
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
-
R
→ List<
List< double> > -
final
- rotation ↔ Matrix3
-
latefinal
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
t
→ List<
double> -
final
Methods
-
clampPoint(
Vector3 point, Vector3 result) → Vector3 - Ensures the given point is inside this OBB and stores the result in the given vector.
-
clone(
) → OBB - Creates a OBB and copies all values from this OBB.
-
containsPoint(
Vector3 point) → bool - Returns true if the given point is inside this OBB.
-
copy(
OBB obb) → OBB - Copies all values from the given OBB to this OBB.
-
equals(
OBB obb) → bool - Returns true if the given OBB is deep equal with this OBB.
-
fromAABB(
AABB aabb) → OBB - Computes the OBB from an AABB.
-
fromJSON(
Map< String, dynamic> json) → OBB - Restores this instance from the given JSON object.
-
fromPoints(
List< Vector3> points) → OBB - Computes the minimum enclosing OBB for the given set of points. The method is an implementation of {@link http://gamma.cs.unc.edu/users/gottschalk/main.pdf Collision Queries using Oriented Bounding Boxes} by Stefan Gottschalk. According to the dissertation, the quality of the fitting process varies from the respective input. This method uses the best approach by computing the covariance matrix based on the triangles of the convex hull (chapter 3.4.3).
-
getSize(
Vector3 result) → Vector3 - Computes the size (width, height, depth) of this OBB and stores it into the given vector.
-
intersectsAABB(
AABB aabb) → bool - Returns true if the given AABB intersects this OBB.
-
intersectsBoundingSphere(
BoundingSphere sphere) → bool - Returns true if the given bounding sphere intersects this OBB.
-
intersectsOBB(
OBB obb, [double epsilon = MathUtils.epsilon]) → bool - Returns true if the given OBB intersects this OBB.
-
intersectsPlane(
Plane plane) → bool - Returns true if the given plane intersects this OBB.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
set(
Vector3 center, Vector3 halfSizes, Matrix3 rotation) → OBB - Sets the given values to this OBB.
-
toJSON(
) → Map< String, dynamic> - Transforms this instance into a JSON object.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited