public static class Matrices.ConvexHyperpolyhedron extends Matrices.Region
Convex hyperpolyhedron: an intersection of several hyperparallelepiped
.
While creating regions of this class, it is always necessary to specify some containing
hyperparallelepiped. The coordinate ranges, returned by Matrices.Region.coordRanges()
method of this class,
are the corresponding ranges of the specified containing hyperparallelepiped.
More precisely, the region, specified by this class, consists of all such points
a_{00}x_{0} + a_{01}x_{1} + ... + a_{0,n−1}x_{n−1} ≤ b_{0},
a_{10}x_{0} + a_{11}x_{1} + ... + a_{1,n−1}x_{n−1} ≤ b_{1},
...,
a_{m−1,0}x_{0} + a_{m−1,1}x_{1} + ... + a_{m−1,n−1}x_{n−1} ≤ b_{m−1},
and also this point belongs to the specified containinghyperparallelepiped
:
coordRange
(k).min()
≤ x_{k} ≤coordRange
(k).max()
for all k=0,1,...,n−1.
The number of inequations m can be any nonnegative integer 0,1,2,... (the degenerated case m=0 is equivalent to the hyperparallelepiped).
Convex hyperpolyhedrons can be created by the following methods:
Matrices.Region.getConvexHyperpolyhedron(double[] a, double[] b, IRange... coordRanges)
,Matrices.Region.getSimplex(double[][] vertices)
,Matrices.Region.getTriangle2D(double x1, double y1, double x2, double y2, double x3, double y3)
,Matrices.Region.getTetrahedron3D(double x1, double y1, double z1,
double x2, double y2, double z2,
double x3, double y3, double z3,
double x4, double y4, double z4)
.In first method, you must directly specify the matrix A of coefficients a_{ij},
the vector b of coefficients b_{i} and the containing hyperparallelepiped.
(The containing hyperparallelepiped will be identical to the hyperparallelepiped, constructed
by Matrices.Region.getHyperparallelepiped(IRange... coordRanges)
method with the same coordRanges.)
Other 3 methods build a simplex
— a particular case of the convex hyperpolyhedron.
In these cases you need to specify its vertices only; necessary matrix A and vector b
are calculated automatically.
All calculations while building and processing hyperpolyhedrons are performed in strictfp mode, so the results are absolutely identical on all platforms.
This class is immutable and threadsafe: there are no ways to modify settings of the created instance.
Modifier and Type  Method and Description 

double[] 
a()
Returns the matrix A: coefficients of the left side of inequations, defining the halfspaces
(see the
comments to this class ). 
double[] 
b()
Returns the vector b: right sides of inequations, defining the halfspaces
(see the
comments to this class ). 
boolean 
contains(long... coordinates)
Returns true if and only if the point with the specified integer coordinates
belongs to this region.

Matrices.Region[] 
sectionAtLastCoordinate(long sectionCoordinateValue)
Finds the intersection of this region with the hyperplane, described by the equation
x_{n−1}=sectionCoordinateValue,
and returns this intersection as an array of

java.lang.String 
toString()
Returns a brief string description of this object.

checkSectionAtLastCoordinate, coordRange, coordRanges, getConvexHyperpolyhedron, getHyperparallelepiped, getParallelepiped3D, getPolygon2D, getRectangle2D, getSegment, getSimplex, getTetrahedron3D, getTriangle2D, isContainsSupported, isRectangular, n
public boolean contains(long... coordinates)
Matrices.Region
The coordinates must contain at least Matrices.Region.n()
elements.
It can contain more than Matrices.Region.n()
elements; then the extra elements will be ignored.
Warning! Some inheritors of this class does not provide correct implementation of this method.
In this case, Matrices.Region.isContainsSupported()
method returns false and this method throws
UnsupportedOperationException. So, you must always check the result of
Matrices.Region.isContainsSupported()
method before calling this one.
However, this method must be correctly implemented, if this region is a
Matrices.Region.n()
==1) and Matrices.Region.isRectangular()
method returns false.
Note: even if the inheritor does not provide correct implementation of this method,
it must always provide correct implementation of Matrices.Region.sectionAtLastCoordinate(long)
method.
contains
in class Matrices.Region
coordinates
 the coordinates of the point: the first element is x, the second is y, ...public Matrices.Region[] sectionAtLastCoordinate(long sectionCoordinateValue)
Matrices.Region
This method must not be used if this region is Matrices.Region.n()
==1). In this case, it throws IllegalStateException.
This default implementation is based on Matrices.Region.contains(long...)
method, which is supposed
to be correctly implemented.
Note: it is possible (in some rare exotic cases), that the regions, returned by this method,
intersects with each other: some points will belong to 2 and more elements of the result.
In particular, it is possible for Matrices.Polygon2D
,
if some sides of the polygon lie exactly at the horizontal y=sectionCoordinateValue.
Implementations of this method in this packages, besides the implementation in
Matrices.Polygon2D
class, never return more than 1 region in the result.
You must override this method if you prefer not to implement Matrices.Region.contains(long...)
method
(Matrices.Region.isContainsSupported()
returns false). In this case, your implementation
must not call Matrices.Region.contains(long...)
method or
Matrices.Region.sectionAtLastCoordinate(long)
sectionAtLastCoordinate
in class Matrices.Region
sectionCoordinateValue
 the value of the last coordinate.public java.lang.String toString()
The result of this method may depend on implementation.
toString
in class java.lang.Object
public double[] a()
comments to this class
).
The elements of the matrix A will be listed in the returned array row by row:
a_{ij}=a[i*n+j],
i is the index of the row (0..m1),
j is the index of the column (0..n1),
a is the result of this method with length a.length=nm.
The returned array is a clone of the internal array stored in this object.
public double[] b()
comments to this class
).
The elements of the vector b will be listed in the returned array.
The length of the returned array is the number of halfspaces.
The returned array is a clone of the internal array stored in this object.
Www.ltgr.ru Комплект замены ремня грм портер www.ltgr.ru. www.ltgr.ru 