@JsType(isNative=true, namespace="Cesium", name="OrientedBoundingBox") public class OrientedBoundingBox extends Object
Modifier and Type | Field and Description |
---|---|
Cartesian3 |
center
The center of the box.
|
Matrix3 |
halfAxes
The transformation matrix, to rotate the box to the right position.
|
Constructor and Description |
---|
OrientedBoundingBox()
Creates an instance of an OrientedBoundingBox.
|
OrientedBoundingBox(Cartesian3 center,
Matrix3 halfAxes)
Creates an instance of an OrientedBoundingBox.
|
Modifier and Type | Method and Description |
---|---|
OrientedBoundingBox |
clone()
Duplicates this OrientedBoundingBox instance.
|
static OrientedBoundingBox |
clone(OrientedBoundingBox box,
OrientedBoundingBox result)
Duplicates a OrientedBoundingBox instance.
|
Interval |
computePlaneDistances(Cartesian3 position,
Cartesian3 direction)
The distances calculated by the vector from the center of the bounding box to position projected onto direction.
|
Interval |
computePlaneDistances(Cartesian3 position,
Cartesian3 direction,
Interval result)
The distances calculated by the vector from the center of the bounding box to position projected onto direction.
|
static Interval |
computePlaneDistances(OrientedBoundingBox box,
Cartesian3 position,
Cartesian3 direction)
The distances calculated by the vector from the center of the bounding box to position projected onto direction.
|
static Interval |
computePlaneDistances(OrientedBoundingBox box,
Cartesian3 position,
Cartesian3 direction,
Interval result)
The distances calculated by the vector from the center of the bounding box to position projected onto direction.
|
double |
distanceSquaredTo(Cartesian3 cartesian)
Computes the estimated distance squared from the closest point on a bounding box to a point.
|
static double |
distanceSquaredTo(OrientedBoundingBox box,
Cartesian3 cartesian)
Computes the estimated distance squared from the closest point on a bounding box to a point.
|
boolean |
equals(OrientedBoundingBox right)
Compares this OrientedBoundingBox against the provided OrientedBoundingBox componentwise and returns true if
they are equal, false otherwise.
|
static boolean |
equals(OrientedBoundingBox left,
OrientedBoundingBox right)
Compares the provided OrientedBoundingBox componentwise and returns true if they are equal, false otherwise.
|
static OrientedBoundingBox |
fromPoints(Cartesian3[] positions)
Computes an instance of an OrientedBoundingBox of the given positions.
|
static OrientedBoundingBox |
fromPoints(Cartesian3[] positions,
OrientedBoundingBox result)
Computes an instance of an OrientedBoundingBox of the given positions.
|
static OrientedBoundingBox |
fromRectangle(Rectangle rectangle)
Computes an OrientedBoundingBox that bounds a Rectangle on the surface of an Ellipsoid.
|
static OrientedBoundingBox |
fromRectangle(Rectangle rectangle,
double minimumHeight,
double maximumHeight,
Ellipsoid ellipsoid)
Computes an OrientedBoundingBox that bounds a Rectangle on the surface of an Ellipsoid.
|
static OrientedBoundingBox |
fromRectangle(Rectangle rectangle,
double minimumHeight,
double maximumHeight,
Ellipsoid ellipsoid,
OrientedBoundingBox result)
Computes an OrientedBoundingBox that bounds a Rectangle on the surface of an Ellipsoid.
|
static Integer |
intersectPlane(OrientedBoundingBox box,
Plane plane)
Determines which side of a plane the oriented bounding box is located.
|
Number |
intersectPlane(Plane plane)
Determines which side of a plane the oriented bounding box is located.
|
boolean |
isOccluded(Occluder occluder)
Determines whether or not a bounding box is hidden from view by the occluder.
|
static boolean |
isOccluded(OrientedBoundingBox box,
Occluder occluder)
Determines whether or not a bounding box is hidden from view by the occluder.
|
static double[] |
pack(OrientedBoundingBox value,
double[] array)
Stores the provided instance into the provided array.
|
static double[] |
pack(OrientedBoundingBox value,
double[] array,
int startingIndex)
Stores the provided instance into the provided array.
|
static OrientedBoundingBox |
unpack(double[] array,
int startingIndex,
OrientedBoundingBox result)
Retrieves an instance from a packed array.
|
public Cartesian3 center
Cartesian3.ZERO()
public Matrix3 halfAxes
Matrix3.IDENTITY()
@JsConstructor public OrientedBoundingBox()
BoundingSphere
or AxisAlignedBoundingBox
in many cases.BoundingSphere
,
BoundingRectangle
@JsConstructor public OrientedBoundingBox(Cartesian3 center, Matrix3 halfAxes)
BoundingSphere
or AxisAlignedBoundingBox
in many cases.
Example:
// Create an OrientedBoundingBox using a transformation matrix, a position where the box will be translated, and a scale.
Cartesian3 center = new Cartesian3(1.0, 0.0, 0.0);
Matrix3 halfAxes = Matrix3.fromScale(new Cartesian3(1.0, 3.0, 2.0), new Matrix3());
OrientedBoundingBox obb = new OrientedBoundingBox(center, halfAxes);
center
- The center of the box. Default: Cartesian3.ZERO()
halfAxes
- The three orthogonal half-axes of the bounding box. Equivalently, the transformation matrix,
to rotate and scale a 2x2x2 cube centered at the origin. Default: Matrix3.ZERO()
BoundingSphere
,
BoundingRectangle
public static OrientedBoundingBox clone(OrientedBoundingBox box, OrientedBoundingBox result)
box
- The bounding box to duplicate.result
- The object onto which to store the result.public static Interval computePlaneDistances(OrientedBoundingBox box, Cartesian3 position, Cartesian3 direction)
box
- The bounding box to calculate the distance to.position
- The position to calculate the distance from.direction
- The direction from position.public static Interval computePlaneDistances(OrientedBoundingBox box, Cartesian3 position, Cartesian3 direction, Interval result)
box
- The bounding box to calculate the distance to.position
- The position to calculate the distance from.direction
- The direction from position.result
- A Interval to store the nearest and farthest distances.public static double distanceSquaredTo(OrientedBoundingBox box, Cartesian3 cartesian)
box
- The box.cartesian
- The point.public static boolean equals(OrientedBoundingBox left, OrientedBoundingBox right)
left
- The first OrientedBoundingBox.right
- The second OrientedBoundingBox.public static OrientedBoundingBox fromPoints(Cartesian3[] positions)
Example:
// Compute an object oriented bounding box enclosing two points.
OrientedBoundingBox box = OrientedBoundingBox.fromPoints([new Cartesian3(2, 0, 0), new Cartesian3(-2, 0, 0)]);
positions
- List of Cartesian3 points that the bounding box will enclose.public static OrientedBoundingBox fromPoints(Cartesian3[] positions, OrientedBoundingBox result)
Example:
// Compute an object oriented bounding box enclosing two points.
OrientedBoundingBox box = OrientedBoundingBox.fromPoints([new Cartesian3(2, 0, 0), new Cartesian3(-2, 0, 0)]);
positions
- List of Cartesian3 points that the bounding box will enclose.result
- The object onto which to store the result.public static OrientedBoundingBox fromRectangle(Rectangle rectangle)
rectangle
- The cartographic rectangle on the surface of the ellipsoid.public static OrientedBoundingBox fromRectangle(Rectangle rectangle, double minimumHeight, double maximumHeight, Ellipsoid ellipsoid)
rectangle
- The cartographic rectangle on the surface of the ellipsoid.minimumHeight
- The minimum height (elevation) within the tile. Default: 0.0maximumHeight
- The maximum height (elevation) within the tile. Default: 0.0ellipsoid
- The ellipsoid on which the rectangle is defined. Default: Ellipsoid.WGS84()
public static OrientedBoundingBox fromRectangle(Rectangle rectangle, double minimumHeight, double maximumHeight, Ellipsoid ellipsoid, OrientedBoundingBox result)
rectangle
- The cartographic rectangle on the surface of the ellipsoid.minimumHeight
- The minimum height (elevation) within the tile. Default: 0.0maximumHeight
- The maximum height (elevation) within the tile. Default: 0.0ellipsoid
- The ellipsoid on which the rectangle is defined. Default: Ellipsoid.WGS84()
result
- The object onto which to store the result.@JsMethod public static Integer intersectPlane(OrientedBoundingBox box, Plane plane)
box
- The oriented bounding box to test.plane
- The plane to test against.Intersect.INTERSECTING()
if the box intersects the plane.@JsMethod public static boolean isOccluded(OrientedBoundingBox box, Occluder occluder)
box
- The bounding box surrounding the occludee object.occluder
- The occluder.@JsMethod public static double[] pack(OrientedBoundingBox value, double[] array)
value
- The value to pack.array
- The array to pack into.@JsMethod public static double[] pack(OrientedBoundingBox value, double[] array, int startingIndex)
value
- The value to pack.array
- The array to pack into.startingIndex
- The index into the array at which to start packing the elements.@JsMethod public static OrientedBoundingBox unpack(double[] array, int startingIndex, OrientedBoundingBox result)
array
- The packed array.startingIndex
- The starting index of the element to be unpacked.result
- The object into which to store the result.@JsMethod public OrientedBoundingBox clone()
@JsMethod public Interval computePlaneDistances(Cartesian3 position, Cartesian3 direction)
position
- The position to calculate the distance from.direction
- The direction from position.@JsMethod public Interval computePlaneDistances(Cartesian3 position, Cartesian3 direction, Interval result)
position
- The position to calculate the distance from.direction
- The direction from position.result
- A Interval to store the nearest and farthest distances.@JsMethod public double distanceSquaredTo(Cartesian3 cartesian)
cartesian
- The point@JsMethod public boolean equals(OrientedBoundingBox right)
right
- The right hand side OrientedBoundingBox.@JsMethod public Number intersectPlane(Plane plane)
plane
- The plane to test against.Intersect.INTERSECTING()
if the box intersects the plane.@JsMethod public boolean isOccluded(Occluder occluder)
occluder
- The occluder.Copyright © 2019. All rights reserved.