Package org.jacop.constraints.geost
Class Shape
java.lang.Object
org.jacop.constraints.geost.Shape
- Version:
- 4.8
A shape is composed of a set of shifted boxes.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
It defines the area (2D) or volume (3D) of the shape.final DBox
It specifies the smallest bounding box which encapsulates all boxes constituting the shape.The collection of DBoxes that constitute the shape.private SimpleArrayList<DBox>
int
It defines unique shape id which is used by geost objects to define their shapes. -
Constructor Summary
ConstructorsConstructorDescriptionShape
(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.Shape
(int no, Collection<DBox> boxes) It constructs a shape with a given id based on a specified collection of Dboxes.It constructs a shape from only one DBox. -
Method Summary
Modifier and TypeMethodDescriptionint
area()
It computes the area (2D), volumen (3D) of the shape.final DBox
It returns previously computed bounding box of the shape.It checks whether the shape object is consistent.It returns the dboxes defining the shape.private DBox
It computes the bounding box of the given shape.boolean
containsPoint
(int[] point) It checks whether a given point lies within any of the shapes boxes.holes()
It returns the set of holes of this shape.private void
It (re)initializes the holesIt computes a collection of DBoxes that form the same shape, but that are certain to not overlaptoString()
-
Field Details
-
boxes
The collection of DBoxes that constitute the shape. -
boundingBox
It specifies the smallest bounding box which encapsulates all boxes constituting the shape. -
no
public int noIt defines unique shape id which is used by geost objects to define their shapes. -
area
private int areaIt defines the area (2D) or volume (3D) of the shape. -
holes
-
-
Constructor Details
-
Shape
It constructs a shape with a given id based on a specified collection of Dboxes.- Parameters:
no
- the unique identifier of the created shape.boxes
- the collection of boxes constituting the shape.
-
Shape
It constructs a shape from only one DBox.- Parameters:
id
- shape unique identifier.box
- the single dbox specifying the shape.
-
Shape
public 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.- Parameters:
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.
-
-
Method Details
-
checkInvariants
It checks whether the shape object is consistent.- Returns:
- It returns the string description of the problem, or null if no problem with data structure consistency encountered.
-
components
It returns the dboxes defining the shape.- Returns:
- the collection of dboxes defining the shape.
-
computeBoundingBox
It computes the bounding box of the given shape.- Returns:
- the bounding box covering all boxes constituting the shape.
-
boundingBox
It returns previously computed bounding box of the shape.- Returns:
- the bounding box of the shape.
-
containsPoint
public boolean containsPoint(int[] point) It checks whether a given point lies within any of the shapes boxes.- Parameters:
point
- the point which containment within a shape is being checked.- Returns:
- true if the point lies within a shape, false otherwise.
-
initHoles
private void initHoles()It (re)initializes the holes -
holes
It returns the set of holes of this shape. The set of holes is a set of boxes with the following properties, once scaled by a factor 1/4: - none of its components overlaps with the shape's components - its union with the set of components covers the bounding box of the shape, except for an empty area at the component boundary that has size 1/4- Returns:
- the set of holes of this shape.
-
toString
-
area
public int area()It computes the area (2D), volumen (3D) of the shape.- Returns:
- the area/volume of the shape.
-
noOverlapRepresentation
It computes a collection of DBoxes that form the same shape, but that are certain to not overlapThis implementation is probably not the most efficient possible representation.
- Returns:
- non overlapping representation of the shape.
-