本文整理汇总了Java中org.apache.commons.math3.exception.util.LocalizedFormats.NOT_CONVEX_HYPERPLANES属性的典型用法代码示例。如果您正苦于以下问题:Java LocalizedFormats.NOT_CONVEX_HYPERPLANES属性的具体用法?Java LocalizedFormats.NOT_CONVEX_HYPERPLANES怎么用?Java LocalizedFormats.NOT_CONVEX_HYPERPLANES使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.apache.commons.math3.exception.util.LocalizedFormats
的用法示例。
在下文中一共展示了LocalizedFormats.NOT_CONVEX_HYPERPLANES属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildConvex
/** Build a convex region from a collection of bounding hyperplanes.
* @param hyperplanes collection of bounding hyperplanes
* @return a new convex region, or null if the collection is empty
*/
public Region<S> buildConvex(final Hyperplane<S> ... hyperplanes) {
if ((hyperplanes == null) || (hyperplanes.length == 0)) {
return null;
}
// use the first hyperplane to build the right class
final Region<S> region = hyperplanes[0].wholeSpace();
// chop off parts of the space
BSPTree<S> node = region.getTree(false);
node.setAttribute(Boolean.TRUE);
for (final Hyperplane<S> hyperplane : hyperplanes) {
if (node.insertCut(hyperplane)) {
node.setAttribute(null);
node.getPlus().setAttribute(Boolean.FALSE);
node = node.getMinus();
node.setAttribute(Boolean.TRUE);
} else {
// the hyperplane could not be inserted in the current leaf node
// either it is completely outside (which means the input hyperplanes
// are wrong), or it is parallel to a previous hyperplane
SubHyperplane<S> s = hyperplane.wholeHyperplane();
for (BSPTree<S> tree = node; tree.getParent() != null && s != null; tree = tree.getParent()) {
final Hyperplane<S> other = tree.getParent().getCut().getHyperplane();
final SplitSubHyperplane<S> split = s.split(other);
switch (split.getSide()) {
case HYPER :
// the hyperplane is parallel to a previous hyperplane
if (!hyperplane.sameOrientationAs(other)) {
// this hyperplane is opposite to the other one,
// the region is thinner than the tolerance, we consider it empty
return getComplement(hyperplanes[0].wholeSpace());
}
// the hyperplane is an extension of an already known hyperplane, we just ignore it
break;
case PLUS :
// the hyperplane is outside of the current convex zone,
// the input hyperplanes are inconsistent
throw new MathIllegalArgumentException(LocalizedFormats.NOT_CONVEX_HYPERPLANES);
default :
s = split.getMinus();
}
}
}
}
return region;
}