Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics
[Home] [Tutorials] [All Classes] [Grouped Classes]

vl::RayIntersector Class Reference

The RayIntersector class is used to detect the intersection points between a Ray and a set of Actor[s]. More...

#include <RayIntersector.hpp>

Inheritance diagram for vl::RayIntersector:

vl::Object

List of all members.

Public Member Functions

virtual const char * className ()
 Returns the name of the class.
 RayIntersector ()
const ActorCollectionactors () const
 The Actors against which the intersection test is performed.
ActorCollectionactors ()
 The Actors against which the intersection test is performed.
const Rayray () const
 The ray in world coordinates to be intersected with the actors().
void setRay (const Ray &ray)
 The ray in world coordinates to be intersected with the actors().
const Frustumfrustum () const
 The frustum in world coordinates used to cull the objects.
void setFrustum (const Frustum &frustum)
 The frustum in world coordinates used to cull the objects.
const std::vector< ref
< RayIntersection > > & 
intersections () const
 The intersection points detected by the last intersect() call sorted according to their distance (the first one is the closest).
void intersect ()
 Executes the intersection test.
void intersect (const Ray &ray, SceneManager *scene_manager)
 Computes the intersections between the given ray and the Actor[s] contained in the given scene manager.

Protected Member Functions

void intersect (Actor *act)
void intersectGeometry (Actor *act, Geometry *geom)
template<class T >
void intersectTriangle (const T &a, const T &b, const T &c, Actor *, Geometry *geom, Primitives *prim, int prim_idx)
template<class T >
void intersectPolygon (const std::vector< T > &polygon, Actor *, Geometry *geom, Primitives *prim)
template<class T >
void intersectQuad (const T &a, const T &b, const T &c, const T &d, Actor *, Geometry *geom, Primitives *prim, int prim_idx)

Static Protected Member Functions

static bool sorter (const ref< RayIntersection > &a, const ref< RayIntersection > &b)

Protected Attributes

Frustum mFrustum
std::vector< ref
< RayIntersection > > 
mIntersections
ref< ActorCollectionmActors
Ray mRay


Detailed Description

The RayIntersector class is used to detect the intersection points between a Ray and a set of Actor[s].

Constructor & Destructor Documentation

vl::RayIntersector::RayIntersector (  )  [inline]


Member Function Documentation

virtual const char* vl::RayIntersector::className (  )  [inline, virtual]

Returns the name of the class.

Reimplemented from vl::Object.

const ActorCollection* vl::RayIntersector::actors (  )  const [inline]

The Actors against which the intersection test is performed.

ActorCollection* vl::RayIntersector::actors (  )  [inline]

The Actors against which the intersection test is performed.

const Ray& vl::RayIntersector::ray (  )  const [inline]

The ray in world coordinates to be intersected with the actors().

void vl::RayIntersector::setRay ( const Ray ray  )  [inline]

The ray in world coordinates to be intersected with the actors().

const Frustum& vl::RayIntersector::frustum (  )  const [inline]

The frustum in world coordinates used to cull the objects.

void vl::RayIntersector::setFrustum ( const Frustum frustum  )  [inline]

The frustum in world coordinates used to cull the objects.

const std::vector< ref<RayIntersection> >& vl::RayIntersector::intersections (  )  const [inline]

The intersection points detected by the last intersect() call sorted according to their distance (the first one is the closest).

void RayIntersector::intersect (  ) 

Executes the intersection test.

Note:
Before calling this function the transforms and the bounding volumes of the Actor[s] to be intersected must be updated, in this order.

All the intersections are mande on the Actor's LOD level #0.

void RayIntersector::intersect ( const Ray ray,
SceneManager scene_manager 
)

Computes the intersections between the given ray and the Actor[s] contained in the given scene manager.

This is an utility function equivalent to:

 intersector->actors()->clear();
 scene_manager->appendActors( *intersector->actors() );
 intersector->setRay(ray);
 intersector->intersect();

static bool vl::RayIntersector::sorter ( const ref< RayIntersection > &  a,
const ref< RayIntersection > &  b 
) [inline, static, protected]

void RayIntersector::intersect ( Actor act  )  [protected]

void RayIntersector::intersectGeometry ( Actor act,
Geometry geom 
) [protected]

template<class T >
void RayIntersector::intersectTriangle ( const T &  a,
const T &  b,
const T &  c,
Actor act,
Geometry geom,
Primitives prim,
int  prim_idx 
) [inline, protected]

template<class T >
void RayIntersector::intersectPolygon ( const std::vector< T > &  polygon,
Actor act,
Geometry geom,
Primitives prim 
) [inline, protected]

template<class T >
void RayIntersector::intersectQuad ( const T &  a,
const T &  b,
const T &  c,
const T &  d,
Actor act,
Geometry geom,
Primitives prim,
int  prim_idx 
) [inline, protected]


Member Data Documentation


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

Visualization Library v2010.06 Reference Documentation
Copyright 2005-2009 Michele Bosi. All rights reserved.
Updated on Tue Jun 1 00:57:20 2010.
Permission is granted to use this page to write and publish articles regarding Visualization Library.