abstract class Hitable

Overview

Superclass for any kind of 'object' we would want to calculate an intersection with.

Direct Known Subclasses

Defined in:

hitable.cr
hitables/hitable_list.cr
hitables/rect.cr
hitables/triangle.cr

Instance Method Summary

Instance Method Detail

def area : Float64 #

TODO This only makes sense for finite objects


[View source]
def area_light : Light? #

[View source]
def area_light=(area_light : Light?) #

[View source]
abstract def hit(ray : Ray) : HitRecord? #

[View source]
def pdf(point : Point, wi : Vector) : Float64 #

Probability density function of rays Probability that a ray(point, wi) hits the object


[View source]
def pdf(point : Point) : Float64 #

Probability density function of points on the object.

NOTE For now this is always 1.0 / area


[View source]
def rotate(axis : Vector, degrees : Float64) : Hitable #

Return a new hitable rotated around axis by degrees


[View source]
def rotate_x(degrees : Float64) : Hitable #

[View source]
def rotate_y(degrees : Float64) : Hitable #

[View source]
def rotate_z(degrees : Float64) : Hitable #

[View source]
def sample(origin) : ::Tuple(Point, Normal) #

Get a random point and its normal somewhere on the object with respect to some origin point. This way it is possible to sample only the visible hemisphere of a sphere etc.

NOTE For now this just points to sample()


[View source]
def sample : ::Tuple(Point, Normal) #

Get a random point and its normal somewhere on the object


[View source]
def scale(size : Float64) : Hitable #

Return a new hitable scaled by some factor


[View source]
def translate(offset : Vector) : Hitable #

Return a new hitable translated (moved) by some offset

TODO Chaining two transformations of the same kind is not possible right now


[View source]