icy.type.geom

## Interface Shape3D

• All Known Implementing Classes:
Line3D, Polyline3D, Rectangle3D, Rectangle3D.Double, Rectangle3D.Float, Rectangle3D.Integer, ROI3DLine, ROI3DPoint, ROI3DPolyLine, ROI3DShape

`public interface Shape3D`
The `Shape3D` interface provides definitions for objects that represent some form of 3D geometric Shape3D. Each `Shape3D` object provides callbacks to get the bounding box of the geometry, determine whether points or rectangles lie partly or entirely within the interior of the `Shape3D`.

Definition of insideness: A point is considered to lie inside a `Shape3D` if and only if:

• it lies completely inside the`Shape3D` boundary or
• it lies exactly on the `Shape3D` boundary.

The `contains` and `intersects` methods consider the interior of a `Shape3D` to be the area it encloses as if it were filled.

• ### Method Summary

Methods
Modifier and Type Method and Description
`boolean` ```contains(double x, double y, double z)```
Tests if the specified 3D coordinates are inside the boundary of the `Shape3D`.
`boolean` ```contains(double x, double y, double z, double sizeX, double sizeY, double sizeZ)```
Tests if the interior of the `Shape3D` entirely contains the specified 3D rectangular area.
`boolean` `contains(Point3D p)`
Tests if a specified `Point3D` is inside the boundary of the `Shape3D`.
`boolean` `contains(Rectangle3D r)`
Tests if the interior of the `Shape3D` entirely contains the specified `Rectangle3D`.
`Rectangle3D` `getBounds()`
Returns the bounding box of the `Shape3D`.
`boolean` ```intersects(double x, double y, double z, double sizeX, double sizeY, double sizeZ)```
Tests if the interior of the `Shape3D` intersects the interior of a specified 3D rectangular area.
`boolean` `intersects(Rectangle3D r)`
Tests if the interior of the `Shape3D` intersects the interior of a specified `Rectangle3D`.
• ### Method Detail

• #### getBounds

`Rectangle3D getBounds()`
Returns the bounding box of the `Shape3D`. Note that there is no guarantee that the returned `Rectangle3D` is the smallest bounding box that encloses the `Shape3D`, only that the `Shape3D` lies entirely within the indicated `Rectangle3D`.
Returns:
an instance of `Rectangle3D` that is a high-precision bounding box of the `Shape3D`.
• #### contains

```boolean contains(double x,
double y,
double z)```
Tests if the specified 3D coordinates are inside the boundary of the `Shape3D`.
Parameters:
`x` - the specified X coordinate to be tested
`y` - the specified Y coordinate to be tested
`z` - the specified Z coordinate to be tested
Returns:
`true` if the specified coordinates are inside the `Shape3D` boundary; `false` otherwise.
• #### contains

`boolean contains(Point3D p)`
Tests if a specified `Point3D` is inside the boundary of the `Shape3D`.
Parameters:
`p` - the specified `Point3D` to be tested
Returns:
`true` if the specified `Point3D` is inside the boundary of the `Shape3D`; `false` otherwise.
• #### intersects

```boolean intersects(double x,
double y,
double z,
double sizeX,
double sizeY,
double sizeZ)```
Tests if the interior of the `Shape3D` intersects the interior of a specified 3D rectangular area. The rectangular area is considered to intersect the `Shape3D` if any point is contained in both the interior of the `Shape3D` and the specified 3D rectangular area.

The `Shape3D.intersects()` method allows a `Shape3D` implementation to conservatively return `true` when:

• there is a high probability that the 3D rectangular area and the `Shape3D` intersect, but
• the calculations to accurately determine this intersection are prohibitively expensive.
This means that for some `Shapes` this method might return `true` even though the 3D rectangular area does not intersect the `Shape3D`.
Parameters:
`x` - the X coordinate of the closest-upper-left corner of the specified 3D rectangular area
`y` - the Y coordinate of the closest-upper-left corner of the specified 3D rectangular area
`z` - the Z coordinate of the closest-upper-left corner of the specified 3D rectangular area
`sizeX` - the width of the specified 3D rectangular area
`sizeY` - the height of the specified 3D rectangular area
`sizeZ` - the depth of the specified 3D rectangular area
Returns:
`true` if the interior of the `Shape3D` and the interior of the 3D rectangular area intersect, or are both highly likely to intersect and intersection calculations would be too expensive to perform; `false` otherwise.
• #### intersects

`boolean intersects(Rectangle3D r)`
Tests if the interior of the `Shape3D` intersects the interior of a specified `Rectangle3D`. The `Shape3D.intersects()` method allows a `Shape3D` implementation to conservatively return `true` when:
• there is a high probability that the `Rectangle3D` and the `Shape3D` intersect, but
• the calculations to accurately determine this intersection are prohibitively expensive.
This means that for some `Shapes` this method might return `true` even though the `Rectangle3D` does not intersect the `Shape3D`.
Parameters:
`r` - the specified `Rectangle3D`
Returns:
`true` if the interior of the `Shape3D` and the interior of the specified `Rectangle3D` intersect, or are both highly likely to intersect and intersection calculations would be too expensive to perform; `false` otherwise.
See Also:
`intersects(double, double, double, double, double, double)`
• #### contains

```boolean contains(double x,
double y,
double z,
double sizeX,
double sizeY,
double sizeZ)```
Tests if the interior of the `Shape3D` entirely contains the specified 3D rectangular area. All coordinates that lie inside the 3D rectangular area must lie within the `Shape3D` for the entire 3D rectangular area to be considered contained within the `Shape3D`.

The `Shape3D.contains()` method allows a `Shape3D` implementation to conservatively return `false` when:

• the `intersect` method returns `true` and
• the calculations to determine whether or not the `Shape3D` entirely contains the 3D rectangular area are prohibitively expensive.
This means that for some `Shapes` this method might return `false` even though the `Shape3D` contains the 3D rectangular area.
Parameters:
`x` - the X coordinate of the closest-upper-left corner of the specified 3D rectangular area
`y` - the Y coordinate of the closest-upper-left corner of the specified 3D rectangular area
`z` - the Z coordinate of the closest-upper-left corner of the specified 3D rectangular area
`sizeX` - the width of the specified 3D rectangular area
`sizeY` - the height of the specified 3D rectangular area
`sizeZ` - the depth of the specified 3D rectangular area
Returns:
`true` if the interior of the `Shape3D` entirely contains the specified rectangular area; `false` otherwise or, if the `Shape3D` contains the 3D rectangular area and the `intersects` method returns `true` and the containment calculations would be too expensive to perform.
• #### contains

`boolean contains(Rectangle3D r)`
Tests if the interior of the `Shape3D` entirely contains the specified `Rectangle3D`. The `Shape3D.contains()` method allows a `Shape3D` implementation to conservatively return `false` when:
• the `intersect` method returns `true` and
• the calculations to determine whether or not the `Shape3D` entirely contains the `Rectangle3D` are prohibitively expensive.
This means that for some `Shapes` this method might return `false` even though the `Shape3D` contains the `Rectangle3D`.
Parameters:
`r` - The specified `Rectangle3D`
Returns:
`true` if the interior of the `Shape3D` entirely contains the `Rectangle3D`; `false` otherwise or, if the `Shape3D` contains the `Rectangle3D` and the `intersects` method returns `true` and the containment calculations would be too expensive to perform.
See Also:
`contains(double, double, double, double, double, double)`