ShootRay

Shoots a ray at a collection of surfaces.

Syntax

Rhino.ShootRay (strSurface, arrPoint, arrDirection [, intReflections [, blnObjects]])

Rhino.ShootRay (arrSurfaces, arrPoint, arrDirection [, intReflections [, blnObjects]])

Parameters

strSurface

Required.  Array.  The identifier of a reflecting surface and polysurface object.

arrSurfaces

Required.  Array.  The identifiers of one or more reflecting surface and polysurface objects.

arrPoint

Required.  Array.  A 3-D point identifying the starting point of the ray.

arrDirection

Required.  Array.  A 3-D vector identifying the direction of the ray.

intReflections

Optional.  Number.  The maximum number of times the ray will be reflected.  The default is 10 reflections.

blnObjects

Optional.  Boolean.  If False (Default), then a one-dimensional array of 3-D points of reflection is returned if successful. In this case, the first element of the array is the starting point of the ray, or arrPoint. If True, then a two-dimensional array, with the first dimension containing the reflection point and the second dimension containing the identifier of the surface or polysurface that was hit at that point, is returned if successful. In this case, the first row of the array contains the starting point of the ray, or arrPoint, in the first dimension, and a null value in the second dimension.

Returns

Array

See the comments regarding blnObjects above.

Null

If not successful, or on error.

Example

Sub TestRayShooter

  Dim corners(7), box, dir, reflections

  corners(0) = Array(0,0,0)

  corners(1) = Array(10,0,0)

  corners(2) = Array(10,10,0)

  corners(3) = Array(0,10,0)

  corners(4) = Array(0,0,10)

  corners(5) = Array(10,0,10)

  corners(6) = Array(10,10,10)

  corners(7) = Array(0,10,10)

  box = Rhino.AddBox(corners)

  dir = Rhino.VectorCreate(Array(10,7,7), corners(0))

  reflections = Rhino.ShootRay(box, corners(0), dir)

  Rhino.AddPolyline reflections

  Rhino.AddPoints reflections

End Sub

Also See

IsPolysurface

IsSurface