1
2
3
4
5
6
7
8
9
10 package nl.tudelft.simulation.language.d3;
11
12 import java.awt.geom.Point2D;
13
14 import javax.vecmath.Point3d;
15 import javax.vecmath.Point3f;
16 import javax.vecmath.Tuple3d;
17 import javax.vecmath.Tuple3f;
18
19 /***
20 * The location object <br>
21 * (c) copyright 2003 <a href="http://www.simulation.tudelft.nl">Delft
22 * University of Technology </a>, the Netherlands. <br>
23 * See for project information <a
24 * href="http://www.simulation.tudelft.nl">www.simulation.tudelft.nl </a> <br>
25 * License of use: <a href="http://www.gnu.org/copyleft/gpl.html">General Public
26 * License (GPL) </a>, no warranty <br>
27 *
28 * @version 2.0 21.09.2003 <br>
29 * @author <a href="http://www.tbm.tudelft.nl/webstaf/peterja/index.htm">Peter
30 * Jacobs </a>
31 */
32 public class DirectedPoint extends CartesianPoint
33 {
34 /*** rotX is the rotX */
35 private double rotX = 0.0;
36
37 /*** rotY is the rotY-value */
38 private double rotY = 0.0;
39
40 /*** rotZ is the rotZ-value */
41 private double rotZ = 0.0;
42
43 /***
44 * constructs a new DirectedPoint
45 */
46 public DirectedPoint()
47 {
48 super();
49 }
50
51 /***
52 * constructs a new DirectedPoint
53 *
54 * @param x the x value
55 * @param y the y value
56 * @param z the z value
57 */
58 public DirectedPoint(final double x, final double y, final double z)
59 {
60 super(x, y, z);
61 }
62
63 /***
64 * constructs a new DirectedPoint
65 *
66 * @param x the x value
67 * @param y the y value
68 * @param z the z value
69 * @param rotX rotX
70 * @param rotY rotY
71 * @param rotZ rotZ
72 */
73 public DirectedPoint(final double x, final double y, final double z,
74 final double rotX, final double rotY, final double rotZ)
75 {
76 super(x, y, z);
77 this.rotX = rotX;
78 this.rotY = rotY;
79 this.rotZ = rotZ;
80 }
81
82 /***
83 * constructs a new DirectedPoint
84 *
85 * @param point2D the point
86 * @param rotZ rotZ
87 */
88 public DirectedPoint(final Point2D point2D, final double rotZ)
89 {
90 super(point2D);
91 this.rotZ = rotZ;
92 }
93
94 /***
95 * constructs a new DirectedPoint
96 *
97 * @param xyz the xyx value
98 */
99 public DirectedPoint(final double[] xyz)
100 {
101 super(xyz);
102 }
103
104 /***
105 * constructs a new DirectedPoint
106 *
107 * @param cartesianPoint the cartesianPoint
108 */
109 public DirectedPoint(final Point3d cartesianPoint)
110 {
111 super(cartesianPoint);
112 }
113
114 /***
115 * constructs a new DirectedPoint
116 *
117 * @param sphericalPoint the sphericalPoint
118 */
119 public DirectedPoint(final SphericalPoint sphericalPoint)
120 {
121 this(sphericalPoint.toCartesianPoint());
122 }
123
124 /***
125 * constructs a new DirectedPoint
126 *
127 * @param location the location
128 */
129 public DirectedPoint(final DirectedPoint location)
130 {
131 super(location);
132 this.rotY = location.rotY;
133 this.rotZ = location.rotZ;
134 this.rotX = location.rotX;
135 }
136
137 /***
138 * constructs a new DirectedPoint
139 *
140 * @param point2D the point
141 */
142 public DirectedPoint(final Point2D point2D)
143 {
144 super(point2D);
145 }
146
147 /***
148 * constructs a new DirectedPoint
149 *
150 * @param point the point
151 */
152 public DirectedPoint(final Point3f point)
153 {
154 super(point);
155 }
156
157 /***
158 * constructs a new DirectedPoint
159 *
160 * @param tuple the point
161 */
162 public DirectedPoint(final Tuple3d tuple)
163 {
164 super(tuple);
165 }
166
167 /***
168 * constructs a new DirectedPoint
169 *
170 * @param tuple the point
171 */
172 public DirectedPoint(final Tuple3f tuple)
173 {
174 super(tuple);
175 }
176
177 /***
178 * returns ther rotY-value
179 *
180 * @return double
181 */
182 public double getRotY()
183 {
184 return this.rotY;
185 }
186
187 /***
188 * sets the rotY
189 *
190 * @param rotY the rotY-value
191 */
192 public void setRotY(final double rotY)
193 {
194 this.rotY = rotY;
195 }
196
197 /***
198 * returns the rotZ value
199 *
200 * @return double
201 */
202 public double getRotZ()
203 {
204 return this.rotZ;
205 }
206
207 /***
208 * sets the rotZ value
209 *
210 * @param rotZ the rotZ-value
211 */
212 public void setRotZ(final double rotZ)
213 {
214 this.rotZ = rotZ;
215 }
216
217 /***
218 * returns the rotX value
219 *
220 * @return double
221 */
222 public double getRotX()
223 {
224 return this.rotX;
225 }
226
227 /***
228 * sets the rotX
229 *
230 * @param rotX rotX-value
231 */
232 public void setRotX(final double rotX)
233 {
234 this.rotX = rotX;
235 }
236
237 /***
238 * @see java.lang.Object#toString()
239 */
240 public String toString()
241 {
242 return "[position=" + super.toString() + ";RotX=" + this.rotX
243 + ";RotY=" + this.rotY + ";RotZ=" + this.rotZ + "]";
244 }
245
246 /***
247 * @see java.lang.Object#clone()
248 */
249 public Object clone()
250 {
251 return new DirectedPoint(this.x, this.y, this.z, this.rotX, this.rotY,
252 this.rotZ);
253 }
254
255 /***
256 * @see java.lang.Object#equals(java.lang.Object)
257 */
258 public boolean equals(final Object arg0)
259 {
260 if (!(arg0 instanceof DirectedPoint))
261 {
262 return false;
263 }
264 DirectedPoint loc = (DirectedPoint) arg0;
265 return (super.equals(arg0) && loc.rotX == this.rotX
266 && loc.rotY == this.rotY && loc.rotZ == this.rotZ);
267 }
268
269 /***
270 * @see javax.vecmath.Tuple3d#equals(javax.vecmath.Tuple3d)
271 */
272 public boolean equals(final Tuple3d arg0)
273 {
274 return this.equals((Object) arg0);
275 }
276
277 /***
278 * @see java.lang.Object#hashCode()
279 */
280 public int hashCode()
281 {
282 return super.hashCode();
283 }
284 }