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 double getBoundingBoxRangeX() { return boundingBox.getMaxPoint().getX() - boundingBox.getMinPoint().getX(); }
public double getBoundingBoxRangeY() { return boundingBox.getMaxPoint().getY() - boundingBox.getMinPoint().getY(); }
boundingBoxes.get(i).getMaxPoint(maxPoint);
boundingBoxes.get(i).getMaxPoint(maxPoint);
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); }
/** * 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; }
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()) }; }
double boxWidthPercentageOfRoad = obstacle.getMaxPoint().getX() - xPercentageOfRoad; int insetPixels = 8; double obstaclePositionInPixels = midPointOfPanelInPixels + (xPercentageOfRoad * rangeOfMotionInPixels / 2.0);
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); }
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); }
int maxX = new Double(values.getMaxPoint().getX()).intValue(); int maxY = new Double(values.getMaxPoint().getY()).intValue();
public static QuadTreeForGroundHeightMap createHeightMap(ArrayList<Point3d> listOfPoints, 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(); Box bounds = new Box(minX, minY, maxX, maxY); QuadTreeForGroundParameters quadTreeParameters = new QuadTreeForGroundParameters(resolution, heightThreshold, quadTreeMaxMultiLevelZChangeToFilterNoise, maxSameHeightPointsPerNode, maxAllowableXYDistanceForAPointToBeConsideredClose, -1); QuadTreeForGroundHeightMap heightMap = new QuadTreeForGroundHeightMap(bounds, quadTreeParameters); for (Point3d point : listOfPoints) { heightMap.addPoint(point.getX(), point.getY(), point.getZ()); } return heightMap; } }