FormIt C++ API  v23.0.0 (2023.0.0)
WSM::Utils::PickRay Class Reference

Description

PickRay is a class containing all the information needed to do a pick in perspective and parallel views.class PickRay.

#include <pickray.h>

Public Member Functions

 PickRay ()
 
 PickRay (const Line3d &pickray)
 
 PickRay (const Point2d &normalizedScreenPoint, bool normalizedScreenYUp=false)
 normalizedScreenPoint: Normalized screen space point. More...
 
 PickRay (const Point2d &normalizedScreenPoint1, const Point2d &normalizedScreenPoint2)
 This ctor takes 2 normalized screen points and does a "window select". More...
 
 PickRay (const Line3d &pickrayLine, const 1::vector< Plane > &planes, double screenPickRayRadius, double perspectiveScaleFactor, double baseRadius)
 This ctor takes all the information the pickray needs. More...
 
virtual ~PickRay ()
 
void AddPlane (Plane &plane, bool negate=false)
 Add a Plane to the pick frustum. More...
 
void AddPlanes (const 1::vector< Plane > &planes)
 Add a list of Planes to the pick frustum. More...
 
void ClearPlanes ()
 Clear the list of planes. More...
 
 operator const Line3d & () const
 Get the Line3d for this PickRay. More...
 
const Line3dGetLine () const
 Get the Line3d for this PickRay. More...
 
void SetLine (const WSM::Line3d &l)
 Set the WSM::Line3d. More...
 
 operator const 1::vector< Plane > & () const
 Get the vector of Planes for thisPickRay. More...
 
const ::vector< Plane > & GetPlanes () const
 Get the vector of Planes for thisPickRay. More...
 
double ModelSpacePickRayRadius (const Point3d &atPoint) const
 Get the model space pick radius for this PickRay at the given 3d point. More...
 
double ScreenSpacePickRayRadius () const
 Get the screen space pick radius for this PickRay. More...
 
bool SetScreenSpacePickRayRadius (double radius)
 Returns true if successful. More...
 
int ClosestToEye (const WSM::Point3d &pt1, const WSM::Point3d &pt2) const
 ClosestToEye returns the argument # that is closest to m_PickRay.point. More...
 
int ClosestToRayScreenPoint (const WSM::Point3d &pt1, const WSM::Point3d &pt2) const
 ClosestToRayScreenPoint returns the argument # that is closest to m_PickRay's screen point. More...
 
bool IntersectWithLine (const Line3d &line, WSM::Point3d &intersPoint, double &paramRay, double &paramLine, bool useFrustum=false, bool mustAlsoIntersectClosestPoint=false) const
 Intersect a pick ray and a 3d line. More...
 
bool IntersectsWithPoint (const WSM::Point3d &pt, bool useFrustum=false) const
 IntersectsWithPoint determines if the point lies within the PickRay. More...
 
void CalculatePerspectiveScaleFactor ()
 CalculatePerspectiveScaleFactor calculates the World to screen scale factor. More...
 
double GetPerspectiveScaleFactor () const
 GetPerspectiveScaleFactor returns the World to screen scale factor. More...
 
void SetPerspectiveScaleFactor (double factor)
 SetPerspectiveScaleFactor sets the World to screen scale factor. More...
 
double GetBaseRadius () const
 GetBaseRadius returns the base radius of the PickRay. More...
 
Point2d GetNormalizedScreenPoint () const
 Get/Set the NormalizedScreenPoint that produced this PickRay. More...
 
void SetNormalizedScreenPoint (const Point2d &pt)
 

Static Public Member Functions

static::vector< PlaneGetFrustumPlanesFromPath (const WSM::Point2d &p1, const WSM::Point2d &p2)
 Get the planes for a pick frustum that is centered around the screen path with a thickness that represents the screen pick tolerance. More...
 

Constructor & Destructor Documentation

WSM::Utils::PickRay::PickRay ( )
inline
WSM::Utils::PickRay::PickRay ( const Line3d pickray)
inline
WSM::Utils::PickRay::PickRay ( const Point2d normalizedScreenPoint,
bool  normalizedScreenYUp = false 
)

normalizedScreenPoint: Normalized screen space point.

normalizedScreenPoint: flag indicating Y increases going up.

WSM::Utils::PickRay::PickRay ( const Point2d normalizedScreenPoint1,
const Point2d normalizedScreenPoint2 
)

This ctor takes 2 normalized screen points and does a "window select".

WSM::Utils::PickRay::PickRay ( const Line3d pickrayLine,
const 1::vector< Plane > &  planes,
double  screenPickRayRadius,
double  perspectiveScaleFactor,
double  baseRadius 
)
inline

This ctor takes all the information the pickray needs.

