public interface XyzShape<T extends XyzShape> extends Immutable, java.lang.Iterable<XyzPoint>
Defines basic methods and enforces immutability and iterability. In addition, shapes must be defined in such a way that translation and uniform scaling do not change their class. Other types of affine transform may change the class. For example, scaling a cube by the same factor in all dimensions always results in a square. Translating it by moving it any amount in either dimension always results in a cube. However, scaling it by one factor in X and another factor in Y, or applying shears, results in something not a cube.
Subclasses should generally provide themselves as the generic type parameter T. For example:
public class XyzPoint implements XyzShape<XyzPoint> {
This clever construction allows you to use e.g. scale() on a shape of
declared type without having to cast the result:
XyzPoint original = new XyzPoint(100, 100); XyzPoint scaled = original.scale(5);Copyright 2007 Partner Software, Inc.
| Modifier and Type | Method and Description |
|---|---|
XyzBounds |
getBounds()
Returns an XyzBounds object representing the rectangular extents of this
shape.
|
T |
scale(double factor)
Return a scaled version of the shape by multiplying all coordinates by
the given factor in both dimensions.
|
XyzShape |
transform(XyzTransform transform)
Transform the shape using the given transform.
|
T |
translate(double offsetX,
double offsetY,
double offsetZ)
Translate the shape by adding all coordinates to the given x, y, and z
offsets.
|
T scale(double factor)
factor - scaling factorT translate(double offsetX, double offsetY, double offsetZ)
offsetX - offset for the x dimensionoffsetY - offset for the y dimensionoffsetZ - offset for the z dimensionXyzShape transform(XyzTransform transform)
transform - affine transform to apply.XyzBounds getBounds()