private void centerOnFocusPoint() { focusPoint.changeFrame(pixelsFrame); screenPosition.changeFrame(pixelsFrame); screenPosition.set(focusPoint); screenPosition.add(-getPlotterWidthPixels() / 2.0, getPlotterHeightPixels() / 2.0); updateFrames(); }
public void drawLineSegment(PlotterReferenceFrame frame, double firstPointX, double firstPointY, double secondPointX, double secondPointY) { PlotterPoint2d firstEndpoint = pointBin[0]; PlotterPoint2d secondEndpoint = pointBin[1]; firstEndpoint.setIncludingFrame(frame, firstPointX, firstPointY); secondEndpoint.setIncludingFrame(frame, secondPointX, secondPointY); firstEndpoint.changeFrame(screenFrame); secondEndpoint.changeFrame(screenFrame); drawLineSegment(pixelate(firstEndpoint.getX()), pixelate(firstEndpoint.getY()), pixelate(secondEndpoint.getX()), pixelate(secondEndpoint.getY())); }
public double getFocusPointX() { focusPoint.changeFrame(metersFrame); return focusPoint.getX(); }
public double getSelectedY() { selected.changeFrame(metersFrame); return selected.getY(); }
public void setFocusPointY(double focusPointY) { focusPoint.changeFrame(metersFrame); focusPoint.setY(focusPointY); centerOnFocusPoint(); }
origin.changeFrame(screenFrame); forAllArtifacts(86, new ArtifactIterator() imageFirstCorner.setToZero(); imageSecondCorner.set(backgroundImage.getWidth(), backgroundImage.getHeight()); graphics2d.drawImage(backgroundImage, upperLeftCorner, lowerRightCorner, imageFirstCorner, imageSecondCorner, panel); upperLeftCorner.changeFrame(pixelsFrame); lowerRightCorner.changeFrame(pixelsFrame); focusPoint.changeFrame(pixelsFrame); double gridStart = (Math.round(focusPoint.getX() / gridSizePixels.getX()) - 20.0) * gridSizePixels.getX(); double gridEnd = (Math.round(focusPoint.getX() / gridSizePixels.getX()) + 20.0) * gridSizePixels.getX(); gridLinePencil.setIncludingFrame(pixelsFrame, gridX, 0.0); tempGridLine.set(gridLinePencil.getX(), gridLinePencil.getY(), 0.0, 1.0); graphics2d.drawLine(pixelsFrame, tempGridLine); gridLinePencil.changeFrame(metersFrame); String labelString = FormattingTools.getFormattedToSignificantFigures(gridLinePencil.getX(), 2); gridLinePencil.changeFrame(pixelsFrame); origin.changeFrame(pixelsFrame); if (MathTools.epsilonEquals(screenRotation, 0.0, 1e-3) && origin.getY() > upperLeftCorner.getY() - 14) gridLinePencil.setY(upperLeftCorner.getY() - 14); else if (MathTools.epsilonEquals(screenRotation, 0.0, 1e-3) && origin.getY() < lowerRightCorner.getY())
selectionAreaEnd.changeFrame(screenFrame); selectionAreaEnd.set(mouseEvent.getX(), mouseEvent.getY()); middleMouseDragEnd.setIncludingFrame(screenFrame, mouseEvent.getX(), mouseEvent.getY()); double deltaDragY = middleMouseDragStart.getY() - middleMouseDragEnd.getY(); double deltaDragX = middleMouseDragStart.getX() - middleMouseDragEnd.getX(); focusPoint.setIncludingFrame(screenFrame, getPlotterWidthPixels() / 2.0, getPlotterHeightPixels() / 2.0); middleMouseDragStart.set(middleMouseDragEnd); rightMouseDragEnd.setIncludingFrame(screenFrame, mouseEvent.getX(), mouseEvent.getY()); focusPoint.changeFrame(screenFrame); rightMouseDragEnd.sub(rightMouseDragStart); screenRotation += 0.01 * (double) rightMouseDragEnd.getX(); rightMouseDragEnd.negate(); focusPoint.add(rightMouseDragEnd); panel.repaint(); rightMouseDragStart.setIncludingFrame(screenFrame, mouseEvent.getX(), mouseEvent.getY());
public void drawString(String string, PlotterPoint2d startPoint) { startPoint.changeFrame(screenFrame); drawString(string, pixelate(startPoint.getX()), pixelate(startPoint.getY())); }
public void changeFrame(PixelsReferenceFrame pixelsReferenceFrame) { if (getReferenceFrame() instanceof MetersReferenceFrame) { changeFrameAndProjectToXYPlane(ReferenceFrame.getWorldFrame()); scale(pixelsReferenceFrame.getConversionToPixels().getX(), pixelsReferenceFrame.getConversionToPixels().getY()); } super.changeFrameAndProjectToXYPlane(pixelsReferenceFrame); } }
screenPosition = new PlotterPoint2d(pixelsFrame); upperLeftCorner = new PlotterPoint2d(screenFrame); lowerRightCorner = new PlotterPoint2d(screenFrame); origin = new PlotterPoint2d(metersFrame); focusPoint = new PlotterPoint2d(screenFrame); gridLinePencil = new PlotterPoint2d(screenFrame); selected = new PlotterPoint2d(screenFrame); selectionAreaStart = new PlotterPoint2d(screenFrame); selectionAreaEnd = new PlotterPoint2d(screenFrame); imageFirstCorner = new PlotterPoint2d(screenFrame); imageSecondCorner = new PlotterPoint2d(screenFrame); labelPosition = new PlotterPoint2d(screenFrame); screenPosition.set(-getPlotterWidthPixels() / 2.0, getPlotterHeightPixels() / 2.0); focusPoint.setIncludingFrame(metersFrame, 0.0, 0.0);
public void setFocusPointX(double focusPointX) { focusPoint.changeFrame(metersFrame); focusPoint.setX(focusPointX); centerOnFocusPoint(); }
public Plotter2DAdapter(MetersReferenceFrame metersFrame, PixelsReferenceFrame screenFrame, PixelsReferenceFrame pixelsFrame) { this.metersFrame = metersFrame; this.screenFrame = screenFrame; this.pixelsFrame = pixelsFrame; for (int i = 0; i < pointBin.length; i++) { pointBin[i] = new PlotterPoint2d(metersFrame); vectorBin[i] = new PlotterVector2d(metersFrame); } }
public void setScale(double pixelsPerMeterX, double pixelsPerMeterY) { focusPoint.changeFrame(metersFrame); metersToPixels.set(pixelsPerMeterX, pixelsPerMeterY); centerOnFocusPoint(); }
public void drawImage(Image image, PlotterPoint2d firstCornerDestination, PlotterPoint2d secondCornerDesination, PlotterPoint2d firstCornerSource, PlotterPoint2d secondCornerSource, ImageObserver observer) { firstCornerDestination.changeFrame(screenFrame); secondCornerDesination.changeFrame(screenFrame); firstCornerSource.changeFrame(screenFrame); secondCornerSource.changeFrame(screenFrame); drawImage(image, pixelate(firstCornerDestination.getX()), pixelate(firstCornerDestination.getY()), pixelate(secondCornerDesination.getX()), pixelate(secondCornerDesination.getY()), pixelate(firstCornerSource.getX()), pixelate(firstCornerSource.getY()), pixelate(secondCornerSource.getX()), pixelate(secondCornerSource.getY()), observer); }
public void changeFrame(MetersReferenceFrame metersReferenceFrame) { if (getReferenceFrame() instanceof PixelsReferenceFrame) { changeFrameAndProjectToXYPlane(ReferenceFrame.getWorldFrame()); scale(metersReferenceFrame.getConversionToMeters().getX(), metersReferenceFrame.getConversionToMeters().getY()); } super.changeFrameAndProjectToXYPlane(metersReferenceFrame); }
public double getSelectedX() { selected.changeFrame(metersFrame); return selected.getX(); }
public double getFocusPointY() { focusPoint.changeFrame(metersFrame); return focusPoint.getY(); }
public void drawString(PlotterReferenceFrame frame, String string, Point2d startPoint) { PlotterPoint2d plotStart = pointBin[0]; plotStart.setIncludingFrame(frame, startPoint); plotStart.changeFrame(screenFrame); drawString(string, pixelate(plotStart.getX()), pixelate(plotStart.getY())); }
@Override protected void updateTransformToParent(RigidBodyTransform transformToParent) { screenPosition.changeFrame(pixelsFrame); transformToParent.setIdentity(); tempTranslation.set(screenPosition.getX() + getPlotterWidthPixels() / 2.0, screenPosition.getY() - getPlotterHeightPixels() / 2.0, 0.0); transformToParent.applyTranslation(tempTranslation); transformToParent.applyRotationZ(screenRotation); tempTranslation.set(-getPlotterWidthPixels() / 2.0, getPlotterHeightPixels() / 2.0, 0.0); transformToParent.applyTranslation(tempTranslation); transformToParent.applyRotationY(Math.PI); transformToParent.applyRotationZ(Math.PI); } };
public void drawPoint(PlotterReferenceFrame frame, Point2d point) { PlotterPoint2d plotterPoint = pointBin[0]; plotterPoint.setIncludingFrame(frame, point); plotterPoint.changeFrame(screenFrame); drawLineSegment(pixelate(plotterPoint.getX()), pixelate(plotterPoint.getY()), pixelate(plotterPoint.getX()), pixelate(plotterPoint.getY())); }