Show / Hide Table of Contents

    Struct Ray

    An infinite ray starting at origin and pointing towards direction.

    Implements
    System.IEquatable<Ray>
    Inherited Members
    System.ValueType.Equals(System.Object)
    System.ValueType.GetHashCode()
    System.ValueType.ToString()
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetType()
    System.Object.ReferenceEquals(System.Object, System.Object)
    Namespace: Elements.Geometry
    Assembly: Hypar.Elements.dll
    Syntax
    public struct Ray : IEquatable<Ray>

    Constructors

    Ray(Vector3, Vector3)

    Construct a ray.

    Declaration
    public Ray(Vector3 origin, Vector3 direction)
    Parameters
    Type Name Description
    Vector3 origin

    The origin of the ray.

    Vector3 direction

    The direction of the ray.

    Properties

    Direction

    The direction of the ray.

    Declaration
    public Vector3 Direction { get; set; }
    Property Value
    Type Description
    Vector3

    Origin

    The origin of the ray.

    Declaration
    public Vector3 Origin { get; set; }
    Property Value
    Type Description
    Vector3

    Methods

    Equals(Ray)

    Is this ray equal to the provided ray?

    Declaration
    public bool Equals(Ray other)
    Parameters
    Type Name Description
    Ray other

    The ray to test.

    Returns
    Type Description
    System.Boolean

    Returns true if the two rays are equal, otherwise false.

    Intersects(GeometricElement, out List<Vector3>)

    Does this ray intersect with the provided GeometricElement? Only GeometricElements with Solid Representations are currently supported, and voids will be ignored.

    Declaration
    public bool Intersects(GeometricElement element, out List<Vector3> result)
    Parameters
    Type Name Description
    GeometricElement element

    The element to intersect with.

    System.Collections.Generic.List<Vector3> result

    The list of intersection results.

    Returns
    Type Description
    System.Boolean

    Intersects(Line, out Vector3)

    Does this ray intersect the provided line?

    Declaration
    public bool Intersects(Line line, out Vector3 result)
    Parameters
    Type Name Description
    Line line

    The line to intersect.

    Vector3 result

    The location of intersection.

    Returns
    Type Description
    System.Boolean

    True if the rays intersect, otherwise false.

    Intersects(Mesh, out Vector3)

    Does this ray intersect the provided mesh?

    Declaration
    public bool Intersects(Mesh mesh, out Vector3 result)
    Parameters
    Type Name Description
    Mesh mesh

    The Mesh.

    Vector3 result

    The location of intersection.

    Returns
    Type Description
    System.Boolean

    True if an intersection result occurs. False if no intersection occurs.

    Intersects(Plane, out Vector3)

    Does this ray intersect the provided plane?

    Declaration
    public bool Intersects(Plane plane, out Vector3 result)
    Parameters
    Type Name Description
    Plane plane

    The Plane to intersect with.

    Vector3 result

    The intersection result.

    Returns
    Type Description
    System.Boolean

    True if an intersection occurs, otherwise false — this can occur if the ray is very close to parallel to the plane. If true, check the intersection result for the location of the intersection.

    Intersects(Plane, out Vector3, out Double)

    Does this ray intersect the provided plane?

    Declaration
    public bool Intersects(Plane plane, out Vector3 result, out double t)
    Parameters
    Type Name Description
    Plane plane

    The Plane to intersect with.

    Vector3 result

    The intersection result.

    System.Double t
    Returns
    Type Description
    System.Boolean

    True if an intersection occurs, otherwise false — this can occur if the ray is very close to parallel to the plane. If true, check the intersection result for the location of the intersection.

    Intersects(Polygon, out Vector3, out Containment)

    Does this ray intersect the provided polygon area?

    Declaration
    public bool Intersects(Polygon polygon, out Vector3 result, out Containment containment)
    Parameters
    Type Name Description
    Polygon polygon

    The Polygon to intersect with.

    Vector3 result

    The intersection result.

    Containment containment

    An enumeration detailing the type of intersection if one occurs.

    Returns
    Type Description
    System.Boolean

    True if an intersection occurs, otherwise false. If true, check the intersection result for the location of the intersection.

    Intersects(Ray, out Vector3, out RayIntersectionResult, Boolean)

    Does this ray intersect the provided ray?

    Declaration
    public bool Intersects(Ray ray, out Vector3 result, out RayIntersectionResult intersectionResult, bool ignoreRayDirection = false)
    Parameters
    Type Name Description
    Ray ray

    The ray to intersect.

    Vector3 result

    The location of intersection.

    RayIntersectionResult intersectionResult

    An enumeration of possible ray intersection result types.

    System.Boolean ignoreRayDirection

    If true, the direction of the rays will be ignored.

    Returns
    Type Description
    System.Boolean

    True if the rays intersect, otherwise false.

    Intersects(Ray, out Vector3, Boolean)

    Does this ray intersect the provided ray?

    Declaration
    public bool Intersects(Ray ray, out Vector3 result, bool ignoreRayDirection = false)
    Parameters
    Type Name Description
    Ray ray

    The ray to intersect.

    Vector3 result

    The location of intersection.

    System.Boolean ignoreRayDirection

    If true, the direction of the rays will be ignored

    Returns
    Type Description
    System.Boolean

    True if the rays intersect, otherwise false.

    Intersects(SolidOperation, out List<Vector3>)

    Does this ray intersect with the provided SolidOperation?

    Declaration
    public bool Intersects(SolidOperation solidOp, out List<Vector3> result)
    Parameters
    Type Name Description
    SolidOperation solidOp

    The SolidOperation to intersect with.

    System.Collections.Generic.List<Vector3> result

    The list of intersection results, ordered by distance from the ray origin.

    Returns
    Type Description
    System.Boolean

    True if an intersection occurs, otherwise false. If true, check the intersection result for the location of the intersection.

    Intersects(Triangle, out Vector3)

    https://en.wikipedia.org/wiki/M%C3%B6ller%E2%80%93Trumbore_intersection_algorithm

    Declaration
    public bool Intersects(Triangle tri, out Vector3 result)
    Parameters
    Type Name Description
    Triangle tri

    The triangle to intersect.

    Vector3 result

    The intersection result.

    Returns
    Type Description
    System.Boolean

    True if an intersection occurs, otherwise false. If true, check the intersection result for the type and location of intersection.

    Intersects(Vector3, Vector3, out Vector3)

    Does this ray intersect a line segment defined by start and end?

    Declaration
    public bool Intersects(Vector3 start, Vector3 end, out Vector3 result)
    Parameters
    Type Name Description
    Vector3 start

    The start of the line segment.

    Vector3 end

    The end of the line segment.

    Vector3 result

    The location of the intersection.

    Returns
    Type Description
    System.Boolean

    True if the ray intersects, otherwise false.

    Intersects(Vector3, Vector3, out Vector3, out RayIntersectionResult)

    Does this ray intersect a line segment defined by start and end?

    Declaration
    public bool Intersects(Vector3 start, Vector3 end, out Vector3 result, out RayIntersectionResult intersectionResult)
    Parameters
    Type Name Description
    Vector3 start

    The start of the line segment.

    Vector3 end

    The end of the line segment.

    Vector3 result

    The location of the intersection.

    RayIntersectionResult intersectionResult

    The nature of the ray intersection.

    Returns
    Type Description
    System.Boolean

    True if the ray intersects, otherwise false.

    Intersects(Topography, out Vector3)

    Does this ray intersect the provided topography?

    Declaration
    public bool Intersects(Topography topo, out Vector3 result)
    Parameters
    Type Name Description
    Topography topo

    The topography.

    Vector3 result

    The location of intersection.

    Returns
    Type Description
    System.Boolean

    True if an intersection result occurs. False if no intersection occurs.

    NearbyPoints(IEnumerable<Vector3>, Double)

    Find points in the collection that are within the provided distance of this ray.

    Declaration
    public Vector3[] NearbyPoints(IEnumerable<Vector3> points, double distance)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<Vector3> points

    The collection of points to search

    System.Double distance

    The maximum distance from the ray.

    Returns
    Type Description
    Vector3[]

    Points that are within the given distance of the ray.

    Implements

    System.IEquatable<T>
    In This Article
    • Constructors
      • Ray(Vector3, Vector3)
    • Properties
      • Direction
      • Origin
    • Methods
      • Equals(Ray)
      • Intersects(GeometricElement, out List<Vector3>)
      • Intersects(Line, out Vector3)
      • Intersects(Mesh, out Vector3)
      • Intersects(Plane, out Vector3)
      • Intersects(Plane, out Vector3, out Double)
      • Intersects(Polygon, out Vector3, out Containment)
      • Intersects(Ray, out Vector3, out RayIntersectionResult, Boolean)
      • Intersects(Ray, out Vector3, Boolean)
      • Intersects(SolidOperation, out List<Vector3>)
      • Intersects(Triangle, out Vector3)
      • Intersects(Vector3, Vector3, out Vector3)
      • Intersects(Vector3, Vector3, out Vector3, out RayIntersectionResult)
      • Intersects(Topography, out Vector3)
      • NearbyPoints(IEnumerable<Vector3>, Double)
    • Implements