View Javadoc

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