Hide Table of Contents
RayIntersections Method (IModelDocExtension)

Finds the intersections between the specified set of rays and the specified set of bodies.

.NET Syntax

Visual Basic (Declaration) 
Function RayIntersections( _
   ByVal BodiesIn As System.Object, _
   ByVal BasePointsIn As System.Object, _
   ByVal VectorsIn As System.Object, _
   ByVal Options As System.Integer, _
   ByVal HitRadius As System.Double, _
   ByVal Offset As System.Double, _
   ByVal HighPrecision As System.Boolean _
) As System.Integer
Visual Basic (Usage) 
Dim instance As IModelDocExtension
Dim BodiesIn As System.Object
Dim BasePointsIn As System.Object
Dim VectorsIn As System.Object
Dim Options As System.Integer
Dim HitRadius As System.Double
Dim Offset As System.Double
Dim HighPrecision As System.Boolean
Dim value As System.Integer
 
value = instance.RayIntersections(BodiesIn, BasePointsIn, VectorsIn, Options, HitRadius, Offset, HighPrecision)
C# 
System.int RayIntersections( 
   System.object BodiesIn,
   System.object BasePointsIn,
   System.object VectorsIn,
   System.int Options,
   System.double HitRadius,
   System.double Offset,
   System.bool HighPrecision
)
C++/CLI 
System.int RayIntersections( 
&   System.Object^ BodiesIn,
&   System.Object^ BasePointsIn,
&   System.Object^ VectorsIn,
&   System.int Options,
&   System.double HitRadius,
&   System.double Offset,
&   System.bool HighPrecision
) 

Parameters

BodiesIn

Array of bodies that are hit by the rays (see Remarks)

BasePointsIn

Array of doubles containing the x,y,z base points of each ray

VectorsIn

Array of doubles containing the direction vectors of each ray

Options

Number of options as defined in swRayPtsOpts_e (see Remarks)

HitRadius

Radius of hit cylinder; this is used mainly in grazing cases to establish a hit (see Remarks)

Offset

Length tolerance to use to establish whether a hit on a face represents the entry or exit of the ray from the body (see Remarks)

HighPrecision
True to use maximum precision when evaluating intersections close to the ray boundary, false to use dynamic precision based on the ray radius (see Remarks)

Return Value

Number of intersections found

Remarks

The method performs intersection operations between the specified bodies and the specified ray vectors. To get the results (a set of intersection points, intersection normals, and the bodies from your BodiesIn array that were hit), you must call IModelDoc2::GetRayIntersectionsPoints and IModelDoc2::GetRayIntersectionTopology.

Information returned by IModelDoc2::GetRayIntersectionsPoints and IModelDoc2::GetRayIntersectionTopology depends partially on the value of the Options parameter. Valid Option values can be combined using bitwise operations. See IModelDoc2::GetRayIntersectionsPoints to determine which data is always output regardless of the values specified by Options.

For each ray that hits an edge or a vertex, the Offset value is added in both the positive and negative directions along the ray, and the points computed are tested for spatial inclusion in the hit body. This determines whether the ray was entering, leaving, or just grazing the body at the hit point. Entry and exit for faces can be computed and does not require an offset.

The difference between this method and the now obsolete IModelDoc2::RayIntersections and IModelDoc2::IRayIntersections is the HighPrecision parameter. Setting HighPrecision to true forces use of the highest possible precision when evaluating intersections close to ray profile boundaries. Setting HighPrecision to false forces use of a dynamic tolerance that is based on the HitRadius, which is the behavior of the obsolete methods.

The actual ray profile is polygonal, approximating an ideal circular ray profile of HitRadius. Evaluating intersections very close to the ray profile boundary may produce unexpected results due to this polygonal approximation. Experimentation with HighPrecision is recommended.

 

See Also

Availability

SOLIDWORKS 2018 SP02, Revision Number 26.2


Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

 
*Email:  
Subject:   Feedback on Help Topics
Page:   RayIntersections Method (IModelDocExtension)
*Comment:  
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:

x

We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again
x

Web Help Content Version: API Help (English only) 2018 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.