-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpathbb.java
More file actions
28 lines (25 loc) · 816 Bytes
/
pathbb.java
File metadata and controls
28 lines (25 loc) · 816 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import static svg.SVGPathBoundingBox.parsePath;
import svg.Path;
import java.util.Scanner;
public class pathbb {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Paste your path and press Enter: ");
String input = scanner.nextLine();
scanner.close();
Path p = null;
if ( input.length() < 6) System.exit(1);
try {
p = parsePath(input);
}
catch (Exception e) {
System.exit(1);
}
if ( p == null) System.exit(1);
System.out.print("Path bounding box:\n");
System.out.println("xmin = " + p.xmin);
System.out.println("ymin = " + p.ymin);
System.out.println("xmax = " + p.xmax);
System.out.print("ymax = " + p.ymax);
}
}