1
2
3
4
5
6
7
8
9
10
11 package nl.tudelft.simulation.traffic.track;
12
13 import javax.media.j3d.Bounds;
14 import javax.vecmath.Point3d;
15
16 import nl.tudelft.simulation.language.d3.BoundingBox;
17 import nl.tudelft.simulation.language.d3.DirectedPoint;
18
19 /***
20 * A virtual track for deleting vehicles at the end of the studied track. <br>
21 * <br>
22 * (c) copyright 2003-2004 <a href="http://www.simulation.tudelft.nl">Delft
23 * University of Technology </a>, the Netherlands. <br>
24 * See for project information <a href="http://www.simulation.tudelft.nl">
25 * www.simulation.tudelft.nl </a> <br>
26 * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
27 * License (GPL) </a>, no warranty <br>
28 *
29 * @version May 30, 2004 <br>
30 * @author <a
31 * href="http://www.tbm.tudelft.nl/webstaf/alexandv/index.htm">Alexander
32 * Verbraeck </a> <br>
33 */
34 public class VirtualTrack extends Track
35 {
36 /***
37 * @param name
38 * @param startLink
39 * @param endLink
40 * @throws Exception
41 */
42 public VirtualTrack(final String name, TrackLinkInterface startLink,
43 TrackLinkInterface endLink) throws Exception
44 {
45 super(name, startLink, endLink);
46 }
47
48 /***
49 * @see nl.tudelft.simulation.traffic.track.TrackInterface#getLocationOfProgression(double)
50 */
51 public DirectedPoint getLocationOfProgression(final double progression)
52 {
53 double delta = progression / 1000.0;
54 Point3d startPoint = this.startLink.getPosition();
55 Point3d endPoint = this.endLink.getPosition();
56 double x = startPoint.x + delta * (endPoint.x - startPoint.x);
57 double y = startPoint.y + delta * (endPoint.y - startPoint.y);
58 double z = startPoint.z + delta * (endPoint.z - startPoint.z);
59 return new DirectedPoint(x, y, z, 0.0, 0.0, 0.0);
60 }
61
62 /***
63 * @see nl.tudelft.simulation.dsol.animation.LocatableInterface#getBounds()
64 */
65 public Bounds getBounds()
66 {
67 return new BoundingBox();
68 }
69
70 /***
71 * @see nl.tudelft.simulation.traffic.track.TrackInterface#getLength()
72 */
73 public double getLength()
74 {
75 return 1000.0;
76 }
77 }