AlgART Home
net.algart.math.patterns

## Interface UniformGridPattern

• All Superinterfaces:
Pattern
All Known Subinterfaces:
DirectPointSetUniformGridPattern, RectangularPattern
All Known Implementing Classes:
AbstractUniformGridPattern

```public interface UniformGridPattern
extends Pattern```

Interface, used by `Pattern` implementations to indicate that they are uniform-grid patterns, i.e. subsets of the set of all mesh nodes of some uniform grids. See also the section "Uniform-grid patterns" in the comments to `Pattern` interface.

More precisely, a pattern, implementing this interface, is some set of N points (N>0) x(k) = (x0(k), x1(k), ..., xn−1(k)) (k=0,1,...,N−1, n=`dimCount()`), produced by the following formulas:

x0(k) = o0 + i0(k)d0
x1(k) = o1 + i1(k)d1
. . .
xn−1(k) = on−1 + in−1(k)dn−1

where oj and dj are some constants (dj>0) and ij(k) are any integer numbers. The point o=(o0,o1,...,on−1), named origin of the grid, and the vector d=(d0,d1,...,dn−1), named steps of the grid, are specified while creating the pattern. Moreover, these parameters about (o and d) are stored inside the object and can be quickly read at any time by `originOfGrid()` and `stepsOfGrid()` methods — this condition is a requirement for all implementations of this interface.

The numbers ij(k) are called grid indexes of the points of the pattern (or, briefly, grid indexes of the pattern). The integer points i(k) = (i0(k), i1(k), ..., in−1(k)) (k=0,1,...,N−1) form an integer pattern (see the section "Integer patterns" in the comments to `Pattern` interface), which is called grid index pattern and can be got at any time by `gridIndexPattern()` method. If the number of points is not extremely large, the grid indexes can be also retrieved directly as Java set of i(k) points by `gridIndexes()` method.

Warning: not only patterns, implementing this interface, are actually such sets of points. Moreover, many patterns, created by this package, are really uniform grid (all their points really belong to set of mesh points of some uniform grid), but they do not implement this interface and are not considered to be "uniform-grid". The typical examples are Minkowski sums, created by `Patterns.newMinkowskiSum(Collection)` method, and unions, created by `Patterns.newUnion(Collection)` method. It is obvious that a Minkowski sum or a union of several uniform-grid patterns, having zero origin o=(0,0,...,0) and the same steps d, are also uniform-grid patterns with the same origin and steps. However, it is very probably that the objects, returned by `Patterns.newMinkowskiSum(Collection)` and `Patterns.newUnion(Collection)` methods, will not implement `UniformGridPattern` interface even in this "good" case.

#### Grid index restrictions

There are the following guarantees for grid indexes ij(k) of any uniform-grid pattern:

1. if p=(i0,i1,...,in−1) is the grid index of some point of the pattern, then −`Pattern.MAX_COORDINATE`ij`Pattern.MAX_COORDINATE` for all j;
2. if p=(i01,i11,...,in−11) and q=(i02,i12,...,in−12) are the grid indexes of some two points of the pattern, then |ij1ij2|≤`Pattern.MAX_COORDINATE` for all j.

Each implementation of this interface must fulfil both restriction. Any attempt to create a uniform-grid pattern, the grid indexes of which do not satisfy these restrictions, leads to `TooLargePatternCoordinatesException`.

These restrictions are guaranteed together with the coordinate restrictions, described in the section "Coordinate restrictions" in the comments to `Pattern` interface. These restrictions provide a guarantee that the method `gridIndexPattern()` always works successfully and creates a correct integer pattern.

Since:
JDK 1.5
Version:
1.2
Author:
Daniel Alievsky

• ### Fields inherited from interface net.algart.math.patterns.Pattern

`MAX_COORDINATE`
• ### Method Summary

