Public Member Functions | Static Public Member Functions | Public Attributes | List of all members

Start point and direction (NOT necessarily unit) for a 3D ray. More...

#include <dray3d.h>

Public Member Functions

ValidatedDRay3d ValidatedNormalize () const
 Return a (validated) copy with normalized direction. More...
 
void InitFrom (DSegment3dCR segment)
 Initialize a ray from a segment. More...
 
void InitFromOriginAndVector (DPoint3dCR origin, DVec3dCR vector)
 Initialize a ray from origina and vector. More...
 
void InitFromOriginAndTarget (DPoint2dCR point0, DPoint2dCR point1)
 Initialize a ray from 2d endpoints. More...
 
void InitFromOriginAndTarget (DPoint3dCR point0, DPoint3dCR point1)
 Initialize a ray from 2d endpoints. More...
 
bool InitFromPlanePlaneIntersection (DPlane3dCR planeA, DPlane3dCR planeB)
 Initialize as intersection of two planes. More...
 
void EvaluateEndPoints (DPoint3dR point0, DPoint3dR point1) const
 Return the origin and target of the ray. More...
 
DPoint3d FractionParameterToPoint (double param) const
 
double DirectionDotVectorToTarget (DPoint3dCR target) const
 
double DirectionDotVector (DVec3d vector) const
 
bool ProjectPointBounded (DPoint3dR closestPoint, double &closestParam, DPoint3dCR point) const
 Project a point onto the bounded line in 3D. More...
 
bool ProjectPointUnbounded (DPoint3dR closestPoint, double &closestParam, DPoint3dCR point) const
 Project a point onto the unbounded. More...
 
bool Intersect (DPoint3dR intPoint, double &intParam, DPlane3dCR plane) const
 Return the intersection of the (unbounded) ray with a plane. More...
 
bool IntersectZPlane (TransformR frame, double localZ, DPoint3dR uvw, double &t) const
 Return the intersection of this ray with a specified z plane of a coordinate frame. More...
 
int IntersectCircleXY (DPoint3dP intPoint, double *pIntParam, DPoint3dCR center, double radius) const
 Return the intersection of the (unbounded) ray with a circle, using only xy coordinates. More...
 

Static Public Member Functions

static DRay3d From (DSegment3dCR segment)
 Initialize a ray from a segment. More...
 
static DRay3d FromOriginAndVector (DPoint3dCR origin, DVec3dCR vector)
 Initialize a ray from origin and vector. More...
 
static DRay3d FromOriginAndTarget (DPoint2dCR point0, DPoint2dCR point1)
 Initialize a ray from 2d endpoints. More...
 
static DRay3d FromOriginAndTarget (DPoint3dCR point0, DPoint3dCR point1)
 Initialize a ray from 3d endpoints. More...
 
static DRay3d FromIinterpolateWithScaledDifference (DPoint3dCR point0, double fraction, DPoint3dCR point1, double vectorScale)
 Return a ray with origin interpolated between points. The ray direction is the point0 to point1 vector scaled by vectorScale. More...
 
static void ClosestApproachUnboundedRayBoundedSegment (double &fractionRay, double &fractionSegment, DPoint3dR pointRay, DPoint3dR pointSegment, DRay3dCR ray, DSegment3dCR segment)
 
static bool ClosestApproachUnboundedRayUnboundedRay (double &fractionA, double &fractionB, DPoint3dR pointA, DPoint3dR pointB, DRay3dCR rayA, DRay3dCR rayB)
 

Public Attributes

DPoint3d origin
 Start point of ray. More...
 
DVec3d direction
 Direction vector. This is NOT necessarily a unit vector. More...
 

Detailed Description

Start point and direction (NOT necessarily unit) for a 3D ray.

Member Function Documentation

static void ClosestApproachUnboundedRayBoundedSegment ( double &  fractionRay,
double &  fractionSegment,
DPoint3dR  pointRay,
DPoint3dR  pointSegment,
DRay3dCR  ray,
DSegment3dCR  segment 
)
static
Parameters
[out]fractionRaycomputed fraction on (unbounded) ray
[out]fractionSegmentcomputed fraction on (bounded) segment
[out]pointRaycomputed point on (unbounded) ray
[out]pointSegmentcomputed point on (bounded) segment
[in]rayunbounded ray
[in]segmentbounded segment
static bool ClosestApproachUnboundedRayUnboundedRay ( double &  fractionA,
double &  fractionB,
DPoint3dR  pointA,
DPoint3dR  pointB,
DRay3dCR  rayA,
DRay3dCR  rayB 
)
static
Parameters
[out]fractionAcomputed fraction on (unbounded) ray
[out]fractionBcomputed fraction on (bounded) segment
[out]pointAcomputed point on (unbounded) ray
[out]pointBcomputed point on (bounded) segment
[in]rayAunbounded ray
[in]rayBbounded segment
Returns
false (with rayA start projected to rayB) if parallel rays.
double DirectionDotVector ( DVec3d  vector) const
Parameters
[in]vector
Returns
dot product of (unnormalized) ray vector with input vector.
double DirectionDotVectorToTarget ( DPoint3dCR  target) const
Parameters
[in]target
Returns
dot product of (unnormalized) ray vector with vector from ray origin to given point.
void EvaluateEndPoints ( DPoint3dR  point0,
DPoint3dR  point1 
) const

