# 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:

List of all members.

## Public Member Functions

virtual const char * | className ()
| Returns the name of the class.
| RayIntersector ()
const ActorCollection * | actors () const
| The Actors against which the intersection test is performed.
ActorCollection * | actors ()
| The Actors against which the intersection test is performed.
const Ray & | ray () 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 Frustum & | frustum () 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)
void | intersectTriangle (const fvec3 &a, const fvec3 &b, const fvec3 &c, Actor *, Geometry *geom, Primitives *prim, int prim_idx)
void | intersectPolygon (const std::vector< fvec3 > &polygon, Actor *, Geometry *geom, Primitives *prim)
void | intersectQuad (const fvec3 &a, const fvec3 &b, const fvec3 &c, const fvec3 &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

ref< ActorCollection > | mActors
Ray | mRay
Frustum | mFrustum
std::vector< ref < RayIntersection > > | mIntersections

## 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]`

void RayIntersector::intersectTriangle | ( | const fvec3 & | a,
|  | const fvec3 & | b,
|  | const fvec3 & | c,
|  | Actor * | act,
|  | Geometry * | geom,
|  | Primitives * | prim,
|  | int | prim_idx |
| ) |  |  | `[protected]`

void RayIntersector::intersectPolygon | ( | const std::vector< fvec3 > & | polygon,
|  | Actor * | act,
|  | Geometry * | geom,
|  | Primitives * | prim |
| ) |  |  | `[protected]`

void RayIntersector::intersectQuad | ( | const fvec3 & | a,
|  | const fvec3 & | b,
|  | const fvec3 & | c,
|  | const fvec3 & | d,
|  | Actor * | act,
|  | Geometry * | geom,
|  | Primitives * | prim,
|  | int | prim_idx |
| ) |  |  | `[protected]`

## Member Data Documentation

ref<ActorCollection> vl::RayIntersector::mActors`[protected]`

Ray vl::RayIntersector::mRay`[protected]`

Frustum vl::RayIntersector::mFrustum`[protected]`

std::vector< ref<RayIntersection> > vl::RayIntersector::mIntersections`[protected]`

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

- E:/VisualizationLibrary/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vl/RayIntersector.hpp
- E:/VisualizationLibrary/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vl/RayIntersector.cpp

Visualization Library v2009.07 Reference Documentation
Copyright 2005-2009 Michele Bosi. All rights reserved.
Updated on Mon Aug 10 21:41:38 2009.
Permission is granted to use this page to write and publish articles regarding Visualization Library.