<commit_before>use std::f32;
use linalg::Point;
use linalg::Vector;

/// Ray is a standard 3D ray, starting at origin `o` and heading in direction `d`
/// The min and max points along the ray can be specified with `min_t` and `max_t`
/// `depth` is the recursion depth of the ray
#[deriving(Show, Copy, PartialEq)]
pub struct Ray {
    /// Origin of the ray
    pub o: Point,
    /// Direction the ray is heading
    pub d: Vector,
    /// Point along the ray that the actual ray starts at, `p = o + min_t * d`
    pub min_t: f32,
    /// Point along the ray at which it stops, will be inf if the ray is infinite
    pub max_t: f32,
    /// Recursion depth of the ray
    pub depth: i32,
}

impl Ray {
    /// Create a new ray from `o` heading in `d` with infinite length
    pub fn new(o: &Point, d: &Vector) -> Ray {
        Ray { o: *o, d: *d, min_t: 0f32, max_t: f32::INFINITY, depth: 0 }
    }
    /// Create a new segment ray from `o + min_t * d` to `o + max_t * d`
    pub fn segment(o: &Point, d: &Vector, min_t: f32, max_t: f32) -> Ray {
        Ray { o: *o, d: *d, min_t: min_t, max_t: max_t, depth: 0}
    }
    /// Create a child ray from the parent starting at `o` and heading in `d`
    pub fn child(&self, o: &Point, d: &Vector) -> Ray {
        Ray { o: *o, d: *d, min_t: 0f32, max_t: f32::INFINITY, depth: self.depth + 1 }
    }
    /// Create a child ray segment from `o + min_t * d` to `o + max_t * d`
    pub fn child_segment(&self, o: &Point, d: &Vector, min_t: f32, max_t: f32) -> Ray {
        Ray { o: *o, d: *d, min_t: min_t, max_t: max_t, depth: self.depth + 1}
    }
    /// Evaulate the ray equation at some t value and return the point
    /// returns result of `self.o + t * self.d`
    fn at(&self, t: f32) -> Point {
        self.o + self.d * t
    }
}<commit_msg>Ray::at should be public<commit_after>use std::f32;
use linalg::Point;
use linalg::Vector;

/// Ray is a standard 3D ray, starting at origin `o` and heading in direction `d`
/// The min and max points along the ray can be specified with `min_t` and `max_t`
/// `depth` is the recursion depth of the ray
#[deriving(Show, Copy, PartialEq)]
pub struct Ray {
    /// Origin of the ray
    pub o: Point,
    /// Direction the ray is heading
    pub d: Vector,
    /// Point along the ray that the actual ray starts at, `p = o + min_t * d`
    pub min_t: f32,
    /// Point along the ray at which it stops, will be inf if the ray is infinite
    pub max_t: f32,
    /// Recursion depth of the ray
    pub depth: i32,
}

impl Ray {
    /// Create a new ray from `o` heading in `d` with infinite length
    pub fn new(o: &Point, d: &Vector) -> Ray {
        Ray { o: *o, d: *d, min_t: 0f32, max_t: f32::INFINITY, depth: 0 }
    }
    /// Create a new segment ray from `o + min_t * d` to `o + max_t * d`
    pub fn segment(o: &Point, d: &Vector, min_t: f32, max_t: f32) -> Ray {
        Ray { o: *o, d: *d, min_t: min_t, max_t: max_t, depth: 0}
    }
    /// Create a child ray from the parent starting at `o` and heading in `d`
    pub fn child(&self, o: &Point, d: &Vector) -> Ray {
        Ray { o: *o, d: *d, min_t: 0f32, max_t: f32::INFINITY, depth: self.depth + 1 }
    }
    /// Create a child ray segment from `o + min_t * d` to `o + max_t * d`
    pub fn child_segment(&self, o: &Point, d: &Vector, min_t: f32, max_t: f32) -> Ray {
        Ray { o: *o, d: *d, min_t: min_t, max_t: max_t, depth: self.depth + 1}
    }
    /// Evaulate the ray equation at some t value and return the point
    /// returns result of `self.o + t * self.d`
    pub fn at(&self, t: f32) -> Point {
        self.o + self.d * t
    }
}
{'fraction_non_alphanumeric': 0.14028278347657333, 'fraction_numerical': 0.018297754366509565, 'mean_word_length': 2.4069877242681774, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4180836', 'n_tokens_mistral': 1371, 'n_tokens_neox': 1327, 'n_words': 550}