import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.paint.Color;
import javafx.scene.shape.Polygon;
import javafx.scene.transform.Translate;
import javafx.stage.Screen;
import javafx.stage.Stage;

public class PolygonTest extends Application {

    private static final Double LARGE_X_COORDINATE = 4194304.250;
    private static final Double SCENE_WIDTH = 600.0;

    @Override
    public void start(Stage stage) {
        double dpiScale = Screen.getPrimary().getOutputScaleX();

        Double longWidth = LARGE_X_COORDINATE / dpiScale + SCENE_WIDTH + 0.001;

        Polygon veryWidePolygon = new Polygon(0.0, 0.0,
                longWidth, 50.0,
                longWidth, 100.0,
                0.0, 100.0);
        veryWidePolygon.setFill(Color.STEELBLUE);
        veryWidePolygon.setStroke(Color.RED);

        Group group = new Group(veryWidePolygon);
        group.getTransforms().add(new Translate(-longWidth + SCENE_WIDTH, 100.0));
        Scene scene = new Scene(group, SCENE_WIDTH, 400, Color.LIGHTGRAY);
        stage.setScene(scene);
        stage.setTitle("DPI scale: " + dpiScale);
        stage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }

}
