JPBRT 0.5

org.jpbrt.core
Class GeometricPrimitive

java.lang.Object
  extended by org.jpbrt.core.Primitive
      extended by org.jpbrt.core.GeometricPrimitive

public class GeometricPrimitive
extends Primitive

GeometricPrimitive represents a single shape (e.g., a sphere) in the scene. One geometric primitive is allocated for each shape in the scene description provided by the user.

References:
M. Pharr, G. Humphreys. (2004). Physically Based Rendering. Morgan Kaufmann.
Section 4.1.1, Page 173.

Version:
1.0 2010-09-10 Created.
Author:
Werner Randelshofer

Field Summary
 
Fields inherited from class org.jpbrt.core.Primitive
primitiveId
 
Constructor Summary
GeometricPrimitive(Shape shape, Material material, AreaLight areaLight)
           
 
Method Summary
 boolean canIntersect()
          Returns true if the underlying geometry is intersectable.
 AreaLight getAreaLight()
          Returns an AreaLight that describes the primitive's emission distribution if the primitive itself is a light source.
 BSDF getBSDF(DifferentialGeometry dg, Transform objectToWorld)
          Returns a representation of the light scattering properties of the material at the given point on the surface in a BSDF object.
 BSSRDF getBSSRDF(DifferentialGeometry dg, Transform objectToWorld)
          ?.
 BBox getWorldBounds()
          Returns a box that encloses the primitive's geometry in world space.
 boolean intersect(Ray r, Intersection isect)
          Returns true if the ray intersects any of the primitives.
 boolean intersectP(Ray ray)
          Returns true if the ray intersects any of the primitives, without providing intersection information.
 void refine(java.util.LinkedList<Primitive> refined)
          Adds refined primitives to the supplied list.
 java.lang.String toString()
           
 
Methods inherited from class org.jpbrt.core.Primitive
fullyRefine
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GeometricPrimitive

public GeometricPrimitive(Shape shape,
                          Material material,
                          AreaLight areaLight)
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getWorldBounds

public BBox getWorldBounds()
Description copied from class: Primitive
Returns a box that encloses the primitive's geometry in world space.

Specified by:
getWorldBounds in class Primitive

intersect

public boolean intersect(Ray r,
                         Intersection isect)
Description copied from class: Primitive
Returns true if the ray intersects any of the primitives. If this is the case, provides intersection information about the closest intersection point along the ray.

Specified by:
intersect in class Primitive
Parameters:
r - The ray for intersection testing. This method updates ray.maxt if an intersection has been found.
isect - Intersection geometry describing the geometry and material properties at the intersection point.
Returns:
Returns true if an intersection has been found.

canIntersect

public boolean canIntersect()
Description copied from class: Primitive
Returns true if the underlying geometry is intersectable.

Only primitives which are intersectable support the methods Primitive.intersect(org.jpbrt.core.Ray, org.jpbrt.core.Intersection) and Primitive.intersectP(org.jpbrt.core.Ray).

Only primitives which are non-intersectable support the method Primitive.refine(java.util.LinkedList).

The default implementation returns true.

Overrides:
canIntersect in class Primitive

intersectP

public boolean intersectP(Ray ray)
Description copied from class: Primitive
Returns true if the ray intersects any of the primitives, without providing intersection information.

Since no additional information needs to be provided, this method is faster than intersect. It is used for determining shadow rays.

Specified by:
intersectP in class Primitive
Parameters:
ray - The ray for intersection testing. This method updates ray.maxt if an intersection has been found. (?)

refine

public void refine(java.util.LinkedList<Primitive> refined)
Description copied from class: Primitive
Adds refined primitives to the supplied list.

Specified by:
refine in class Primitive

getAreaLight

public AreaLight getAreaLight()
Description copied from class: Primitive
Returns an AreaLight that describes the primitive's emission distribution if the primitive itself is a light source. If the primitive is not emissive, this method returns null.

Specified by:
getAreaLight in class Primitive

getBSDF

public BSDF getBSDF(DifferentialGeometry dg,
                    Transform objectToWorld)
Description copied from class: Primitive
Returns a representation of the light scattering properties of the material at the given point on the surface in a BSDF object.

Specified by:
getBSDF in class Primitive

getBSSRDF

public BSSRDF getBSSRDF(DifferentialGeometry dg,
                        Transform objectToWorld)
Description copied from class: Primitive
?.

Specified by:
getBSSRDF in class Primitive

Copyright 2010 © by the authors and contributors of the JPBRT project.
Some rights reserved.