public interface DirectPointSetUniformGridPattern extends DirectPointSetPattern, UniformGridPattern
Interface, used by Pattern
implementations to indicate that
they are simultaneously DirectPointSetPattern
and UniformGridPattern
.
In other words, a pattern implements this interface if and only if it is simultaneously
direct pointset and uniformgrid: see the corresponding sections in
the comments to Pattern
interface.
If a pattern implements this interface, it never implements RectangularPattern
interface.
There is a guarantee, that the following methods create patterns, implementing this interface:
Patterns.newUniformGridPattern(net.algart.math.Point, double[], java.util.Collection)
,Patterns.newIntegerPattern(net.algart.math.IPoint...)
,Patterns.newIntegerPattern(java.util.Collection)
,Patterns.newSphereIntegerPattern(net.algart.math.Point, double)
,Patterns.newEllipsoidIntegerPattern(net.algart.math.Point, double...)
,Patterns.newSpaceSegment(UniformGridPattern, Func, Func, double, double)
.The following methods can return an object, implementing this interface, and also an object, not implementing this interface — it depends on their arguments:
QuickPointCountPattern
MAX_COORDINATE
Modifier and Type  Method and Description 

DirectPointSetUniformGridPattern 
gridIndexPattern()
Returns an
ordinary integer pattern with the same set of grid indexes
i_{j}^{(k)} as this pattern. 
DirectPointSetUniformGridPattern 
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
stepOfGrid(coordIndex) 
DirectPointSetUniformGridPattern 
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.

DirectPointSetUniformGridPattern 
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.

DirectPointSetUniformGridPattern 
multiply(double multiplier)
Returns this pattern, scaled by the specified multiplier along all coordinates.

DirectPointSetUniformGridPattern 
projectionAlongAxis(int coordIndex)
Returns the projection of this pattern along the given axis.

DirectPointSetUniformGridPattern 
scale(double... multipliers)
Returns this pattern, scaled by the specified multipliers along all coordinates.

DirectPointSetUniformGridPattern 
shift(Point shift)
Returns this pattern, shifted by the argument.

DirectPointSetUniformGridPattern 
shiftGridIndexes(IPoint shift)
Returns another uniformgrid pattern, identical to this one with the only difference, that
the grid index
add (shift). 
DirectPointSetUniformGridPattern 
symmetric()
Returns the symmetric pattern: equivalent to
multiply(1.0) . 
DirectPointSetUniformGridPattern 
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
stepOfGrid(coordIndex) 
isPointCountVeryLarge
allUnionDecompositions, carcass, coordArea, coordMax, coordMin, coordRange, dimCount, hasMinkowskiDecomposition, isSurelyInteger, isSurelyOriginPoint, isSurelySinglePoint, largePointCount, maxCarcassMultiplier, minkowskiAdd, minkowskiDecomposition, minkowskiSubtract, pointCount, points, round, roundedCoordArea, roundedCoordRange, roundedPoints, unionDecomposition
carcass, gridIndexArea, gridIndexes, gridIndexMax, gridIndexMin, gridIndexRange, isActuallyRectangular, isOrdinary, originOfGrid, stepOfGrid, stepsOfGrid, stepsOfGridEqual, surface
DirectPointSetUniformGridPattern shift(Point shift)
Pattern
More precisely, the resulting pattern consists of the points,
obtained from all points of this pattern by the call point.add
(shift).
The returned pattern always implements DirectPointSetPattern
if this pattern implements DirectPointSetPattern
The returned pattern always implements RectangularPattern
if this pattern implements RectangularPattern
.
The returned pattern always implements UniformGridPattern
if this pattern implements UniformGridPattern
.
There is a guarantee, that this method does not try to allocate much more memory,
that it is required for storing this pattern itself, and that it
never throws TooManyPointsInPatternError
.
For comparison, an attempt to do the same operation via getting all points (Pattern.points()
method),
correcting them and forming a new pattern via Patterns.newPattern(java.util.Collection)
will lead to TooManyPointsInPatternError
/ OutOfMemoryError for some forms of large patterns.
Warning: this method can fail with TooLargePatternCoordinatesException
, if some of new points
violate restrictions, described in the comments to this interface
,
section "Coordinate restrictions" (for example, due to very large shift).
However, TooLargePatternCoordinatesException
is impossible in many important cases, when
this pattern is an integer pattern and each coordinate
coord
(j)TooLargePatternCoordinatesException
in the following situations:
coordMin()
.symmetric()
,coordMax()
.symmetric()
,symmetric()
, where p is
some of the points
if this integer pattern.See more details in the comments to this interface
,
section "Coordinate restrictions", the theorem II.
shift
in interface Pattern
shift
in interface UniformGridPattern
shift
 the shift.DirectPointSetUniformGridPattern symmetric()
