Java Code Examples for org.apache.commons.math3.geometry.partitioning.Region.Location#BOUNDARY
The following examples show how to use
org.apache.commons.math3.geometry.partitioning.Region.Location#BOUNDARY .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConvexHullGenerator2DAbstractTest.java From astor with GNU General Public License v2.0 | 6 votes |
protected final void checkPointsInsideHullRegion(final Collection<Vector2D> points, final ConvexHull2D hull, final boolean includesCollinearPoints) { final Collection<Vector2D> hullVertices = Arrays.asList(hull.getVertices()); final Region<Euclidean2D> region = hull.createRegion(); for (final Vector2D p : points) { Location location = region.checkPoint(p); Assert.assertTrue(location != Location.OUTSIDE); if (location == Location.BOUNDARY && includesCollinearPoints) { Assert.assertTrue(hullVertices.contains(p)); } } }
Example 2
Source File: ConvexHullGenerator2DAbstractTest.java From astor with GNU General Public License v2.0 | 6 votes |
protected final void checkPointsInsideHullRegion(final Collection<Vector2D> points, final ConvexHull2D hull, final boolean includesCollinearPoints) { final Collection<Vector2D> hullVertices = Arrays.asList(hull.getVertices()); final Region<Euclidean2D> region = hull.createRegion(); for (final Vector2D p : points) { Location location = region.checkPoint(p); Assert.assertTrue(location != Location.OUTSIDE); if (location == Location.BOUNDARY && includesCollinearPoints) { Assert.assertTrue(hullVertices.contains(p)); } } }
Example 3
Source File: ComponentInstanceStringConverter.java From AILibs with GNU Affero General Public License v3.0 | 5 votes |
private void resolveNumericParameter(final ComponentInstance componentInstance, final Parameter parameter, final String parameterName, final List<String> parameterRefinement) { ParameterRefinementConfiguration parameterRefinementConfiguration = this.componentParameters.get(componentInstance.getComponent()).get(parameter); NumericParameterDomain parameterDomain = ((NumericParameterDomain) parameter.getDefaultDomain()); Interval currentInterval = null; Interval nextInterval = new Interval(parameterDomain.getMin(), parameterDomain.getMax()); double parameterValue = Double.parseDouble(componentInstance.getParameterValues().get(parameterName)); double precision = parameterValue == 0 ? 0 : Math.ulp(parameterValue); while (true) { currentInterval = nextInterval; parameterRefinement.add(this.serializeInterval(currentInterval)); List<Interval> refinement = Util.getNumericParameterRefinement(nextInterval, parameterValue, parameterDomain.isInteger(), parameterRefinementConfiguration); if (refinement.isEmpty()) { break; } for (Interval interval : refinement) { if (interval.checkPoint(parameterValue, precision) == Location.INSIDE || interval.checkPoint(parameterValue, precision) == Location.BOUNDARY) { nextInterval = interval; break; } } } parameterRefinement.add(String.valueOf(parameterValue)); }
Example 4
Source File: Arc.java From astor with GNU General Public License v2.0 | 5 votes |
/** Check a point with respect to the arc. * @param point point to check * @return a code representing the point status: either {@link * Location#INSIDE}, {@link Location#OUTSIDE} or {@link Location#BOUNDARY} */ public Location checkPoint(final double point) { final double normalizedPoint = MathUtils.normalizeAngle(point, middle); if (normalizedPoint < lower - tolerance || normalizedPoint > upper + tolerance) { return Location.OUTSIDE; } else if (normalizedPoint > lower + tolerance && normalizedPoint < upper - tolerance) { return Location.INSIDE; } else { return (getSize() >= MathUtils.TWO_PI - tolerance) ? Location.INSIDE : Location.BOUNDARY; } }
Example 5
Source File: Interval.java From astor with GNU General Public License v2.0 | 5 votes |
/** Check a point with respect to the interval. * @param point point to check * @param tolerance tolerance below which points are considered to * belong to the boundary * @return a code representing the point status: either {@link * Location#INSIDE}, {@link Location#OUTSIDE} or {@link Location#BOUNDARY} * @since 3.1 */ public Location checkPoint(final double point, final double tolerance) { if (point < lower - tolerance || point > upper + tolerance) { return Location.OUTSIDE; } else if (point > lower + tolerance && point < upper - tolerance) { return Location.INSIDE; } else { return Location.BOUNDARY; } }
Example 6
Source File: Interval.java From astor with GNU General Public License v2.0 | 5 votes |
/** Check a point with respect to the interval. * @param point point to check * @param tolerance tolerance below which points are considered to * belong to the boundary * @return a code representing the point status: either {@link * Location#INSIDE}, {@link Location#OUTSIDE} or {@link Location#BOUNDARY} * @since 3.1 */ public Location checkPoint(final double point, final double tolerance) { if (point < lower - tolerance || point > upper + tolerance) { return Location.OUTSIDE; } else if (point > lower + tolerance && point < upper - tolerance) { return Location.INSIDE; } else { return Location.BOUNDARY; } }
Example 7
Source File: Interval.java From astor with GNU General Public License v2.0 | 5 votes |
/** Check a point with respect to the interval. * @param point point to check * @param tolerance tolerance below which points are considered to * belong to the boundary * @return a code representing the point status: either {@link * Location#INSIDE}, {@link Location#OUTSIDE} or {@link Location#BOUNDARY} * @since 3.1 */ public Location checkPoint(final double point, final double tolerance) { if (point < lower - tolerance || point > upper + tolerance) { return Location.OUTSIDE; } else if (point > lower + tolerance && point < upper - tolerance) { return Location.INSIDE; } else { return Location.BOUNDARY; } }
Example 8
Source File: Interval.java From astor with GNU General Public License v2.0 | 5 votes |
/** Check a point with respect to the interval. * @param point point to check * @param tolerance tolerance below which points are considered to * belong to the boundary * @return a code representing the point status: either {@link * Location#INSIDE}, {@link Location#OUTSIDE} or {@link Location#BOUNDARY} * @since 3.1 */ public Location checkPoint(final double point, final double tolerance) { if (point < lower - tolerance || point > upper + tolerance) { return Location.OUTSIDE; } else if (point > lower + tolerance && point < upper - tolerance) { return Location.INSIDE; } else { return Location.BOUNDARY; } }
Example 9
Source File: Arc.java From astor with GNU General Public License v2.0 | 5 votes |
/** Check a point with respect to the arc. * @param point point to check * @return a code representing the point status: either {@link * Location#INSIDE}, {@link Location#OUTSIDE} or {@link Location#BOUNDARY} */ public Location checkPoint(final double point) { final double normalizedPoint = MathUtils.normalizeAngle(point, middle); if (normalizedPoint < lower - tolerance || normalizedPoint > upper + tolerance) { return Location.OUTSIDE; } else if (normalizedPoint > lower + tolerance && normalizedPoint < upper - tolerance) { return Location.INSIDE; } else { return (getSize() >= MathUtils.TWO_PI - tolerance) ? Location.INSIDE : Location.BOUNDARY; } }
Example 10
Source File: Interval.java From astor with GNU General Public License v2.0 | 5 votes |
/** Check a point with respect to the interval. * @param point point to check * @param tolerance tolerance below which points are considered to * belong to the boundary * @return a code representing the point status: either {@link * Location#INSIDE}, {@link Location#OUTSIDE} or {@link Location#BOUNDARY} * @since 3.1 */ public Location checkPoint(final double point, final double tolerance) { if (point < lower - tolerance || point > upper + tolerance) { return Location.OUTSIDE; } else if (point > lower + tolerance && point < upper - tolerance) { return Location.INSIDE; } else { return Location.BOUNDARY; } }