Module raytracer

Class Ray

java.lang.Object
de.grogra.ray.util.Ray

public class Ray extends Object
This class represents a light ray.
Author:
Ole Kniemeyer
  • Field Details

    • origin

      public final Point3f origin
      The ray origin in global coordinates. This field is only used in the context of Interior.attenuate(Interior.Input, Color3f) and the methods of Light and its subinterfaces.
    • direction

      public final Vector3f direction
      The ray direction. This direction unit vector is defined as the direction pointing away from a surface position in global coordinates. I.e., for an outgoing ray, it equals its direction, whereas for an incident ray, the direction is its negated direction.
    • color

      public final Spectrum3f color
      The ray color. Depending on context, this may represent BRDF-related values for the color components R, G, B, rather than simply an RGB color.
    • spectrum

      public final Spectrum spectrum
      The spectrum of the ray. Depending on context, this may represent the ray's spectral radiant power or other properties.
    • m_importance

      public float m_importance
    • directionDensity

      public float directionDensity
      The probability density of direction for this ray. This field is set by Shader.generateRandomRays and Light.generateRandomRays. If pω+ is the probability density that has been used for generating the random ray direction (measured with respect to projected solid angle ω+, i.e., dω+ = cos θ dω), then this field is set to pω+(direction). It is not defined for rays emanating from a directional light source. It may be Float.POSITIVE_INFINITY as a result of Shader.generateRandomRays, namely for ideal specular reflection or transmission.
    • originDensity

      public float originDensity
      The probability density of origin for this ray. This field is set by Light.generateRandomRays. If px is the probability density that has been used for generating the random ray origin, then this field is set to px(origin). It is not defined for rays emanating from a point light source.
    • reflected

      public boolean reflected
    • ambient

      public boolean ambient
    • valid

      public boolean valid
  • Constructor Details

    • Ray

      public Ray(Spectrum factory)
    • Ray

      public Ray()
    • Ray

      public Ray(Ray temp)
    • Ray

      public Ray(Point3f newOrigin, Vector3f newDirection, float probability)
    • Ray

      public Ray(Point3d newOrigin, Vector3d newDirection, float probability)
  • Method Details

    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getOrigin

      public Point3f getOrigin()
    • getDirection

      public Vector3f getDirection()
    • getColor

      public Color3f getColor()
    • getImportance

      public float getImportance()
    • setImportance

      public void setImportance(float value)
    • setRay

      public void setRay(Ray ray)
    • transform

      public void transform(Matrix4f mat, Ray ray)
    • transform

      public void transform(Matrix4d mat, Ray ray)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • convert2Line

      public Line convert2Line()