source: GTP/trunk/Lib/Vis/Preprocessing/src/RayCaster.h @ 1824

Revision 1824, 2.2 KB checked in by bittner, 18 years ago (diff)

global lines support

RevLine 
[1520]1#ifndef _RayCaster_H__
2#define _RayCaster_H__
3
4#include "Containers.h"
5#include <string>
[1528]6#include "Vector3.h"
7
[1520]8using namespace std;
9
10
11namespace GtpVisibilityPreprocessor {
12
13
14class Intersectable;
15class VssRay;
16class SimpleRayContainer;
17class AxisAlignedBox3;
[1528]18//class Vector3;
[1520]19struct VssRayContainer;
20class Preprocessor;
[1528]21struct SimpleRay;
[1520]22
[1528]23
[1520]24/** This class provides an interface for ray casting.
25*/
26class RayCaster
27{
[1528]28
[1520]29public:
30       
31        enum {
32          INTERNAL_RAYCASTER = 0,
33          INTEL_RAYCASTER
34        };
35
36        RayCaster(const Preprocessor &preprocessor);
37
[1521]38        virtual ~RayCaster();
[1520]39
40        virtual int Type() const = 0;
41
[1521]42        /** Wrapper for casting single ray.
[1545]43                @returns ray or NULL if invalid
[1521]44        */
[1545]45        VssRay *CastRay(
[1528]46                const SimpleRay &simpleRay,
[1545]47            const AxisAlignedBox3 &box,
48                const bool castDoubleRay
[1521]49                );
50
[1520]51        virtual int CastRay(
[1528]52                const SimpleRay &simpleRay,
[1520]53        VssRayContainer &vssRays,
54                const AxisAlignedBox3 &box,
[1528]55                const bool castDoubleRay,
56                const bool pruneInvalidRays = true
[1520]57                ) = 0;
58
59         virtual void CastRays16(
60                 const int i,
61                 SimpleRayContainer &rays,
62                 VssRayContainer &vssRays,
63                 const AxisAlignedBox3 &sbox,
[1528]64                 const bool castDoubleRay,
65                 const bool pruneInvalidRays = true
[1520]66                 ) = 0;
67       
68
69protected:
[1528]70        struct Intersection
71        {
72                Intersection(): mObject(NULL), mFaceId(0)
73                {}
[1520]74
[1528]75                Intersection(const Vector3 &p, const Vector3 &n, Intersectable *o, const int f):
[1824]76                        mPoint(p), mNormal(n), mObject(o), mFaceId(f)
[1528]77                {}
78
79                Intersection(const Vector3 &p): mPoint(p), mObject(NULL), mFaceId(0)
80                {}
81                Vector3 mPoint;
82                Vector3 mNormal;
83                Intersectable *mObject;
84                int mFaceId;
85        };
86
[1824]87
[1520]88        int ProcessRay(
[1528]89                         const SimpleRay &ray,
90                         Intersection &hitA,
91                         Intersection &hitB,
[1520]92                         VssRayContainer &vssRays,
[1528]93                         const AxisAlignedBox3 &box,
94                         const bool castDoubleRay,
95                         const bool pruneInvalidRays = true
[1520]96                         );
97
[1528]98        /** Checks if ray is valid.
99                I.e., the ray is in valid view space.
100                @note: clamps the ray to valid view space.
101        */
102        bool ValidateRay(const Vector3 &origin,
103                                         const Vector3 &direction,
104                                 const AxisAlignedBox3 &box,
105                                         Intersection &hit);
[1520]106       
107        const Preprocessor &mPreprocessor;
108};
109
110
111}
112
113#endif
Note: See TracBrowser for help on using the repository browser.