Class TLcdXYZBounds

All Implemented Interfaces:
ILcdBounded, ILcdBounds, ILcdShape, ILcd2DEditableBounds, ILcd2DEditableShape, ILcd3DEditableBounds, ILcd3DEditableShape, ILcdCloneable, Serializable, Cloneable

public class TLcdXYZBounds extends ALcd3DEditableBounds implements ILcd3DEditableBounds
This class provides an implementation of ILcd3DEditableBounds in the cartesian space.

This class is thread-safe for concurrent read-only access of its contents. For read-write access, external locking must be used. Such locking is typically done at the model level.

See Also:
  • Constructor Details

    • TLcdXYZBounds

      public TLcdXYZBounds(double aX, double aY, double aZ, double aWidth, double aHeight, double aDepth)
      Constructs and initializes a box with the specified parameters.
      Parameters:
      aX - the x coordinate of the lower left point (smallest x coordinate).
      aY - the y coordinate of the lower left point (smallest y coordinate).
      aZ - the z coordinate of the lower left point (smallest z coordinate).
      aWidth - the width of the box.
      aHeight - the height of the box.
      aDepth - the depth of the box.
    • TLcdXYZBounds

      public TLcdXYZBounds()
      Constructs a new box, initialized to location (0, 0, 0) and size (0, 0, 0).

      The defined status of the instance is false.

    • TLcdXYZBounds

      public TLcdXYZBounds(ILcdBounds aBounds)
      Constructs a new box, initialized to match the values of the specified box.

      The defined status of the instance is also copied from the specified bounds.

      Parameters:
      aBounds - a box from which to copy initial values.
    • TLcdXYZBounds

      public TLcdXYZBounds(ILcdBounds aBounds, double aZ, double aDepth)
      Constructs a new box, initialized to match the values of the specified box.
      Parameters:
      aBounds - 2D or 3D bounds from which to copy the 2D coordinates.
      aZ - the new z coordinate of the location.
      aDepth - the new depth of the box.
    • TLcdXYZBounds

      public TLcdXYZBounds(ILcdPoint aPoint, double aWidth, double aHeight, double aDepth)
      Constructs a box and initializes it to the specified point.
      Parameters:
      aPoint - the lower left point of the box (smallest x and y coordinates).
      aWidth - the width of the box.
      aHeight - the height of the box.
    • TLcdXYZBounds

      public TLcdXYZBounds(ILcdPoint aPoint)
      Constructs a box with zero width and height at the specified point.
      Parameters:
      aPoint - the lower left point of the box (smallest x and y coordinates) .
  • Method Details

    • getLocation

      public final ILcdPoint getLocation()
      Description copied from interface: ILcdBounds
      Returns the location of the bounding box (smallest x and y coordinates).
      Specified by:
      getLocation in interface ILcdBounds
      Returns:
      the location of the bounding box.
    • getMinX

      public double getMinX()
      Description copied from interface: ILcdBounds
      Returns the minimum X value (left boundary) of this bounds.

      By default, this does getLocation.getX(), but can be overridden for performance.

      Specified by:
      getMinX in interface ILcdBounds
      Returns:
      the minimum X boundary
      See Also:
    • getMinY

      public double getMinY()
      Description copied from interface: ILcdBounds
      Returns the minimum Y value (lower boundary) of this bounds.

      By default, this does getLocation.getY(), but can be overridden for performance.

      Specified by:
      getMinY in interface ILcdBounds
      Returns:
      the minimum Y boundary
      See Also:
    • getMinZ

      public double getMinZ()
      Description copied from interface: ILcdBounds
      Returns the minimum Z value (bottom boundary) of this bounds.

      By default, this does getLocation.getZ(), but can be overridden for performance.

      Specified by:
      getMinZ in interface ILcdBounds
      Returns:
      the minimum Z boundary
      See Also:
    • getMaxX

      public double getMaxX()
      Description copied from interface: ILcdBounds
      Returns the maximum X value (right boundary) of this bounds.

      By default, this does getLocation.getX() + getWidth(), but can be overridden for performance.

      Note that this is a derived property, the bounds are defined by their lower-left corner and width/height.

      For geodetic bounds, the returned value is not necessarily normalized to [-180, 180].

      Specified by:
      getMaxX in interface ILcdBounds
      Returns:
      the maximum X boundary
      See Also:
    • getMaxY

      public double getMaxY()
      Description copied from interface: ILcdBounds
      Returns the maximum Y value (upper boundary) of this bounds.

      By default, this does getLocation.getY() + getHeight(), but can be overridden for performance.

      Note that this is a derived property, the bounds are defined by their lower-left corner and width/height.

      Specified by:
      getMaxY in interface ILcdBounds
      Returns:
      the maximum Y boundary
      See Also:
    • getMaxZ

      public double getMaxZ()
      Description copied from interface: ILcdBounds
      Returns the maximum Z value (top boundary) of this bounds.

      By default, this does getLocation.getZ() + getDepth(), but can be overridden for performance.

      Note that this is a derived property, the bounds are defined by their lower-left corner and width/height.

      Specified by:
      getMaxZ in interface ILcdBounds
      Returns:
      the maximum Z boundary
      See Also:
    • getWidth

      public final double getWidth()
      Description copied from interface: ILcdBounds
      Returns the width of the bounding box. The width has to be larger than or equal to 0.
      Specified by:
      getWidth in interface ILcdBounds
      Returns:
      the width of the bounding box.
    • setWidth

      public void setWidth(double aWidth)
      Description copied from interface: ILcd2DEditableBounds
      Sets the width of the bounds (the extent along the x-axis).

      If this bounds was undefined, it becomes defined.

      Specified by:
      setWidth in interface ILcd2DEditableBounds
      Parameters:
      aWidth - the new width.
    • getHeight

      public final double getHeight()
      Description copied from interface: ILcdBounds
      Returns the height of the bounding box. The height has to be larger than or equal to 0.
      Specified by:
      getHeight in interface ILcdBounds
      Returns:
      the height of the bounding box.
    • setHeight

      public void setHeight(double aHeight)
      Description copied from interface: ILcd2DEditableBounds
      Sets the height of the bounds (the extent along the y-axis).

      If this bounds was undefined, it becomes defined.

      Specified by:
      setHeight in interface ILcd2DEditableBounds
      Parameters:
      aHeight - the new height.
    • getDepth

      public final double getDepth()
      Description copied from interface: ILcdBounds
      Returns the depth of the bounding box. The depth has to be larger than or equal to 0.
      Specified by:
      getDepth in interface ILcdBounds
      Overrides:
      getDepth in class ALcd2DEditableBounds
      Returns:
      0.
    • setDepth

      public void setDepth(double aDepth)
      Description copied from interface: ILcd3DEditableBounds
      Sets the depth of the bounds (the extent along the z-axis).

      If this bounds is undefined, it becomes defined.

      Specified by:
      setDepth in interface ILcd3DEditableBounds
      Parameters:
      aDepth - the new depth.
    • move3D

      public void move3D(double aX, double aY, double aZ)
      Description copied from interface: ILcd3DEditableBounds
      Moves this ILcd3DEditableShape to the given point in the 3D space. The focus point is used as the handle by which the shape is moved.

      If this bounds was undefined, it becomes defined after the move.

      Specified by:
      move3D in interface ILcd3DEditableBounds
      Specified by:
      move3D in interface ILcd3DEditableShape
      Parameters:
      aX - the x coordinate of the point.
      aY - the y coordinate of the point.
      aZ - the z coordinate of the point.
    • cloneAs2DEditableBounds

      public ILcd2DEditableBounds cloneAs2DEditableBounds()
      Description copied from interface: ILcdBounds
      Returns a copy of this ILcdBounds object that is also an ILcd2DEditableBounds. This makes sure that the first two dimensions of the copy are writable, even if the original ILcdBounds object may be read-only.
      Specified by:
      cloneAs2DEditableBounds in interface ILcdBounds
      Returns:
      a copy of this ILcdBounds object that is also an ILcd2DEditableBounds. This makes sure that the first two dimensions of the copy are writable, even if the original ILcdBounds object may be read-only.
      See Also:
    • cloneAs3DEditableBounds

      public ILcd3DEditableBounds cloneAs3DEditableBounds()
      Description copied from interface: ILcdBounds
      Returns a copy of this ILcdBounds object that is also an ILcd3DEditableBounds. This makes sure that all three dimensions of the copy are writable, even if the original ILcdBounds object may be read-only.
      Specified by:
      cloneAs3DEditableBounds in interface ILcdBounds
      Returns:
      a copy of this ILcdBounds object that is also an ILcd3DEditableBounds. This makes sure that all three dimensions of the copy are writable, even if the original ILcdBounds object may be read-only.
      See Also:
    • clone

      public Object clone()
      Creates and returns a copy of this object.

      The contained editable point representing the lower left point of the box is cloned.

      Specified by:
      clone in interface ILcdCloneable
      Overrides:
      clone in class ALcdShape
      See Also:
    • setTo2DIntersection

      public void setTo2DIntersection(double aX, double aY, double aWidth, double aHeight)
      Description copied from class: ALcd2DEditableBounds
      Calculates the 2D intersection of this ALcd2DEditableBounds and a given rectangle in the cartesian plane.
      Specified by:
      setTo2DIntersection in interface ILcd2DEditableBounds
      Overrides:
      setTo2DIntersection in class ALcd2DEditableBounds
      Parameters:
      aX - the x coordinate of the rectangle.
      aY - the y coordinate of the rectangle.
      aWidth - the width of the rectangle.
      aHeight - the height of the rectangle.
    • setTo2DUnion

      public void setTo2DUnion(double aX, double aY, double aWidth, double aHeight)
      Description copied from class: ALcd2DEditableBounds
      Calculates the 2D union of this ALcd2DEditableBounds and a given rectangle in the cartesian plane.
      Specified by:
      setTo2DUnion in interface ILcd2DEditableBounds
      Overrides:
      setTo2DUnion in class ALcd2DEditableBounds
      Parameters:
      aX - the x coordinate of the rectangle.
      aY - the y coordinate of the rectangle.
      aWidth - the width of the rectangle.
      aHeight - the height of the rectangle.
    • setTo3DUnion

      public void setTo3DUnion(double aX, double aY, double aZ, double aWidth, double aHeight, double aDepth)
      Description copied from class: ALcd3DEditableBounds
      Calculates the 3D union of this ALcd3DEditableBounds and a given rectangle in the cartesian plane.
      Specified by:
      setTo3DUnion in interface ILcd3DEditableBounds
      Overrides:
      setTo3DUnion in class ALcd3DEditableBounds
      Parameters:
      aX - the x coordinate of the box.
      aY - the y coordinate of the box.
      aZ - the z coordinate of the box.
      aWidth - the width of the box.
      aHeight - the height of the box.
      aDepth - the depth of the box.
    • setTo3DIntersection

      public void setTo3DIntersection(double aX, double aY, double aZ, double aWidth, double aHeight, double aDepth)
      Description copied from class: ALcd3DEditableBounds
      Calculates the 3D intersection of this ALcd3DEditableBounds and a given rectangle in the cartesian plane.
      Specified by:
      setTo3DIntersection in interface ILcd3DEditableBounds
      Overrides:
      setTo3DIntersection in class ALcd3DEditableBounds
      Parameters:
      aX - the x coordinate of the box.
      aY - the y coordinate of the box.
      aZ - the z coordinate of the box.
      aWidth - the width of the box.
      aHeight - the height of the box.
      aDepth - the depth of the box.
    • contains2D

      public boolean contains2D(double aX, double aY, double aWidth, double aHeight)
      Description copied from class: ALcdBounds
      Checks whether this ALcdBounds object contains the given rectangle in the cartesian plane. Only the first two dimensions of the ILcdBounds object are considered, that is, the x coordinate and y coordinate of its location, its width, and its height.
      Specified by:
      contains2D in interface ILcdBounds
      Overrides:
      contains2D in class ALcdBounds
      Parameters:
      aX - the x coordinate of the rectangle.
      aY - the y coordinate of the rectangle.
      aWidth - the width of the rectangle.
      aHeight - the height of the rectangle.
      Returns:
      the boolean result of the containment test.
    • interacts2D

      public boolean interacts2D(double aX, double aY, double aWidth, double aHeight)
      Description copied from class: ALcdBounds
      Checks whether this ALcdBounds object interacts with the given rectangle in the cartesian plane. Only the first two dimensions of the ILcdBounds object are considered, that is, the x coordinate and y coordinate of its location, its width, and its height.
      Specified by:
      interacts2D in interface ILcdBounds
      Overrides:
      interacts2D in class ALcdBounds
      Parameters:
      aX - the x coordinate of the rectangle.
      aY - the y coordinate of the rectangle.
      aWidth - the width of the rectangle.
      aHeight - the height of the rectangle.
      Returns:
      true if this ALcdBounds object touches or overlaps to any extent with the given rectangle, false otherwise.
    • interacts3D

      public boolean interacts3D(double aX, double aY, double aZ, double aWidth, double aHeight, double aDepth)
      Description copied from class: ALcdBounds
      Checks whether this ALcdBounds object interacts with the given box in the 3D cartesian space.
      Specified by:
      interacts3D in interface ILcdBounds
      Overrides:
      interacts3D in class ALcdBounds
      Parameters:
      aX - the x coordinate of the box.
      aY - the y coordinate of the box.
      aZ - the z coordinate of the box.
      aWidth - the width of the box.
      aHeight - the height of the box.
      aDepth - the depth of the box.
      Returns:
      true if this ALcdBounds object touches or overlaps to any extent with the given box, false otherwise.
    • contains3D

      public boolean contains3D(double aX, double aY, double aZ, double aWidth, double aHeight, double aDepth)
      Description copied from class: ALcdBounds
      Checks whether this ALcdBounds object contains the given box in the 3D cartesian space. All three spatial dimensions of the ILcdBounds are considered, as a combination of contains2D and a test in the third dimension.
      Specified by:
      contains3D in interface ILcdBounds
      Overrides:
      contains3D in class ALcdBounds
      Parameters:
      aX - the x coordinate of the point.
      aY - the y coordinate of the point.
      aZ - the z coordinate of the point.
      aWidth - the width of the box.
      aHeight - the height of the box.
      aDepth - the depth of the box.
      Returns:
      the boolean result of the containment test.
      See Also: