This document is archived and information here might be outdated.  Recommended version.


IRay Interface (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference (Geometry)  

IRay Interface

Provides access to 3D Ray properties and methods. A ray has one endpoint (its origin) and continues infinitely in one direction. Note: the IRay interface has been superseded byIRay2. Please consider using the more recent version.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Description

A Ray is a one-dimensional object defined by an Origin point and a directional Vector.  A Ray extends to infinity from the Origin point in the direction of the Vector.

Members

Description
Read-only property Dimension The topological dimension of this geometry.
Read-only property Envelope Creates a copy of this geometry's envelope and returns it.
Read-only property GeometryType The type of this geometry.
Method GeoNormalize Shifts longitudes, if need be, into a continuous range of 360 degrees.
Method GeoNormalizeFromLongitude Normalizes longitudes into a continuous range containing the longitude. This method is obsolete.
Method GetEnumIntersect Not implemented at this release.
Method GetPointAtDistance Constructs a point at a distance along the ray.
Method Intersect Returns a point collection containing all points of intersection, in order along the ray.
Method Intersects Indicates if the ray intersects the target geometry.
Read-only property IsEmpty Indicates whether this geometry contains any points.
Read/write property Origin The origin point of the ray.
Method Project Projects this geometry into a new spatial reference.
Method QueryEnvelope Copies this geometry's envelope properties into the specified envelope.
Method QueryFirstIntersection Returns the first point of intersection between the ray and the target geometry. The point is set empty if there is no intersection.
Method QueryOrigin Sets a point equal to the ray's origin.
Method QueryPointAtDistance Queries a point at a distance along the ray.
Method QueryVector Sets a vector equal to a unit vector with the same direction as the ray.
Method SetEmpty Removes all points from this geometry.
Method SnapToSpatialReference Moves points of this geometry so that they can be represented in the precision of the geometry's associated spatial reference system.
Read/write property SpatialReference The spatial reference associated with this geometry.
Read/write property Vector The direction vector of the ray.

Inherited Interfaces

Interfaces Description
IGeometry Provides access to members that describe properties and behavior of all geometric objects.

CoClasses that implement IRay

CoClasses and Classes Description
Ray A 3D ray that begins at a point and extends infinitely along a line in one direction only.

Remarks

A fixed tolerance value is currently used for the three intersection methods: Intersects(), Intersect(), and QueryFirstIntersection().

Ray Example

 

[C#]

    public IRay CreateRay(IPoint point, IVector3D vector)
    {
        IRay ray=new RayClass();
        //If the input point.Z is NAN (Not A Number=value not set) set the z to 0
        if (point.Z.Equals(Double.NaN))
        {
            point.Z=0;
        }
        ray.Origin=point;
        ray.Vector=vector;

        return ray;
    }