public class Shape extends Object
A shape is composed of a set of shifted boxes.
Modifier and Type | Field and Description |
---|---|
DBox |
boundingBox
It specifies the smallest bounding box which encapsulates all boxes constituting the shape.
|
Collection<DBox> |
boxes
The collection of DBoxes that constitute the shape.
|
int |
no
It defines unique shape id which is used by geost objects to define their shapes.
|
Constructor and Description |
---|
Shape(int no,
Collection<DBox> boxes)
It constructs a shape with a given id based on a specified collection of Dboxes.
|
Shape(int id,
DBox box)
It constructs a shape from only one DBox.
|
Shape(int id,
int[] origin,
int[] length)
It constructs a shape with a given id based on a single dbox
specified by the origin and length arrays.
|
Modifier and Type | Method and Description |
---|---|
int |
area()
It computes the area (2D), volumen (3D) of the shape.
|
DBox |
boundingBox()
It returns previously computed bounding box of the shape.
|
String |
checkInvariants()
It checks whether the shape object is consistent.
|
Collection<DBox> |
components()
It returns the dboxes defining the shape.
|
boolean |
containsPoint(int[] point)
It checks whether a given point lies within any of the shapes boxes.
|
Collection<DBox> |
holes()
It returns the set of holes of this shape.
|
Collection<DBox> |
noOverlapRepresentation()
It computes a collection of DBoxes that form the same shape, but that are certain
to not overlap
|
String |
toString() |
public Collection<DBox> boxes
public final DBox boundingBox
public int no
public Shape(int no, Collection<DBox> boxes)
no
- the unique identifier of the created shape.boxes
- the collection of boxes constituting the shape.public Shape(int id, DBox box)
id
- shape unique identifier.box
- the single dbox specifying the shape.public Shape(int id, int[] origin, int[] length)
id
- the unique identifier of the constructed shape.origin
- it specifies the origin of the dbox specifying the shape.length
- it specifies the length of the dbox specifying the shape.public String checkInvariants()
public Collection<DBox> components()
public final DBox boundingBox()
public boolean containsPoint(int[] point)
point
- the point which containment within a shape is being checked.public Collection<DBox> holes()
public int area()
public Collection<DBox> noOverlapRepresentation()
This implementation is probably not the most efficient possible representation.
Copyright © 2022. All rights reserved.