Pattern
multiply(1.0)
.
The returned pattern always implements DirectPointSetPattern
if this pattern implements DirectPointSetPattern
The returned pattern always implements RectangularPattern
if this pattern implements RectangularPattern
.
The returned pattern always implements UniformGridPattern
if this pattern implements UniformGridPattern
.
There is a guarantee, that this method does not try to allocate much more memory,
that it is required for storing this pattern itself, and that it
never throws TooManyPointsInPatternError
.
For comparison, an attempt to do the same operation via getting all points (Pattern.points()
method),
correcting them and forming a new pattern via Patterns.newPattern(java.util.Collection)
will lead to TooManyPointsInPatternError
/ OutOfMemoryError for some forms of large patterns.
symmetric
in interface Pattern
symmetric
in interface UniformGridPattern
DirectPointSetUniformGridPattern multiply(double multiplier)
Pattern
More precisely, the resulting pattern consists of the points,
obtained from all points of this pattern by the call
point.multiply
(multipliers).
This method is equivalent to Pattern.scale(double... multipliers)
, where all
Pattern.dimCount()
arguments of that method are equal to multiplier.
The returned pattern always implements DirectPointSetPattern
if this pattern implements DirectPointSetPattern
The returned pattern always implements RectangularPattern
if this pattern implements RectangularPattern
.
The returned pattern always implements UniformGridPattern
if this pattern implements UniformGridPattern
.
There is a guarantee, that this method does not try to allocate much more memory,
that it is required for storing this pattern itself, and that it
never throws TooManyPointsInPatternError
.
For comparison, an attempt to do the same operation via getting all points (Pattern.points()
method),
correcting them and forming a new pattern via Patterns.newPattern(java.util.Collection)
will lead to TooManyPointsInPatternError
/ OutOfMemoryError for some forms of large patterns.
Warning: this method can fail with TooLargePatternCoordinatesException
, if some of new points
violate restrictions, described in the comments to this interface
,
section "Coordinate restrictions" (for example, due to a very large multiplier).
However, such failure is obviously impossible, if the multiplier is
in range 1.0<=multiplier<=1.0.
multiply
in interface Pattern
multiply
in interface UniformGridPattern
multiplier
 the scale along all coordinates.Pattern.scale(double...)
DirectPointSetUniformGridPattern scale(double... multipliers)
Pattern
More precisely, the resulting pattern consists of the points,
obtained from all points of this pattern by the call
point.scale
(multipliers).
The returned pattern always implements DirectPointSetPattern
if this pattern implements DirectPointSetPattern
The returned pattern always implements RectangularPattern
if this pattern implements RectangularPattern
.
The returned pattern always implements UniformGridPattern
if this pattern implements UniformGridPattern
.
There is a guarantee, that this method does not try to allocate much more memory,
that it is required for storing this pattern itself, and that it
never throws TooManyPointsInPatternError
.
For comparison, an attempt to do the same operation via getting all points (Pattern.points()
method),
correcting them and forming a new pattern via Patterns.newPattern(java.util.Collection)
will lead to TooManyPointsInPatternError
/ OutOfMemoryError for some forms of large patterns.
Warning: this method can fail with TooLargePatternCoordinatesException
, if some of new points
violate restrictions, described in the comments to this interface
,
section "Coordinate restrictions" (for example, due to very large multipliers).
However, such failure is obviously impossible, if all multipliers are
in range 1.0<=multipliers[k]<=1.0.
scale
in interface Pattern
scale
in interface UniformGridPattern
multipliers
 the scales along coordinates.Pattern.multiply(double)
