Interface DirectPointSetUniformGridPattern
- All Superinterfaces:
DirectPointSetPattern
,Pattern
,QuickPointCountPattern
,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 point-set and uniform-grid: 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:
- Author:
- Daniel Alievsky
- See Also:
-
Field Summary
Fields inherited from interface net.algart.math.patterns.Pattern
MAX_COORDINATE
-
Method Summary
Modifier and TypeMethodDescriptionReturns anordinary
integer pattern with the same set of grid indexes ij(k) as this pattern.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 stepdj= , does not belong to this pattern.stepOfGrid(coordIndex)
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.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.multiply
(double multiplier) Returns this pattern, scaled by the specified multiplier along all coordinates.projectionAlongAxis
(int coordIndex) Returns the projection of this pattern along the given axis.scale
(double... multipliers) Returns this pattern, scaled by the specified multipliers along all coordinates.Returns this pattern, shifted by the argument.shiftGridIndexes
(IPoint shift) Returns another uniform-grid pattern, identical to this one with the only difference, that the grid indexi(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).Returns the symmetric pattern: equivalent tomultiply(-1.0)
.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 stepdj= , does not belong to this pattern.stepOfGrid(coordIndex)
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
Methods inherited from interface net.algart.math.patterns.QuickPointCountPattern
isPointCountVeryLarge
Methods inherited from interface net.algart.math.patterns.UniformGridPattern
carcass, gridIndexArea, gridIndexes, gridIndexMax, gridIndexMin, gridIndexRange, isActuallyRectangular, isOrdinary, originOfGrid, stepOfGrid, stepsOfGrid, stepsOfGridEqual, surface
-
Method Details
-
shift
Description copied from interface:Pattern
Returns this pattern, shifted by the argument.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 implementsDirectPointSetPattern
The returned pattern always implements
RectangularPattern
if this pattern implementsRectangularPattern
.The returned pattern always implements
UniformGridPattern
if this pattern implementsUniformGridPattern
.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 viaPatterns.newPattern(java.util.Collection)
will lead toTooManyPointsInPatternError
/ OutOfMemoryError for some forms of large patterns.Warning: this method can fail with
TooLargePatternCoordinatesException
, if some of new points violate restrictions, described in thecomments 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 coordinateXj=shift. of the argument is equal to −xj for some some pointcoord
(j)(x0, x1, ..., xn−1) of this pattern. In particular, you can use this method for integer patterns without a risk ofTooLargePatternCoordinatesException
in the following situations:- shift is thisIntegerPattern.
coordMin()
.symmetric()
, - shift is thisIntegerPattern.
coordMax()
.symmetric()
, - shift is p.
symmetric()
, where p is some of thepoints
if this integer pattern.
See more details in the
comments to this interface
, section "Coordinate restrictions", the theorem II.- Specified by:
shift
in interfacePattern
- Specified by:
shift
in interfaceUniformGridPattern
- Parameters:
shift
- the shift.- Returns:
- the shifted pattern.
- shift is thisIntegerPattern.
-
symmetric
DirectPointSetUniformGridPattern symmetric()Description copied from interface:Pattern
Returns the symmetric pattern: equivalent tomultiply(-1.0)
.The returned pattern always implements
DirectPointSetPattern
if this pattern implementsDirectPointSetPattern
The returned pattern always implements
RectangularPattern
if this pattern implementsRectangularPattern
.The returned pattern always implements
UniformGridPattern
if this pattern implementsUniformGridPattern
.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 viaPatterns.newPattern(java.util.Collection)
will lead toTooManyPointsInPatternError
/ OutOfMemoryError for some forms of large patterns.- Specified by:
symmetric
in interfacePattern
- Specified by:
symmetric
in interfaceUniformGridPattern
- Returns:
- the symmetric pattern.
-
multiply
Description copied from interface:Pattern
Returns this pattern, scaled by the specified multiplier along all coordinates.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 allPattern.dimCount()
arguments of that method are equal to multiplier.The returned pattern always implements
DirectPointSetPattern
if this pattern implementsDirectPointSetPattern
The returned pattern always implements
RectangularPattern
if this pattern implementsRectangularPattern
.The returned pattern always implements
UniformGridPattern
if this pattern implementsUniformGridPattern
.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 viaPatterns.newPattern(java.util.Collection)
will lead toTooManyPointsInPatternError
/ OutOfMemoryError for some forms of large patterns.Warning: this method can fail with
TooLargePatternCoordinatesException
, if some of new points violate restrictions, described in thecomments 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.- Specified by:
multiply
in interfacePattern
- Specified by:
multiply
in interfaceUniformGridPattern
- Parameters:
multiplier
- the scale along all coordinates.- Returns:
- the scaled pattern.
- See Also:
-
scale
Description copied from interface:Pattern
Returns this pattern, scaled by the specified multipliers along all coordinates.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 implementsDirectPointSetPattern
The returned pattern always implements
RectangularPattern
if this pattern implementsRectangularPattern
.The returned pattern always implements
UniformGridPattern
if this pattern implementsUniformGridPattern
.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 viaPatterns.newPattern(java.util.Collection)
will lead toTooManyPointsInPatternError
/ OutOfMemoryError for some forms of large patterns.Warning: this method can fail with
TooLargePatternCoordinatesException
, if some of new points violate restrictions, described in thecomments 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.- Specified by:
scale
in interfacePattern
- Specified by:
scale
in interfaceUniformGridPattern
- Parameters:
multipliers
- the scales along coordinates.- Returns:
- the scaled pattern.
- See Also:
-
projectionAlongAxis
Description copied from interface:Pattern
Returns the projection of this pattern along the given axis. The number of dimensions in the resulting 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 implementsDirectPointSetPattern
The returned pattern always implements
RectangularPattern
if this pattern implementsRectangularPattern
.The returned pattern always implements
UniformGridPattern
if this pattern implementsUniformGridPattern
.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 viaPatterns.newPattern(java.util.Collection)
will lead toTooManyPointsInPatternError
/ OutOfMemoryError for some forms of large patterns.- Specified by:
projectionAlongAxis
in interfacePattern
- Specified by:
projectionAlongAxis
in interfaceUniformGridPattern
- Parameters:
coordIndex
- the index of the coordinate (0 for x-axis , 1 for y-axis, 2 for za-xis, etc.).- Returns:
- the projection of this pattern (its
Pattern.dimCount()
is equal to thisInstance.Pattern.dimCount()
-1).
-
minBound
Description copied from interface:Pattern
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. The number of dimensions in the resulting 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 p0, p1, ..., pm−1 with identical projection to the given axis (pi.
projectionAlongAxis
(coordIndex).equals(pj.projectionAlongAxis
(coordIndex)) for all i, j), then the resulting pattern contains only one from these points, for which the given coordinatecoord
(coordIndex) has the minimal value.This method is especially useful for
uniform-grid
patterns. For example, inrectangular patterns
this method returns one of the facets of the hyperparallelepiped. In most cases (including allrectangular patterns
) this method returns the same result asUniformGridPattern.lowerSurface(int)
; but if the figure, described by this pattern, contains some "holes", the result of this method contains fewer points thanUniformGridPattern.lowerSurface(int)
.The returned pattern always implements
DirectPointSetPattern
if this pattern implementsDirectPointSetPattern
The returned pattern always implements
RectangularPattern
if this pattern implementsRectangularPattern
.The returned pattern always implements
UniformGridPattern
if this pattern implementsUniformGridPattern
.Warning! If this object is not
DirectPointSetPattern
and is notRectangularPattern
, 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 throwTooManyPointsInPatternError
or OutOfMemoryError. The situation is like inPattern.points()
andPattern.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 throwsTooManyPointsInPatternError
.There is a guarantee, that if this object implements
RectangularPattern
interface, then this method works quickly (O(1) operations) and without exceptions.- Specified by:
minBound
in interfacePattern
- Specified by:
minBound
in interfaceUniformGridPattern
- Parameters:
coordIndex
- the index of the coordinate (0 for x-axis , 1 for y-axis, 2 for za-xis, etc.).- Returns:
- the minimal boundary of this pattern for the given axis.
- See Also:
-
maxBound
Description copied from interface:Pattern
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. The number of dimensions in the resulting 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 p0, p1, ..., pm−1 with identical projection to the given axis (pi.
projectionAlongAxis
(coordIndex).equals(pj.projectionAlongAxis
(coordIndex)) for all i, j), then the resulting pattern contains only one from these points, for which the given coordinatecoord
(coordIndex) has the maximal value.This method is especially useful for
uniform-grid
patterns. For example, inrectangular patterns
this method returns one of the facets of the hyperparallelepiped. In most cases (including allrectangular patterns
) this method returns the same result asUniformGridPattern.upperSurface(int)
; but if the figure, described by this pattern, contains some "holes", the result of this method contains fewer points thanUniformGridPattern.upperSurface(int)
.The returned pattern always implements
DirectPointSetPattern
if this pattern implementsDirectPointSetPattern
The returned pattern always implements
RectangularPattern
if this pattern implementsRectangularPattern
.The returned pattern always implements
UniformGridPattern
if this pattern implementsUniformGridPattern
.Warning! If this object is not
DirectPointSetPattern
and is notRectangularPattern
, 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 throwTooManyPointsInPatternError
or OutOfMemoryError. The situation is like inPattern.points()
andPattern.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 throwsTooManyPointsInPatternError
.There is a guarantee, that if this object implements
RectangularPattern
interface, then this method works quickly (O(1) operations) and without exceptions.- Specified by:
maxBound
in interfacePattern
- Specified by:
maxBound
in interfaceUniformGridPattern
- Parameters:
coordIndex
- the index of the coordinate (0 for x-axis , 1 for y-axis, 2 for za-xis, etc.).- Returns:
- the maximal boundary of this pattern for the given axis.
- See Also:
-
gridIndexPattern
DirectPointSetUniformGridPattern gridIndexPattern()Description copied from interface:UniformGridPattern
Returns anordinary
integer pattern with the same set of grid indexes ij(k) as this pattern. In other words, if this pattern is a set of pointsx0(k) = o0 + i0(k)d0
x1(k) = o1 + i1(k)d1
. . .
xn−1(k) = on−1 + in−1(k)dn−1(k=0,1,...,N−1, n=
dimCount()
), then the returned pattern consists of pointsy0(k) = (double)i0(k)
y1(k) = (double)i1(k)
. . .
yn−1(k) = (double)in−1(k)Note: here is a guarantee, that all grid indexes ij 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 toPattern.MAX_COORDINATE
and the section "Grid index restrictions" in the comments toUniformGridPattern
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 ofUniformGridPattern.gridIndexes()
method.The returned pattern always implements
DirectPointSetPattern
if this pattern implementsDirectPointSetPattern
.The returned pattern always implements
RectangularPattern
if this pattern implementsRectangularPattern
.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()
).- Specified by:
gridIndexPattern
in interfaceUniformGridPattern
- Returns:
- an ordinary integer pattern, consisting of all grid indexes of this pattern (represented by double values).
- See Also:
-
shiftGridIndexes
Description copied from interface:UniformGridPattern
Returns another uniform-grid pattern, identical to this one with the only difference, that the grid indexi(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). In other words, if this pattern is a set of pointsx0(k) = o0 + i0(k)d0
x1(k) = o1 + i1(k)d1
. . .
xn−1(k) = on−1 + in−1(k)dn−1(k=0,1,...,N−1, n=
dimCount()
), then the returned pattern has the samegrid oridin
, the samegrid steps
and consists of pointsy0(k) = o0 + (i0(k)+shift.
coord
(0))*d0
y1(k) = o1 + (i1(k)+shift.coord
(1))*d1
. . .
yn−1(k) = on−1 + (in−1(k)+shift.coord
(n−1))*dn−1The returned pattern always implements
DirectPointSetPattern
if this pattern implementsDirectPointSetPattern
The returned pattern always implements
RectangularPattern
if this pattern implementsRectangularPattern
.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 viaUniformGridPattern.gridIndexes()
call, correcting them and forming a new pattern viaPatterns.newUniformGridPattern(Point, double[], java.util.Collection)
will lead toTooManyPointsInPatternError
/ 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 toPattern
interface, section "Coordinate restrictions", and in the comments toUniformGridPattern
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 floating-point 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 ofUniformGridPattern.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 viaUniformGridPattern.gridIndexPattern()
orUniformGridPattern.gridIndexes()
method.- Specified by:
shiftGridIndexes
in interfaceUniformGridPattern
- Parameters:
shift
- the shift of the grid indexes.- Returns:
- the shifted pattern.
-
lowerSurface
Description copied from interface:UniformGridPattern
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 stepdj= , does not belong to this pattern. The number of dimensions in the resulting pattern (stepOfGrid(coordIndex)
dimCount()
) is the same as in this one.In other words, the point
A = (x0, x1, ..., xj, ..., xn−1) belongs to the returned pattern if and only if it belongs to this pattern and the pointB = (x0, x1, ..., xj−dj, ..., xn−1) (corresponding to decreasing the grid index ij by 1) does not belong to this pattern.Please compare with
UniformGridPattern.minBound(int)
method. This method can return a pattern containing more points thanUniformGridPattern.minBound(int)
, in particular, if this pattern contains some "holes".The returned pattern always implements
DirectPointSetPattern
if this pattern implementsDirectPointSetPattern
The returned pattern always implements
RectangularPattern
if this pattern implementsRectangularPattern
.Note: if this object is not
DirectPointSetPattern
and is notRectangularPattern
, 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 throwTooManyPointsInPatternError
or OutOfMemoryError. The situation is like inPattern.points()
andPattern.roundedPoints()
method. However, this situation is possible only in custom implementation of this interface — all implementations, provided by this package, implement eitherDirectPointSetPattern
orRectangularPattern
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 throwsTooManyPointsInPatternError
.There is a guarantee, that if this object implements
RectangularPattern
interface, then this method works quickly (O(1) operations) and without exceptions.- Specified by:
lowerSurface
in interfaceUniformGridPattern
- Parameters:
coordIndex
- the index of the coordinate (0 for x, 1 for y, 2 for z, etc.)- Returns:
- the "lower boundary" of this pattern: new pattern consisting of all points of this pattern, which have no leftward neighbour along the given coordinate.
-
upperSurface
Description copied from interface:UniformGridPattern
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 stepdj= , does not belong to this pattern. The number of dimensions in the resulting pattern (stepOfGrid(coordIndex)
dimCount()
) is the same as in this one.In other words, the point
A = (x0, x1, ..., xj, ..., xn−1) belongs to the returned pattern if and only if it belongs to this pattern and the pointB = (x0, x1, ..., xj+dj, ..., xn−1) (corresponding to increasing the grid index ij by 1) does not belong to this pattern.Please compare with
UniformGridPattern.maxBound(int)
method. This method can return a pattern containing more points thanUniformGridPattern.maxBound(int)
, in particular, if this pattern contains some "holes".The returned pattern always implements
DirectPointSetPattern
if this pattern implementsDirectPointSetPattern
The returned pattern always implements
RectangularPattern
if this pattern implementsRectangularPattern
.Note: if this object is not
DirectPointSetPattern
and is notRectangularPattern
, 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 throwTooManyPointsInPatternError
or OutOfMemoryError. The situation is like inPattern.points()
andPattern.roundedPoints()
method. However, this situation is possible only in custom implementation of this interface — all implementations, provided by this package, implement eitherDirectPointSetPattern
orRectangularPattern
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 throwsTooManyPointsInPatternError
.There is a guarantee, that if this object implements
RectangularPattern
interface, then this method works quickly (O(1) operations) and without exceptions.- Specified by:
upperSurface
in interfaceUniformGridPattern
- Parameters:
coordIndex
- the index of the coordinate (0 for x, 1 for y, 2 for z, etc.)- Returns:
- the "upper boundary" of this pattern: new pattern consisting of all points of this pattern, which have no rightward neighbour along the given coordinate.
-