Note: It does not take ICamera because everything needed from ICamera is already calculated and passed in.

virtual WSM::Utils::PickRay::~PickRay ( )
inlinevirtual

Member Function Documentation

void WSM::Utils::PickRay::AddPlane ( Plane plane,
bool  negate = false 
)
inline

Add a Plane to the pick frustum.

void WSM::Utils::PickRay::AddPlanes ( const 1::vector< Plane > &  planes)
inline

Add a list of Planes to the pick frustum.

void WSM::Utils::PickRay::CalculatePerspectiveScaleFactor ( )

CalculatePerspectiveScaleFactor calculates the World to screen scale factor.

This scale factor takes into account the camera's perspective.

void WSM::Utils::PickRay::ClearPlanes ( )
inline

Clear the list of planes.

int WSM::Utils::PickRay::ClosestToEye ( const WSM::Point3d pt1,
const WSM::Point3d pt2 
) const

ClosestToEye returns the argument # that is closest to m_PickRay.point.

Returns 1 if pt1 is closest, else returns 2 if pt2 is closest. If pt1.isEqual(pt2), 1 is returned.

int WSM::Utils::PickRay::ClosestToRayScreenPoint ( const WSM::Point3d pt1,
const WSM::Point3d pt2 
) const

ClosestToRayScreenPoint returns the argument # that is closest to m_PickRay's screen point.

If the two points have the same pixel coordinate, then the point closest to the m_PickRay.point (eye) is returned Returns 1 if pt1 is closest, else returns 2 if pt2 is closest.

double WSM::Utils::PickRay::GetBaseRadius ( ) const
inline

GetBaseRadius returns the base radius of the PickRay.

static ::vector<Plane> WSM::Utils::PickRay::GetFrustumPlanesFromPath ( const WSM::Point2d p1,
const WSM::Point2d p2 
)
static

Get the planes for a pick frustum that is centered around the screen path with a thickness that represents the screen pick tolerance.

const Line3d& WSM::Utils::PickRay::GetLine ( ) const
inline

Get the Line3d for this PickRay.

Point2d WSM::Utils::PickRay::GetNormalizedScreenPoint ( ) const
inline

Get/Set the NormalizedScreenPoint that produced this PickRay.

double WSM::Utils::PickRay::GetPerspectiveScaleFactor ( ) const
inline

GetPerspectiveScaleFactor returns the World to screen scale factor.

const ::vector<Plane>& WSM::Utils::PickRay::GetPlanes ( ) const
inline

Get the vector of Planes for thisPickRay.

bool WSM::Utils::PickRay::IntersectsWithPoint ( const WSM::Point3d pt,
bool  useFrustum = false 
) const

IntersectsWithPoint determines if the point lies within the PickRay.

The useFrustum flag will do a frustum pick instead of a 'cone' pick. The reason one would want to do a frustum pick is to match how WSM picks Vertices.

bool WSM::Utils::PickRay::IntersectWithLine ( const Line3d line,
WSM::Point3d intersPoint,
double &  paramRay,
double &  paramLine,
bool  useFrustum = false,
bool  mustAlsoIntersectClosestPoint = false 
) const

Intersect a pick ray and a 3d line.

In general, the line and ray (center line) will not be in the same plane. Thus, if not parallel, there will be two points, one on each, that represent the closest distance between them. If that closest distance is less that the ray's radius at that point, we return true. Also returned are the parameters of the intersection points on the lines The useFrustum flag will do a frustum pick instead of a 'cone' pick. The reason one would want to do a frustum pick is to match how WSM picks Edges. mustAlsoIntersectClosestPoint also tests whether the closest point on the line also is within pick tolerance.

double WSM::Utils::PickRay::ModelSpacePickRayRadius ( const Point3d atPoint) const

Get the model space pick radius for this PickRay at the given 3d point.

WSM::Utils::PickRay::operator const 1::vector< Plane > & ( ) const
inline

Get the vector of Planes for thisPickRay.

WSM::Utils::PickRay::operator const Line3d & ( ) const
inline

Get the Line3d for this PickRay.

double WSM::Utils::PickRay::ScreenSpacePickRayRadius ( ) const
inline

Get the screen space pick radius for this PickRay.

void WSM::Utils::PickRay::SetLine ( const WSM::Line3d l)
inline

Set the WSM::Line3d.

void WSM::Utils::PickRay::SetNormalizedScreenPoint ( const Point2d pt)
inline
void WSM::Utils::PickRay::SetPerspectiveScaleFactor ( double  factor)
inline

SetPerspectiveScaleFactor sets the World to screen scale factor.

bool WSM::Utils::PickRay::SetScreenSpacePickRayRadius ( double  radius)

Returns true if successful.


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