Class Ray
A ray is simply a position point and a direction.
public class Ray : IEquatable<Ray>
Constructs the ray.
public Ray(Point3 position, Vector3 direction)
| Type | Name | Description |
|---|---|---|
| Point3 | position | The vector describing the direction of the ray. |
| Vector3 | direction | The point describing the origin of the ray. |
Gets the vector, describing the ray direction.
public Vector3 Direction { get; }
| Type | Description |
|---|---|
| Vector3 |
Gets the position point of the ray.
public Point3 Position { get; }
| Type | Description |
|---|---|
| Point3 |
Computes the closest point on a ray from a point.
public Point3 ClosestPoint(Point3 pt)
| Type | Name | Description |
|---|---|---|
| Point3 | pt | The point. |
| Type | Description |
|---|---|
| Point3 | The closest point on a ray from a point. |
Computes the shortest distance between this ray and a test point.
public double DistanceTo(Point3 pt)
| Type | Name | Description |
|---|---|---|
| Point3 | pt | The point to project. |
| Type | Description |
|---|---|
| System.Double | The distance. |
Check if the ray is equal to the provided ray.
Two ray are equal if position and direction are the same.
public bool Equals(Ray other)
| Type | Name | Description |
|---|---|---|
| Ray | other | The ray to compare. |
| Type | Description |
|---|---|
| System.Boolean | True if position and direction are equal, otherwise false. |
Gets the hash code for the ray.
public override int GetHashCode()
| Type | Description |
|---|---|
| System.Int32 | A unique hashCode of an ray. |
Calculates the point moved by a scalar value along a direction.
public Vector3 OnRay(double amplitude)
| Type | Name | Description |
|---|---|---|
| System.Double | amplitude | The scalar value to amplify the vector. |
| Type | Description |
|---|---|
| Vector3 | The point along the ray. |
Evaluates a point along the ray.
public Point3 PointAt(double t)
| Type | Name | Description |
|---|---|---|
| System.Double | t | The t parameter. |
| Type | Description |
|---|---|
| Point3 | A point at (Direction*t + Position). |
Constructs the string representation of the ray.
public override string ToString()
| Type | Description |
|---|---|
| System.String | A text string. |