<commit_before>/**
 *
 */
package ca.eandb.jmist.math;

import java.io.Serializable;

/**
 * A ray (half-line) in three dimensional space.
 * This class is immutable.
 * @author <NAME>
 */
public final class Ray3 implements Serializable {

	/**
	 * Initializes the origin and direction of the ray.
	 * @param origin The origin of the ray.
	 * @param direction The direction of the ray.
	 */
	public Ray3(Point3 origin, Vector3 direction) {
		this.origin = origin;
		this.direction = direction;
	}

	/**
	 * Gets the origin of this ray.
	 * @return The origin of this ray.
	 */
	public Point3 origin() {
		return origin;
	}

	/**
	 * Gets the direction of this ray.
	 * @return The direction of this ray.
	 */
	public Vector3 direction() {
		return direction;
	}

	/**
	 * Gets the point that is t units along the ray.
	 * @param t The number of units along the ray to find the point of.
	 * @return The point that is t units along the ray.
	 */
	public Point3 pointAt(double t) {
		return new Point3(
				origin.x() + t * direction.x(),
				origin.y() + t * direction.y(),
				origin.z() + t * direction.z()
		);<commit_msg>Added Ray3.advance(double).<commit_after>/**
 *
 */
package ca.eandb.jmist.math;

import java.io.Serializable;

/**
 * A ray (half-line) in three dimensional space.
 * This class is immutable.
 * @author <NAME>
 */
public final class Ray3 implements Serializable {

	/**
	 * Initializes the origin and direction of the ray.
	 * @param origin The origin of the ray.
	 * @param direction The direction of the ray.
	 */
	public Ray3(Point3 origin, Vector3 direction) {
		this.origin = origin;
		this.direction = direction;
	}

	/**
	 * Gets the origin of this ray.
	 * @return The origin of this ray.
	 */
	public Point3 origin() {
		return origin;
	}

	/**
	 * Gets the direction of this ray.
	 * @return The direction of this ray.
	 */
	public Vector3 direction() {
		return direction;
	}

	/**
	 * Gets a parallel <code>Ray3</code> with the origin <code>t</code> units
	 * along this <code>Ray3</code>.
	 * @param t The number of units along the ray to advance.
	 * @return The new <code>Ray3</code>.
	 */
	public Ray3 advance(double t) {
		return new Ray3(pointAt(t), direction);
	}

	/**
	 * Gets the point that is t units along the ray.
	 * @param t The number of units along the ray to find the point of.
	 * @return The point that is t units along the ray.
	 */
	public Point3 pointAt(double t) {
		return new Point3(
				origin.x() + t * direction.x(),
				origin.y() + t * direction.y(),
				origin.z() + t * direction.z()
		);
{'fraction_non_alphanumeric': 0.12197028928850664, 'fraction_numerical': 0.008600469116497263, 'mean_word_length': 2.8890577507598785, 'pattern_counts': {'":': 0, '<': 13, '<?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': '4312323', 'n_tokens_mistral': 870, 'n_tokens_neox': 794, 'n_words': 314}