Package com.google.android.filament
Class Box
- java.lang.Object
-
- com.google.android.filament.Box
-
public class Box extends java.lang.ObjectAn axis-aligned 3D box represented by its center and half-extent. The half-extent is a vector representing the distance from the center to the edge of the box in each dimension. For example, a box of size 2 units in X, 4 units in Y, and 10 units in Z would have a half-extent of (1, 2, 5).
-
-
Constructor Summary
Constructors Constructor Description Box()Default-initializes the 3D box to have a center and half-extent of (0,0,0).Box(float[] center, float[] halfExtent)Initializes the 3D box from its center and half-extent.Box(float centerX, float centerY, float centerZ, float halfExtentX, float halfExtentY, float halfExtentZ)Initializes the 3D box from its center and half-extent.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description float[]getCenter()Returns the center of the 3D box.float[]getHalfExtent()Returns the half-extent from the center of the 3D box.voidsetCenter(float centerX, float centerY, float centerZ)Sets the center of of the 3D box.voidsetHalfExtent(float halfExtentX, float halfExtentY, float halfExtentZ)Sets the half-extent of the 3D box.
-
-
-
Constructor Detail
-
Box
public Box()
Default-initializes the 3D box to have a center and half-extent of (0,0,0).
-
Box
public Box(float centerX, float centerY, float centerZ, float halfExtentX, float halfExtentY, float halfExtentZ)Initializes the 3D box from its center and half-extent.
-
Box
public Box(@NonNull @Size(min=3L) float[] center, @NonNull @Size(min=3L) float[] halfExtent)Initializes the 3D box from its center and half-extent.- Parameters:
center- a float array with XYZ coordinates representing the center of the boxhalfExtent- a float array with XYZ coordinates representing half the size of the box in each dimension
-
-
Method Detail
-
setCenter
public void setCenter(float centerX, float centerY, float centerZ)Sets the center of of the 3D box.
-
setHalfExtent
public void setHalfExtent(float halfExtentX, float halfExtentY, float halfExtentZ)Sets the half-extent of the 3D box.
-
getCenter
@NonNull @Size(min=3L) public float[] getCenter()
Returns the center of the 3D box.- Returns:
- an XYZ float array of size 3
-
getHalfExtent
@NonNull @Size(min=3L) public float[] getHalfExtent()
Returns the half-extent from the center of the 3D box.- Returns:
- an XYZ float array of size 3
-
-