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 anordinaryinteger 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, unionDecompositionMethods inherited from interface net.algart.math.patterns.QuickPointCountPattern
isPointCountVeryLargeMethods 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:PatternReturns 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
DirectPointSetPatternif this pattern implementsDirectPointSetPatternThe returned pattern always implements
RectangularPatternif this pattern implementsRectangularPattern.The returned pattern always implements
UniformGridPatternif 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,
TooLargePatternCoordinatesExceptionis 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 ofTooLargePatternCoordinatesExceptionin the following situations:- shift is thisIntegerPattern.
coordMin().symmetric(), - shift is thisIntegerPattern.
coordMax().symmetric(), - shift is p.
symmetric(), where p is some of thepointsif this integer pattern.
See more details in the
comments to this interface, section "Coordinate restrictions", the theorem II.- Specified by:
shiftin interfacePattern- Specified by:
shiftin interfaceUniformGridPattern- Parameters:
shift- the shift.- Returns:
- the shifted pattern.
- shift is thisIntegerPattern.
-
symmetric
DirectPointSetUniformGridPattern symmetric()Description copied from interface:PatternReturns the symmetric pattern: equivalent tomultiply(-1.0).The returned pattern always implements
DirectPointSetPatternif this pattern implementsDirectPointSetPatternThe returned pattern always implements
RectangularPatternif this pattern implementsRectangularPattern.The returned pattern always implements
UniformGridPatternif 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:
symmetricin interfacePattern- Specified by:
symmetricin interfaceUniformGridPattern- Returns:
- the symmetric pattern.
-
multiply
Description copied from interface:PatternReturns 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
DirectPointSetPatternif this pattern implementsDirectPointSetPatternThe returned pattern always implements
RectangularPatternif this pattern implementsRectangularPattern.The returned pattern always implements
UniformGridPatternif 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:
multiplyin interfacePattern- Specified by:
multiplyin interfaceUniformGridPattern- Parameters:
multiplier- the scale along all coordinates.- Returns:
- the scaled pattern.
- See Also:
-
scale
Description copied from interface:PatternReturns 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
DirectPointSetPatternif this pattern implementsDirectPointSetPatternThe returned pattern always implements
RectangularPatternif this pattern implementsRectangularPattern.The returned pattern always implements
UniformGridPatternif 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:
scalein interfacePattern- Specified by:
scalein interfaceUniformGridPattern- Parameters:
multipliers- the scales along coordinates.- Returns:
- the scaled pattern.
- See Also:
-
projectionAlongAxis
Description copied from interface:PatternReturns 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
DirectPointSetPatternif this pattern implementsDirectPointSetPatternThe returned pattern always implements
RectangularPatternif this pattern implementsRectangularPattern.The returned pattern always implements
UniformGridPatternif 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:
projectionAlongAxisin interfacePattern- Specified by:
projectionAlongAxisin 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:PatternReturns 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-gridpatterns. For example, inrectangular patternsthis 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
DirectPointSetPatternif this pattern implementsDirectPointSetPatternThe returned pattern always implements
RectangularPatternif this pattern implementsRectangularPattern.The returned pattern always implements
UniformGridPatternif this pattern implementsUniformGridPattern.Warning! If this object is not
DirectPointSetPatternand 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 throwTooManyPointsInPatternErroror OutOfMemoryError. The situation is like inPattern.points()andPattern.roundedPoints()method.There is a guarantee, that if this object implements
DirectPointSetPatterninterface, then this method requires not greater than O(N) memory (N=pointCount()) and never throwsTooManyPointsInPatternError.There is a guarantee, that if this object implements
RectangularPatterninterface, then this method works quickly (O(1) operations) and without exceptions.- Specified by:
minBoundin interfacePattern- Specified by:
minBoundin 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:PatternReturns 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-gridpatterns. For example, inrectangular patternsthis 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
DirectPointSetPatternif this pattern implementsDirectPointSetPatternThe returned pattern always implements
RectangularPatternif this pattern implementsRectangularPattern.The returned pattern always implements
UniformGridPatternif this pattern implementsUniformGridPattern.Warning! If this object is not
DirectPointSetPatternand 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 throwTooManyPointsInPatternErroror OutOfMemoryError. The situation is like inPattern.points()andPattern.roundedPoints()method.There is a guarantee, that if this object implements
DirectPointSetPatterninterface, then this method requires not greater than O(N) memory (N=pointCount()) and never throwsTooManyPointsInPatternError.There is a guarantee, that if this object implements
RectangularPatterninterface, then this method works quickly (O(1) operations) and without exceptions.- Specified by:
maxBoundin interfacePattern- Specified by:
maxBoundin 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:UniformGridPatternReturns anordinaryinteger 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_COORDINATEand the section "Grid index restrictions" in the comments toUniformGridPatterninterface.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
DirectPointSetPatternif this pattern implementsDirectPointSetPattern.The returned pattern always implements
RectangularPatternif 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:
gridIndexPatternin 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:UniformGridPatternReturns 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 stepsand 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
DirectPointSetPatternif this pattern implementsDirectPointSetPatternThe returned pattern always implements
RectangularPatternif 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 toPatterninterface, section "Coordinate restrictions", and in the comments toUniformGridPatterninterface, 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:
shiftGridIndexesin interfaceUniformGridPattern- Parameters:
shift- the shift of the grid indexes.- Returns:
- the shifted pattern.
-
lowerSurface
Description copied from interface:UniformGridPatternReturns 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
DirectPointSetPatternif this pattern implementsDirectPointSetPatternThe returned pattern always implements
RectangularPatternif this pattern implementsRectangularPattern.Note: if this object is not
DirectPointSetPatternand 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 throwTooManyPointsInPatternErroror 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 eitherDirectPointSetPatternorRectangularPatterninterface.There is a guarantee, that if this object implements
DirectPointSetPatterninterface, then this method requires not greater than O(N) memory (N=pointCount()) and never throwsTooManyPointsInPatternError.There is a guarantee, that if this object implements
RectangularPatterninterface, then this method works quickly (O(1) operations) and without exceptions.- Specified by:
lowerSurfacein 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:UniformGridPatternReturns 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
DirectPointSetPatternif this pattern implementsDirectPointSetPatternThe returned pattern always implements
RectangularPatternif this pattern implementsRectangularPattern.Note: if this object is not
DirectPointSetPatternand 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 throwTooManyPointsInPatternErroror 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 eitherDirectPointSetPatternorRectangularPatterninterface.There is a guarantee, that if this object implements
DirectPointSetPatterninterface, then this method requires not greater than O(N) memory (N=pointCount()) and never throwsTooManyPointsInPatternError.There is a guarantee, that if this object implements
RectangularPatterninterface, then this method works quickly (O(1) operations) and without exceptions.- Specified by:
upperSurfacein 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.
-