private static Line2D createSemiInfiniteLine(Point2D start, Point2D unitvector, Graphics2D g) {
Rectangle bounds = g.getDeviceConfiguration().getBounds();
try {
AffineTransform invtrans = g.getTransform().createInverse();
Point2D widthpoint = invtrans.deltaTransform(new Point2D.Double(bounds.width,0), null);
Point2D heightpoint = invtrans.deltaTransform(new Point2D.Double(0,bounds.height), null);
// Here we should end up with a gross overestimate of the maximum viewport diagonal in what
// Graphics2D calls 'user space'. Essentially a manhattan distance of manhattan distances.
// This can be used as a safe length of line to generate which will always go off-viewport.
double linelength = Math.abs(widthpoint.getX()) + Math.abs(widthpoint.getY()) + Math.abs(heightpoint.getX()) + Math.abs(heightpoint.getY());