Return the origin and target of the ray.

DPoint3d FractionParameterToPoint ( double  param) const
Parameters
[in]paramfractional parameter
Returns
evaluated point.
static DRay3d From ( DSegment3dCR  segment)
static

Initialize a ray from a segment.

static DRay3d FromIinterpolateWithScaledDifference ( DPoint3dCR  point0,
double  fraction,
DPoint3dCR  point1,
double  vectorScale 
)
static

Return a ray with origin interpolated between points. The ray direction is the point0 to point1 vector scaled by vectorScale.

static DRay3d FromOriginAndTarget ( DPoint2dCR  point0,
DPoint2dCR  point1 
)
static

Initialize a ray from 2d endpoints.

static DRay3d FromOriginAndTarget ( DPoint3dCR  point0,
DPoint3dCR  point1 
)
static

Initialize a ray from 3d endpoints.

static DRay3d FromOriginAndVector ( DPoint3dCR  origin,
DVec3dCR  vector 
)
static

Initialize a ray from origin and vector.

void InitFrom ( DSegment3dCR  segment)

Initialize a ray from a segment.

void InitFromOriginAndTarget ( DPoint2dCR  point0,
DPoint2dCR  point1 
)

Initialize a ray from 2d endpoints.

void InitFromOriginAndTarget ( DPoint3dCR  point0,
DPoint3dCR  point1 
)

Initialize a ray from 2d endpoints.

void InitFromOriginAndVector ( DPoint3dCR  origin,
DVec3dCR  vector 
)

Initialize a ray from origina and vector.

bool InitFromPlanePlaneIntersection ( DPlane3dCR  planeA,
DPlane3dCR  planeB 
)

Initialize as intersection of two planes.

Returns
false if planes are parallel.
bool Intersect ( DPoint3dR  intPoint,
double &  intParam,
DPlane3dCR  plane 
) const

Return the intersection of the (unbounded) ray with a plane.

Parameters
[out]intPointintersection point
[out]intParamparameter along the ray
[in]planeplane (origin and normal)
Returns
false if ray, plane are parallel.
int IntersectCircleXY ( DPoint3dP  intPoint,
double *  pIntParam,
DPoint3dCR  center,
double  radius 
) const

Return the intersection of the (unbounded) ray with a circle, using only xy coordinates.

Parameters
[out]intPoint0, 1, or 2 intersection points.
[in]pIntParamparameter along the line
[in]centercircle center.
[in]radiuscircle radius.
Returns
number of intersections.
bool IntersectZPlane ( TransformR  frame,
double  localZ,
DPoint3dR  uvw,
double &  t 
) const

Return the intersection of this ray with a specified z plane of a coordinate frame.

Parameters
[in]framecoordinate frame, e.g. often called localWorldFrame for an object
[in]localZz coordinate in local frame (e.g. 0 for local xy plane pierce point.)
[out]uvwlocal uvw coordinates. (w matches input z)
[out]tparameter along ray.
Returns
true if the ray is not parallel to the plane
bool ProjectPointBounded ( DPoint3dR  closestPoint,
double &  closestParam,
DPoint3dCR  point 
) const

Project a point onto the bounded line in 3D.

If nearest point of extended line is outside the 0..1 parameter range, returned values are for nearest endpoint.

Parameters
[out]closestPointcomputed point
[out]closestParamfraction parameter at closest point.
[in]pointspace point
bool ProjectPointUnbounded ( DPoint3dR  closestPoint,
double &  closestParam,
DPoint3dCR  point 
) const

Project a point onto the unbounded.

Parameters
[out]closestPointcomputed point
[out]closestParamfraction parameter at closest point.
[in]pointspace point
ValidatedDRay3d ValidatedNormalize ( ) const

Return a (validated) copy with normalized direction.

Member Data Documentation

DVec3d direction

Direction vector. This is NOT necessarily a unit vector.

DPoint3d origin

Start point of ray.


The documentation for this struct was generated from the following file:

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.