Package geometries

Class Tube

java.lang.Object
geometries.Geometry
geometries.Tube
All Implemented Interfaces:
Intersectible

public class Tube
extends Geometry
A Tube is a 3D tube object that goes on to infinity.
  • Field Summary

    Fields inherited from class geometries.Geometry

    material
  • Constructor Summary

    Constructors
    Constructor Description
    Tube​(Material material, Ray axis, double radius)
    Constructs a Tube with the source at the same source and direction as the given axis Ray.
  • Method Summary

    Modifier and Type Method Description
    geometries.Boundary boundary()
    Get the Boundary of this intersectible.
    java.util.List<Intersection> intersect​(LineSegment line)
    Calculates all the intersections between a given LineSegment and this object.
    NormalizedVector normal​(Point p)
    This function returns the normal to the tube at the given point.

    Methods inherited from class geometries.Geometry

    intersection

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Tube

      public Tube​(Material material, Ray axis, double radius)
      Constructs a Tube with the source at the same source and direction as the given axis Ray.
      Parameters:
      material - The Material the tube is made from.
      axis - The Ray from which to get the source and direction.
      radius - The distance from the axis to the surface.
      Throws:
      java.lang.IllegalArgumentException - if the radius is zero.
  • Method Details

    • normal

      public NormalizedVector normal​(Point p)
      This function returns the normal to the tube at the given point. If the point doesn't lie on the surface of the tube, the behavior is undefined.
      Specified by:
      normal in class Geometry
      Parameters:
      p - The Point to get the normal at.
      Returns:
      The normalized normal NonZeroVector
      Throws:
      ZeroVectorException - if the p is equal to the source @Point of the Tube.
    • intersect

      public java.util.List<Intersection> intersect​(LineSegment line)
      Description copied from interface: Intersectible
      Calculates all the intersections between a given LineSegment and this object.
      Parameters:
      line - The LineSegment to check for intersections.
      Returns:
      A list of all the intersections with the given LineSegment.
    • boundary

      public geometries.Boundary boundary()
      Description copied from interface: Intersectible
      Get the Boundary of this intersectible.
      Returns:
      The bounding box of this intersectible.