Package toxi.geom

Class SphereIntersectorReflector

java.lang.Object
toxi.geom.SphereIntersectorReflector
All Implemented Interfaces:
Intersector3D, Reflector3D

public class SphereIntersectorReflector extends Object implements Intersector3D, Reflector3D
  • Constructor Details

    • SphereIntersectorReflector

      public SphereIntersectorReflector(Sphere s)
    • SphereIntersectorReflector

      public SphereIntersectorReflector(Vec3D o, float r)
  • Method Details

    • getIntersectionData

      public IsectData3D getIntersectionData()
      Specified by:
      getIntersectionData in interface Intersector3D
      Returns:
      intersection data parcel
    • getReflectedRayPointAtDistance

      public ReadonlyVec3D getReflectedRayPointAtDistance(float dist)
      Description copied from interface: Reflector3D
      Returns the point on the reflected ray at given distance from the intersection point
      Specified by:
      getReflectedRayPointAtDistance in interface Reflector3D
      Parameters:
      dist - distance from isect position
      Returns:
      point on reflected ray
    • getReflectionAngle

      public float getReflectionAngle()
      Specified by:
      getReflectionAngle in interface Reflector3D
      Returns:
      angle between incident ray and surface normal
    • getSphere

      public Sphere getSphere()
      Returns:
      the sphere
    • intersectRayDistance

      public float intersectRayDistance(Ray3D ray)
      Calculates the distance of the vector to the given sphere in the specified direction. A sphere is defined by a 3D point and a radius. Normalized directional vectors expected.
      Parameters:
      ray - intersection ray
      Returns:
      distance to sphere in world units, -1 if no intersection.
    • intersectsRay

      public boolean intersectsRay(Ray3D ray)
      Description copied from interface: Intersector3D
      Checks if entity intersects with the given ray. Further intersection details can then be queried via the IsectData3D instance returned by Intersector3D.getIntersectionData().
      Specified by:
      intersectsRay in interface Intersector3D
      Parameters:
      ray - ray to check
      Returns:
      true, if ray hits the entity
    • reflectRay

      public Ray3D reflectRay(Ray3D ray)
      Description copied from interface: Reflector3D
      Reflects given ray on the entity's surface
      Specified by:
      reflectRay in interface Reflector3D
      Parameters:
      ray - incident ray
      Returns:
      reflected ray starting from intersection point
    • setSphere

      public void setSphere(Sphere sphere)
      Parameters:
      sphere - the sphere to set