DirectPointSetUniformGridPattern projectionAlongAxis(int coordIndex)
Pattern
Pattern.dimCount()
) is less by 1, than in this one.
More precisely, the resulting pattern consists of the points,
obtained from all points of this pattern by the call
point.projectionAlongAxis
(coordIndex).
The returned pattern always implements DirectPointSetPattern
if this pattern implements DirectPointSetPattern
The returned pattern always implements RectangularPattern
if this pattern implements RectangularPattern
.
The returned pattern always implements UniformGridPattern
if this pattern implements UniformGridPattern
.
There is a guarantee, that this method does not try to allocate much more memory,
that it is required for storing this pattern itself, and that it
never throws TooManyPointsInPatternError
.
For comparison, an attempt to do the same operation via getting all points (Pattern.points()
method),
correcting them and forming a new pattern via Patterns.newPattern(java.util.Collection)
will lead to TooManyPointsInPatternError
/ OutOfMemoryError for some forms of large patterns.
projectionAlongAxis
in interface Pattern
projectionAlongAxis
in interface UniformGridPattern
coordIndex
 the index of the coordinate (0 for xaxis , 1 for yaxis,
2 for zaxis, etc.).Pattern.dimCount()
is equal to
thisInstance.Pattern.dimCount()
1).DirectPointSetUniformGridPattern minBound(int coordIndex)
Pattern
Pattern.dimCount()
) is the same as in this one.
In other words, this method removes some points from this pattern according the following rule:
if this pattern contains several points p_{0}, p_{1}, ...,
p_{m−1} with identical projection to the given axis
(p_{i}.projectionAlongAxis
(coordIndex).equals(p_{j}.projectionAlongAxis
(coordIndex)) for all i, j),
then the resulting pattern contains only one from these points, for which
the given coordinate coord
(coordIndex) has the minimal value.
This method is especially useful for uniformgrid
patterns.
For example, in rectangular patterns
this method returns
one of the facets of the hyperparallelepiped.
In most cases (including all rectangular patterns
)
this method returns the same result as UniformGridPattern.lowerSurface(int)
;
but if the figure, described by this pattern, contains some "holes", the result of this method
contains fewer points than UniformGridPattern.lowerSurface(int)
.
The returned pattern always implements DirectPointSetPattern
if this pattern implements DirectPointSetPattern
The returned pattern always implements RectangularPattern
if this pattern implements RectangularPattern
.
The returned pattern always implements UniformGridPattern
if this pattern implements UniformGridPattern
.
Warning! If this object is not DirectPointSetPattern
and is not RectangularPattern
, this method can work slowly for some large patterns:
the required time can be O(N), where N is the number of points.
In these cases, this method can also throw TooManyPointsInPatternError
or OutOfMemoryError. The situation is like in Pattern.points()
and Pattern.roundedPoints()
method.
There is a guarantee, that if this object implements DirectPointSetPattern
interface,
then this method requires not greater than O(N) memory
(N=pointCount()
)
and never throws TooManyPointsInPatternError
.
There is a guarantee, that if this object implements RectangularPattern
interface,
then this method works quickly (O(1) operations) and without exceptions.
minBound
in interface Pattern
minBound
in interface UniformGridPattern
coordIndex
 the index of the coordinate (0 for xaxis , 1 for yaxis,
2 for zaxis, etc.).Pattern.maxBound(int)
DirectPointSetUniformGridPattern maxBound(int coordIndex)
Pattern
Pattern.dimCount()
) is the same as in this one.
In other words, this method removes some points from this pattern according the following rule:
if this pattern contains several points p_{0}, p_{1}, ...,
p_{m−1} with identical projection to the given axis
(p_{i}.projectionAlongAxis
(coordIndex).equals(p_{j}.projectionAlongAxis
(coordIndex)) for all i, j),
then the resulting pattern contains only one from these points, for which
the given coordinate coord
(coordIndex) has the maximal value.
This method is especially useful for uniformgrid
patterns.
For example, in rectangular patterns
this method returns
one of the facets of the hyperparallelepiped.
In most cases (including all rectangular patterns
)
this method returns the same result as UniformGridPattern.upperSurface(int)
;
but if the figure, described by this pattern, contains some "holes", the result of this method
contains fewer points than UniformGridPattern.upperSurface(int)
.
The returned pattern always implements DirectPointSetPattern
if this pattern implements DirectPointSetPattern
The returned pattern always implements RectangularPattern
if this pattern implements RectangularPattern
.
The returned pattern always implements UniformGridPattern
if this pattern implements UniformGridPattern
.
Warning! If this object is not DirectPointSetPattern
and is not RectangularPattern
, this method can work slowly for some large patterns:
the required time can be O(N), where N is the number of points.
In these cases, this method can also throw TooManyPointsInPatternError
or OutOfMemoryError. The situation is like in Pattern.points()
and Pattern.roundedPoints()
method.
There is a guarantee, that if this object implements DirectPointSetPattern
interface,
then this method requires not greater than O(N) memory
(N=pointCount()
)
and never throws TooManyPointsInPatternError
.
There is a guarantee, that if this object implements RectangularPattern
interface,
then this method works quickly (O(1) operations) and without exceptions.
maxBound
in interface Pattern
maxBound
in interface UniformGridPattern
coordIndex
 the index of the coordinate (0 for xaxis , 1 for yaxis,
2 for zaxis, etc.).Pattern.minBound(int)
DirectPointSetUniformGridPattern gridIndexPattern()
UniformGridPattern
ordinary
integer pattern with the same set of grid indexes
i_{j}^{(k)} as this pattern.
In other words, if this pattern is a set of points
x_{0}^{(k)} = o_{0} + i_{0}^{(k)}d_{0}
x_{1}^{(k)} = o_{1} + i_{1}^{(k)}d_{1}
. . .
x_{n−1}^{(k)} = o_{n−1} + i_{n−1}^{(k)}d_{n−1}
(k=0,1,...,N−1, n=dimCount()
), then the returned pattern
consists of points
y_{0}^{(k)} = (double)i_{0}^{(k)}
y_{1}^{(k)} = (double)i_{1}^{(k)}
. . .
y_{n−1}^{(k)} = (double)i_{n−1}^{(k)}
Note: here is a guarantee, that all grid indexes i_{j} will be strictly
represented by double type.
Moreover, there is a guarantee that the returned pattern is correct, i.e. will be successfully built
without a risk of TooLargePatternCoordinatesException
.
See the comments to Pattern.MAX_COORDINATE
and the section "Grid index restrictions" in the comments to UniformGridPattern
interface.
You can use this method to get a set of all grid indexes (integer values):
it is enough to call Pattern.roundedPoints()
in the returned pattern.
The results will be the same as the result of UniformGridPattern.gridIndexes()
method.
The returned pattern always implements DirectPointSetPattern
if this pattern implements DirectPointSetPattern
.
The returned pattern always implements RectangularPattern
if this pattern implements RectangularPattern
.
There is a guarantee, that this method does not try to allocate much more memory,
that it is required for storing this pattern itself, and that it
never throws TooManyPointsInPatternError
.
This method works quickly enough: in the worst case,
it can require O(N) operations (N=pointCount()
).
gridIndexPattern
in interface UniformGridPattern
UniformGridPattern.gridIndexes()
DirectPointSetUniformGridPattern shiftGridIndexes(IPoint shift)
UniformGridPattern
add
(shift).
In other words, if this pattern is a set of points
x_{0}^{(k)} = o_{0} + i_{0}^{(k)}d_{0}
x_{1}^{(k)} = o_{1} + i_{1}^{(k)}d_{1}
. . .
x_{n−1}^{(k)} = o_{n−1} + i_{n−1}^{(k)}d_{n−1}
(k=0,1,...,N−1, n=dimCount()
), then the returned pattern
has the same grid oridin
, the same grid steps
and consists of points
y_{0}^{(k)} = o_{0} + (i_{0}^{(k)}+shift.coord
(0))*d_{0}
y_{1}^{(k)} = o_{1} + (i_{1}^{(k)}+shift.coord
(1))*d_{1}
. . .
y_{n−1}^{(k)} = o_{n−1} + (i_{n−1}^{(k)}+shift.coord
(n−1))*d_{n−1}
The returned pattern always implements DirectPointSetPattern
if this pattern implements DirectPointSetPattern
The returned pattern always implements RectangularPattern
if this pattern implements RectangularPattern
.
There is a guarantee, that this method does not try to allocate much more memory,
that it is required for storing this pattern itself, and that it
never throws TooManyPointsInPatternError
.
For comparison, an attempt to do the same operation via getting all grid indexes via
UniformGridPattern.gridIndexes()
call, correcting them and forming a new pattern via
Patterns.newUniformGridPattern(Point, double[], java.util.Collection)
will lead to TooManyPointsInPatternError
/ OutOfMemoryError for some forms of large patterns.
Warning: this method can fail with TooLargePatternCoordinatesException
, if some of new points
violate restrictions, described in the comments to Pattern
interface,
section "Coordinate restrictions", and in the comments to UniformGridPattern
interface,
section "Coordinate restrictions" (for example, due to very large shift).
Note: the similar results can be got with help of UniformGridPattern.shift(Point)
method
with a corresponding floatingpoint shift. However, this method
guarantees that the returned pattern has the same origin of the grid, but corrected grid indexes.
Unlike this, a good implementation of UniformGridPattern.shift(Point)
method just corrects the grid origin,
but does not change grid indexes. This difference is important, if you are going to get
the grid indexes from the shifted pattern via UniformGridPattern.gridIndexPattern()
or UniformGridPattern.gridIndexes()
method.
shiftGridIndexes
in interface UniformGridPattern
shift
 the shift of the grid indexes.DirectPointSetUniformGridPattern lowerSurface(int coordIndex)
