1 package demo;
2
3 import java.util.Iterator;
4
5 import org.djutils.draw.bounds.Bounds3d;
6 import org.djutils.draw.line.LineSegment2d;
7 import org.djutils.draw.point.Point2d;
8 import org.djutils.draw.point.Point3d;
9
10
11
12
13
14
15
16
17
18
19 public final class DrawableDemos
20 {
21
22
23
24 private DrawableDemos()
25 {
26
27 }
28
29
30
31
32
33 public static void main(final String... args)
34 {
35 Point2d p = new Point2d(12.34, 23.45);
36 System.out.println("The iterator of a point yields one point (the point itself):");
37 for (Iterator<? extends Point2d> iterator = p.getPoints(); iterator.hasNext();)
38 {
39 System.out.println(iterator.next());
40 }
41 LineSegment2d ls = new LineSegment2d(12.34, 23.45, 34.56, 45.67);
42 System.out.println("The iterator of a line segment yields two points (the start point and the end point):");
43 for (Iterator<? extends Point2d> iterator = ls.getPoints(); iterator.hasNext();)
44 {
45 System.out.println(iterator.next());
46 }
47 Bounds3d b = new Bounds3d(12.34, 23.45, 34.56, 45.67, 56.78, 67.89);
48 System.out.println("The iterator of a bounds3d yields eight points (the vertices of the bounds):");
49 for (Iterator<? extends Point3d> iterator = b.getPoints(); iterator.hasNext();)
50 {
51 System.out.println(iterator.next());
52 }
53
54 Point2d point2d = new Point2d(12.34, 23.45);
55 System.out.println("2D object has two dimensions: " + point2d.getDimensions());
56 Point3d point3d = new Point3d(12.34, 23.45, 34.56);
57 System.out.println("3D object has three dimensions: " + point3d.getDimensions());
58
59 }
60 }