2 Copyright (C) 2001, 2006 United States Government
3 as represented by the Administrator of the
4 National Aeronautics and Space Administration.
7 package gov
.nasa
.worldwind
.geom
;
9 import gov
.nasa
.worldwind
.util
.Logging
;
13 * @version $Id: Intersection.java 2471 2007-07-31 21:50:57Z tgaskins $
15 public final class Intersection
// Instances are immutable
18 private final Vec4 intersectionPoint
;
19 private final boolean isTangent
;
22 * @param intersectionPoint
24 * @throws IllegalArgumentException if <code>intersectionpoint</code> is null
26 public Intersection(Vec4 intersectionPoint
, boolean isTangent
)
28 if (intersectionPoint
== null)
30 String message
= Logging
.getMessage("nullValue.IntersectionPointIsNull");
31 Logging
.logger().severe(message
);
32 throw new IllegalArgumentException(message
);
34 this.intersectionPoint
= intersectionPoint
;
35 this.isTangent
= isTangent
;
38 public final Vec4
getIntersectionPoint()
40 return intersectionPoint
;
43 public final boolean isTangent()
49 public boolean equals(Object o
)
53 if (o
== null || getClass() != o
.getClass())
56 final gov
.nasa
.worldwind
.geom
.Intersection that
= (gov
.nasa
.worldwind
.geom
.Intersection
) o
;
58 if (isTangent
!= that
.isTangent
)
60 //noinspection RedundantIfStatement
61 if (!intersectionPoint
.equals(that
.intersectionPoint
))
71 result
= intersectionPoint
.hashCode();
72 result
= 29 * result
+ (isTangent ?
1 : 0);
77 public String
toString()
79 String pt
= "Intersection Point: " + this.intersectionPoint
;
80 String tang
= this.isTangent ?
" is a tangent." : " not a tangent";