UniformGridPattern
stepOfGrid(coordIndex)
dimCount()
) is the same as in this one.
In other words, the point
Please compare with UniformGridPattern.minBound(int)
method. This method can return a pattern
containing more points than UniformGridPattern.minBound(int)
, in particular, if this pattern contains some "holes".
The returned pattern always implements DirectPointSetPattern
if this pattern implements DirectPointSetPattern
The returned pattern always implements RectangularPattern
if this pattern implements RectangularPattern
.
Note: if this object is not DirectPointSetPattern
and is not RectangularPattern
, this method can work slowly for some large patterns:
the required time can be O(N), where N is the number of points.
In these cases, this method can also throw TooManyPointsInPatternError
or OutOfMemoryError. The situation is like in Pattern.points()
and Pattern.roundedPoints()
method.
However, this situation is possible only in custom implementation of this interface —
all implementations, provided by this package, implement either DirectPointSetPattern
or RectangularPattern
interface.
There is a guarantee, that if this object implements DirectPointSetPattern
interface,
then this method requires not greater than O(N) memory
(N=pointCount()
)
and never throws TooManyPointsInPatternError
.
There is a guarantee, that if this object implements RectangularPattern
interface,
then this method works quickly (O(1) operations) and without exceptions.
lowerSurface
in interface UniformGridPattern
coordIndex
 the index of the coordinate (0 for x, 1 for y, 2 for z, etc.)DirectPointSetUniformGridPattern upperSurface(int coordIndex)
