raytrace2trans {zonohedra}R Documentation

compute the intersection of a ray and the 2-transition surface associated with a zonohedron

Description

The open ray with basepoint \bold{b} and non-zero direction \bold{d} is the set of the form \bold{b} + t \bold{d} where t > 0.

This function computes the intersection of an open ray and the 2-transition surface associated with a zonohedron. The linking number of the surface and \bold{b} must be \pm 1. This is verified at the beginning, and if not true, then it is an error. The linking number condition implies that an intersection exists for every ray based at \bold{b}. Note also that the condition implies that \bold{b} is not on the surface. For discussion of uniqueness, see Details. For the definition of linking number see The 2-Transition Subcomplex and the 2-Transition Surface.

The 2-transition surface is a union of parallelograms. The surface is symmetric about the center of the zonhedron, so each parallelogram has an antipodal parallelogram. Each parallelogram is specified by an ordered pair of distinct generators from the simplified matroid associated with the zonohedron. Thus, if there are N generators, there are N(N-1) parallelograms. Swapping the generators of a parallelogram changes it to the antipodal parallelogram.

The 2-transition surface has two poles - the point 0 and the sum of all the generators. It is OK for the ray to pass through one of these poles.

Usage

raytrace2trans( x, base, direction, invert=FALSE, plot=FALSE, tol=1.e-12, ...  )

Arguments

x

a zonohedron object as returned by the constructor zonohedron()

base

a numeric 3-vector - the basepoint of all the rays. The surface must be strictly starshaped at base, and this is verified.

direction

a numeric Mx3 matrix with M non-zero directions in the rows. The basepoint and these directions define M rays.
direction can also be a numeric vector that can be converted to such a matrix, by row.

invert

if TRUE, then compute a point in the unit cube that maps to the point on the 2-transition surface associated with x, and add it as a column in the returned data.frame

plot

if TRUE, the computed rays, up to the boundary, are added to an existing plot of the zonohedron x, see plot.zonohedron(). The segments are drawn in the color red. If there is no open 3D plot, a warning is issued.

tol

the tolerance for being strictly starshaped, and for intersection with a pole.

...

not used

Details

The function is designed for the situation when the intersection of the ray and the surface exists and is unique. This is guaranteed for all ray directions \bold{d} when the surface is strictly starshaped at \bold{b}. This condition is checked at the beginning of the function, and if false then a warning is issued that the intersection point may not be unique. For the definition of strictly starshaped see The 2-Transition Subcomplex and the 2-Transition Surface.

For finding a parallelogram of intersection, a brute-force search is used; all parallelograms are searched until the first one that intersects the ray is found. To speed things up, the 3D problem is reduced to 2D, and the search is programmed in plain C.

If plot is TRUE, the rays are drawn in red using rgl::segments3d() and rgl::points3d().

Value

raytrace2trans() returns a data.frame with M rows and these columns:

base

the given basepoint - this is the same in every row

direction

the given direction

gndpair

the 2 generators of the parallelogram that the ray intersects, taken from the ground set of the simplified matroid. If the ray passes through a pole, both of these are NA.

alpha

the 2 coordinates of the intersection point within the parallelogram

tmax

ray parameter of the intersection with the parallelogram, always positive

point

the point on the surface; the intersection of the ray and the parallelogram

iters

the number of parallelograms searched, until the desired one was found. If the ray intersects a pole, this is 0.

timetrace

the computation time for the given ray, in seconds. This does not include the initial preprocessing time.

And if invert is TRUE, then this column is added:

pcube

a point in the unit cube that maps to point. This point in the cube always has 2 transitions.

If base and direction in a row cannot be processed, the rest of the row is NA.

If the row names of direction are unique, they are copied to the row names of the output.

In case of error, the function returns NULL.

Note

The package rgl is required for 3D plotting.

See Also

zonohedron(), plot.zonohedron(), section2trans(), raytrace.zonohedron()


[Package zonohedra version 0.3-0 Index]