Class RayIntersectionImpl

java.lang.Object
cz.fidentis.analyst.data.mesh.impl.MeshPointImpl
cz.fidentis.analyst.data.ray.impl.RayIntersectionImpl
All Implemented Interfaces:
IPosition, MeshPoint, RayIntersection, Serializable, Comparable<RayIntersection>

public class RayIntersectionImpl extends MeshPointImpl implements RayIntersection
The implementation of a ray intersection.
See Also:
  • Constructor Details

    • RayIntersectionImpl

      public RayIntersectionImpl(javax.vecmath.Point3d position, javax.vecmath.Vector3d normal, MeshTriangleImpl tri, boolean directHit)
      Constructor.
      Parameters:
      position - Intersection position, must not be null
      normal - normal of MeshPoint
      tri - triangle with which the ray intersects. Must not be null
      directHit - determines whether the position is in the ray's direction
      Throws:
      IllegalArgumentException - if some parameter is null
  • Method Details

    • getDistance

      public double getDistance()
      Description copied from interface: RayIntersection
      Returns distance from the ray's origin to this ray intersection.
      Specified by:
      getDistance in interface RayIntersection
      Returns:
      distance from the ray's origin to this ray intersection
    • getHitTriangle

      public MeshTriangle getHitTriangle()
      Description copied from interface: RayIntersection
      Returns hit triangle
      Specified by:
      getHitTriangle in interface RayIntersection
      Returns:
      hit triangle
    • isDirectHit

      public boolean isDirectHit()
      Description copied from interface: RayIntersection
      Determines if the ray intersection is in the direction of the ray (direct hit) or i opposite direction (indirect hit)
      Specified by:
      isDirectHit in interface RayIntersection
      Returns:
      true if the hit is in the ray's direction
    • setDistance

      public void setDistance(javax.vecmath.Point3d rayOrigin)
      Description copied from interface: RayIntersection
      Set the distance of the intersection point from the ray's origin. If the intersection point lies in the opposite direction than ray's normal, then a negative distance is set.
      Specified by:
      setDistance in interface RayIntersection
      Parameters:
      rayOrigin - The origin of the ray that has been used to compute this intersection
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class MeshPointImpl
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class MeshPointImpl
    • compareTo

      public int compareTo(RayIntersection o)
      Specified by:
      compareTo in interface Comparable<RayIntersection>
      Specified by:
      compareTo in interface RayIntersection