UniformGridPattern
stepOfGrid(coordIndex)
dimCount()
) is the same as in this one.
In other words, the point
Please compare with UniformGridPattern.maxBound(int)
method. This method can return a pattern
containing more points than UniformGridPattern.maxBound(int)
, in particular, if this pattern contains some "holes".
The returned pattern always implements DirectPointSetPattern
if this pattern implements DirectPointSetPattern
The returned pattern always implements RectangularPattern
if this pattern implements RectangularPattern
.
Note: if this object is not DirectPointSetPattern
and is not RectangularPattern
, this method can work slowly for some large patterns:
the required time can be O(N), where N is the number of points.
In these cases, this method can also throw TooManyPointsInPatternError
or OutOfMemoryError. The situation is like in Pattern.points()
and Pattern.roundedPoints()
method.
However, this situation is possible only in custom implementation of this interface —
all implementations, provided by this package, implement either DirectPointSetPattern
or RectangularPattern
interface.
There is a guarantee, that if this object implements DirectPointSetPattern
interface,
then this method requires not greater than O(N) memory
(N=pointCount()
)
and never throws TooManyPointsInPatternError
.
There is a guarantee, that if this object implements RectangularPattern
interface,
then this method works quickly (O(1) operations) and without exceptions.
upperSurface
in interface UniformGridPattern
coordIndex
 the index of the coordinate (0 for x, 1 for y, 2 for z, etc.)