00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef _OSGLINE_H_
00040 #define _OSGLINE_H_
00041
00042 #include <OSGBaseTypes.h>
00043 #include <OSGBaseFunctions.h>
00044 #include "OSGVector.h"
00045
00046 OSG_BEGIN_NAMESPACE
00047
00048 class BoxVolume;
00049 class SphereVolume;
00050 class CylinderVolume;
00051 class FrustumVolume;
00052
00056 class OSG_BASE_DLLMAPPING Line
00057 {
00058
00059
00060 public:
00061
00062
00066 Line( void );
00067 Line(const Line &obj );
00068 Line(const Pnt3f &p0, const Pnt3f &p1 );
00069 Line(const Pnt3f &pos, const Vec3f &dir);
00070
00072
00076 ~Line(void);
00077
00079
00083 void setValue(const Pnt3f &p0 , const Pnt3f &p1 );
00084 void setValue(const Pnt3f &pos, const Vec3f &dir);
00085
00087
00091 bool getClosestPoints(const Line &line2,
00092 Pnt3f &ptOnThis, Pnt3f &ptOnLine2) const;
00093 Pnt3f getClosestPoint (const Pnt3f &point ) const;
00094 Real32 distance (const Pnt3f &point ) const;
00095
00097
00101 const Pnt3f &getPosition (void) const;
00102 const Vec3f &getDirection(void) const;
00103
00105
00109 bool intersect(const SphereVolume &sphere ) const;
00110 bool intersect(const SphereVolume &sphere, Real32 &enter,
00111 Real32 &exit ) const;
00112 bool intersect(const CylinderVolume &cyl ) const;
00113 bool intersect(const CylinderVolume &cyl, Real32 &enter,
00114 Real32 &exit ) const;
00115 bool intersect(const FrustumVolume &frustum ) const;
00116 bool intersect(const FrustumVolume &frustum, Real32 &enter,
00117 Real32 &exit ) const;
00118 bool intersect(const BoxVolume &box, Real32 &enter,
00119 Real32 &exit ) const;
00120 bool intersect( Real32 angle,
00121 const BoxVolume &box ) const;
00122 bool intersect( Real32 angle,
00123 const Vec3f &point ) const;
00124 bool intersect( Real32 angle,
00125 const Vec3f &v0,
00126 const Vec3f &v1,
00127 Vec3f &pt ) const;
00128 bool intersect(const Pnt3f &v0,
00129 const Pnt3f &v1,
00130 const Pnt3f &v2,
00131 Real32 &t,
00132 Vec3f *normal = NULL ) const;
00133
00135
00136
00137 protected:
00138
00139
00140
00141 private:
00142
00143 Pnt3f _pos;
00144 Vec3f _dir;
00145
00146 };
00147
00148 OSG_END_NAMESPACE
00149
00150 #include <OSGLine.inl>
00151
00152 #endif // _OSGLINE_H_