public double getBoundingBoxRangeY() { return boundingBox.getMaxPoint().getY() - boundingBox.getMinPoint().getY(); }
private ArrayList<Point2d> filterOutOffscreenIntersections(ArrayList<Point2d> intersections) { ArrayList<Point2d> intersectionsOnScreen = new ArrayList<Point2d>(); BoundingBox2d screen = new BoundingBox2d(new Point2d(), new Point2d(screenDimension.getWidth(), screenDimension.getHeight())); for (Point2d intersection : intersections) { if (screen.isInside(intersection)) { intersectionsOnScreen.add(intersection); } } return intersectionsOnScreen; }
public BoundingBox2d(double[] min, double[] max) { this.minPoint = new Point2d(min); this.maxPoint = new Point2d(max); checkPoint(); }
for (int i = 0; i < boundingBoxes.size(); i++) boundingBoxes.get(i).getCenterPointCopy(center); midPointsY[i] = center.getY(); boundingBoxes.get(i).getMinPoint(minPoint); boundingBoxes.get(i).getMaxPoint(maxPoint);
for (BoundingBox2d values : boundingBoxes) int minX = new Double(values.getMinPoint().getX()).intValue(); int minY = new Double(values.getMinPoint().getY()).intValue(); int maxX = new Double(values.getMaxPoint().getX()).intValue(); int maxY = new Double(values.getMaxPoint().getY()).intValue(); BoundingBox2d boundingBox2d = new BoundingBox2d(new Point2d(offsetPercentageOfRoad, 0.0), new Point2d(offsetPercentageOfRoad + boxWidthPercentageOfRoad, 1.0)); obstacles.add(boundingBox2d);
private Point2d getClosestObstacle() { Point2d closestObstacle = new Point2d(0.0, 0.0); System.out.println("boundingBox.size() = " + boundingBoxes.size()); for (BoundingBox2d values : boundingBoxes) { int minX = new Double(values.getMinPoint().getX()).intValue(); int minY = new Double(values.getMinPoint().getY()).intValue(); if (minY > closestObstacle.getY()) { closestObstacle = new Point2d(minX, minY); } } System.out.println("closestObstacle = " + closestObstacle); return closestObstacle; }
public BoundingBox2d getBoundingBoxCopy() { checkIfUpToDate(); BoundingBox2d ret = new BoundingBox2d(boundingBox); return ret; }
for (int i = 0; i < boundingBoxes.size(); i++) boundingBoxes.get(i).getCenterPointCopy(center); midPointsX[i] = center.getX(); boundingBoxes.get(i).getMinPoint(minPoint); boundingBoxes.get(i).getMaxPoint(maxPoint);
BoundingBox2d bounds = new BoundingBox2d(new Point2d(x0, y0), new Point2d(x1, y1)); boundingBoxes.add(bounds);
public double getBoundingBoxRangeX() { return boundingBox.getMaxPoint().getX() - boundingBox.getMinPoint().getX(); }
public BoundingBox2d(double minX, double minY, double maxX, double maxY) { this.minPoint = new Point2d(minX, minY); this.maxPoint = new Point2d(maxX, maxY); checkPoint(); }
public static Graphics3DNode drawHeightMap(QuadTreeHeightMapInterface heightMap, SimulationConstructionSet scs, BoundingBox2d rangeOfPointsToDraw, double resolution) { double minX = rangeOfPointsToDraw.getMinPoint().getX(); double minY = rangeOfPointsToDraw.getMinPoint().getY(); double maxX = rangeOfPointsToDraw.getMaxPoint().getX(); double maxY = rangeOfPointsToDraw.getMaxPoint().getY(); return drawHeightMap(heightMap, scs, minX, minY, maxX, maxY, resolution); }
public BoundingBox2d(Point2d min, Point2d max) { this.minPoint = new Point2d(min); this.maxPoint = new Point2d(max); checkPoint(); }
/** * Determines if the point is inside the bounding box of the convex polygon. */ public static boolean isPointInBoundingBox(double pointX, double pointY, double epsilon, ConvexPolygon2d polygon) { BoundingBox2d boundingBox = polygon.getBoundingBox(); if (pointX < boundingBox.getMinPoint().getX() - epsilon) return false; if (pointY < boundingBox.getMinPoint().getY() - epsilon) return false; if (pointX > boundingBox.getMaxPoint().getX() + epsilon) return false; if (pointY > boundingBox.getMaxPoint().getY() + epsilon) return false; return true; }
public void set(double minX, double minY, double maxX, double maxY) { this.minPoint.set(minX, minY); this.maxPoint.set(maxX, maxY); checkPoint(); }
private static OneDimensionalBounds[] toBounds(BoundingBox2d bounds) { return new OneDimensionalBounds[] { new OneDimensionalBounds(bounds.getMinPoint().getX(), bounds.getMaxPoint().getX()), new OneDimensionalBounds(bounds.getMinPoint().getY(), bounds.getMaxPoint().getY()) }; }
public void set(BoundingBox2d boundingBox) { this.minPoint.set(boundingBox.minPoint); this.maxPoint.set(boundingBox.maxPoint); checkPoint(); }
public void paint(Graphics graphics) { Color originalGraphicsColor = graphics.getColor(); graphics.setColor(Color.red); Graphics2D g2d = (Graphics2D) graphics; Stroke originalStroke = g2d.getStroke(); g2d.setStroke(new BasicStroke(lineThickness)); for (BoundingBox2d boundingBox : boundingBoxes) { int x = new Double(boundingBox.getMinPoint().getX()).intValue(); int y = new Double(boundingBox.getMinPoint().getY()).intValue(); int width = new Double(boundingBox.getMaxPoint().getX() - boundingBox.getMinPoint().getX()).intValue(); int height = new Double(boundingBox.getMaxPoint().getY() - boundingBox.getMinPoint().getY()).intValue(); graphics.drawRect(x, y, width, height); graphics.setColor(Color.cyan); graphics.fillOval(x, y, 5, 5); } graphics.setColor(originalGraphicsColor); g2d.setStroke(originalStroke); } }
public static QuadTreeForGroundHeightMap createHeightMap(us.ihmc.graphicsDescription.HeightMap inputHeightMap, BoundingBox2d testingRange, double resolution, double heightThreshold, double quadTreeMaxMultiLevelZChangeToFilterNoise, int maxSameHeightPointsPerNode, double maxAllowableXYDistanceForAPointToBeConsideredClose, int maxNodes) { double minX = testingRange.getMinPoint().getX(); double maxX = testingRange.getMaxPoint().getX(); double minY = testingRange.getMinPoint().getY(); double maxY = testingRange.getMaxPoint().getY(); ArrayList<Point3d> listOfPoints = new ArrayList<Point3d>(); for (double x = minX; x < maxX; x = x + resolution) { for (double y = minY; y < maxY; y = y + resolution) { double z = inputHeightMap.heightAt(x, y, 0.0); listOfPoints.add(new Point3d(x, y, z)); } } return createHeightMap(listOfPoints, testingRange, resolution, heightThreshold, quadTreeMaxMultiLevelZChangeToFilterNoise, maxSameHeightPointsPerNode, maxAllowableXYDistanceForAPointToBeConsideredClose, maxNodes); }
public PolygonArtifact(String id, boolean fill, Color color, BoundingBox2d boundingBox2d) { super(id); setLevel(2); FILL_POLYGON = fill; this.color = color; Point2d minPoint = new Point2d(); boundingBox2d.getMinPoint(minPoint); Point2d maxPoint = new Point2d(); boundingBox2d.getMaxPoint(maxPoint); Point2d leftUpper = new Point2d(minPoint.getX(), maxPoint.getY()); Point2d rightLower = new Point2d(maxPoint.getX(), minPoint.getY()); ArrayList<Point2d> points = new ArrayList<Point2d>(); points.add(minPoint); points.add(leftUpper); points.add(maxPoint); points.add(rightLower); setPoints(points); }