All Methods
Modifier and Type Method and Description
`UniformGridPattern` `carcass()`
Returns the carcass of this pattern.
`IRectangularArea` `gridIndexArea()`
Returns the minimal and maximal grid index ij among all points of this pattern for all coordinate axes j If a is the result of this method, then a.`coordCount()`==`dimCount()` and a.`range`(k) is equal to `gridIndexRange`(k) for all k.
`java.util.Set<IPoint>` `gridIndexes()`
Returns a set of all grid indexes ij of this pattern.
`IPoint` `gridIndexMax()`
Returns the point, each coordinate #j of which is equal to the maximal corresponding grid index ij among all points of this pattern.
`IPoint` `gridIndexMin()`
Returns the point, each coordinate #j of which is equal to the minimal corresponding grid index ij among all points of this pattern.
`UniformGridPattern` `gridIndexPattern()`
Returns an `ordinary` integer pattern with the same set of grid indexes ij(k) as this pattern.
`IRange` `gridIndexRange(int coordIndex)`
Returns the minimal and maximal grid index ij among all points of this pattern for the specified coordinate index j==coordIndex.
`boolean` `isActuallyRectangular()`
Returns true if this pattern is n-dimensional rectangular parallelepiped.
`boolean` `isOrdinary()`
Returns true if and only if this uniform-grid pattern is an ordinary integer pattern, i.e. if the grid origin o is the origin of coordinates (0,0,...,0) and all grid steps dj are 1.0.
`UniformGridPattern` `lowerSurface(int coordIndex)`
Returns the lower boundary of this pattern along the given axis: a pattern consisting of all such points A of this pattern, that the neighbour point B, generated by the backward shift of point A along the coordinate #j=coordIndex by the corresponding grid step dj=`stepOfGrid(coordIndex)`, does not belong to this pattern.
`UniformGridPattern` `maxBound(int coordIndex)`
Returns the maximal boundary of this pattern along the given axis: a pattern consisting of all points of this pattern, for which there are no other points with greater coordinate #coordIndex and same other coordinates.
`UniformGridPattern` `minBound(int coordIndex)`
Returns the minimal boundary of this pattern along the given axis: a pattern consisting of all points of this pattern, for which there are no other points with less coordinate #coordIndex and same other coordinates.
`UniformGridPattern` `multiply(double multiplier)`
Returns this pattern, scaled by the specified multiplier along all coordinates.
`Point` `originOfGrid()`
Returns the grid origin o of this pattern.
`UniformGridPattern` `projectionAlongAxis(int coordIndex)`
Returns the projection of this pattern along the given axis.
`UniformGridPattern` `scale(double... multipliers)`
Returns this pattern, scaled by the specified multipliers along all coordinates.
`UniformGridPattern` `shift(Point shift)`
Returns this pattern, shifted by the argument.
`UniformGridPattern` `shiftGridIndexes(IPoint shift)`
Returns another uniform-grid pattern, identical to this one with the only difference, that the grid index i(k) = (i0(k), i1(k), ..., in−1(k)) for each point #k of the result is shifted by the argument of this method via the call i(k).`add`(shift).
`double` `stepOfGrid(int coordIndex)`
Returns the grid step dj along the coordinate #j of this pattern along the coordinate #j=coordIndex.
`double[]` `stepsOfGrid()`
Returns the array of grid steps d of this pattern.
`boolean` `stepsOfGridEqual(UniformGridPattern pattern)`
Indicates whether the other uniform-grid pattern has the same grid steps.
`Pattern` `surface()`
Returns the set-theoretical union of all patterns, returned by `lowerSurface(int)` `upperSurface(int)` methods for all coordinates.
`UniformGridPattern` `symmetric()`
Returns the symmetric pattern: equivalent to `multiply(-1.0)`.
`UniformGridPattern` `upperSurface(int coordIndex)`
Returns the upper boundary of this pattern along the given axis: a pattern consisting of all such points A of this pattern, that the neighbour point B, generated by the forward shift of point A along the coordinate #j=coordIndex by the corresponding grid step dj=`stepOfGrid(coordIndex)`, does not belong to this pattern.
• ### Methods inherited from interface net.algart.math.patterns.Pattern

`allUnionDecompositions, coordArea, coordMax, coordMin, coordRange, dimCount, hasMinkowskiDecomposition, isSurelyInteger, isSurelyOriginPoint, isSurelySinglePoint, largePointCount, maxCarcassMultiplier, minkowskiAdd, minkowskiDecomposition, minkowskiSubtract, pointCount, points, round, roundedCoordArea, roundedCoordRange, roundedPoints, unionDecomposition`