M-File Help: Ray3D View code for Ray3D

Ray3D

Ray in 3D space

This object represents a ray in 3D space, defined by a point on the ray and a direction unit-vector.

Methods

intersect Intersection of ray with plane or ray
closest Closest distance between point and ray
char Ray parameters as human readable string
display Display ray parameters in human readable form

Properties

P0 A point on the ray (3x1)
d Direction of the ray, unit vector (3x1)

Notes


Ray3D.Ray3D

Ray constructor

R = Ray3D(p0, d) is a new Ray3D object defined by a point on the ray p0 and a direction vector d.


Ray3D.char

Convert to string

s = R.char() is a compact string representation of the Ray3D's value. If R is a vector then the string has multiple lines, one per element.


Ray3D.closest

Closest distance between point and ray

x = R.closest(p) is the point on the ray R closest to the point p.

[x,E] = R.closest(p) as above but also returns the distance E between x and p.


Ray3D.display

Display value

R.display() displays a compact human-readable representation of the Ray3D's value. If R is a vector then the elements are printed one per line.

Notes

See also

Ray3D.char


Ray3D.intersect

Intersetion of ray with line or plane

x = R.intersect(r2) is the point on R that is closest to the ray r2. If R is a vector then then x has multiple columns, corresponding to the intersection of R(i) with r2.

[x,E] = R.intersect(r2) as above but also returns the closest distance between the rays.

x = R.intersect(p) returns the point of intersection between the ray R and the plane p=(a,b,c,d) where aX + bY + cZ + d = 0. If R is a vector then x has multiple columns, corresponding to the intersection of R(i) with p.


 

© 1990-2012 Peter Corke.