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 OSG_BASE_DLLMAPPING BoxVolume;
00049 class OSG_BASE_DLLMAPPING SphereVolume;
00050 class OSG_BASE_DLLMAPPING CylinderVolume;
00051 class OSG_BASE_DLLMAPPING FrustumVolume;
00052
00054
00055 class OSG_BASE_DLLMAPPING Line
00056 {
00057
00058 public:
00059
00060
00064 Line(void );
00065 Line(const Line &obj );
00066 Line(const Pnt3f &p0, const Pnt3f &p1 );
00067 Line(const Pnt3f &pos, const Vec3f &dir );
00068
00070
00074 void setValue(const Pnt3f &p0 , const Pnt3f &p1 );
00075 void setValue(const Pnt3f &pos, const Vec3f &dir);
00076
00078
00082 bool getClosestPoints(const Line &line2,
00083 Pnt3f &ptOnThis, Pnt3f &ptOnLine2) const;
00084 Pnt3f getClosestPoint (const Pnt3f &point ) const;
00085 Real32 distance (const Pnt3f &point ) const;
00086
00088
00092 inline const Pnt3f &getPosition (void) const;
00093 inline const Vec3f &getDirection(void) const;
00094
00096
00100 bool intersect(const SphereVolume &sphere ) const;
00101 bool intersect(const SphereVolume &sphere, Real32 &enter,
00102 Real32 &exit ) const;
00103 bool intersect(const CylinderVolume &cyl ) const;
00104 bool intersect(const CylinderVolume &cyl, Real32 &enter,
00105 Real32 &exit ) const;
00106 bool intersect(const FrustumVolume &frustum ) const;
00107 bool intersect(const FrustumVolume &frustum, Real32 &enter,
00108 Real32 &exit ) const;
00109 bool intersect(const BoxVolume &box, Real32 &enter,
00110 Real32 &exit ) const;
00111 bool intersect( Real32 angle,
00112 const BoxVolume &box ) const;
00113 bool intersect( Real32 angle,
00114 const Vec3f &point ) const;
00115 bool intersect( Real32 angle,
00116 const Vec3f &v0,
00117 const Vec3f &v1,
00118 Vec3f &pt ) const;
00119 bool intersect(const Pnt3f &v0,
00120 const Pnt3f &v1,
00121 const Pnt3f &v2,
00122 Real32 &t,
00123 Vec3f *normal = NULL ) const;
00124
00125
00126
00127 private:
00128
00129 Pnt3f _pos;
00130 Vec3f _dir;
00131
00132 };
00133
00134 OSG_END_NAMESPACE
00135
00136 #include <OSGLine.inl>
00137
00138 #endif // LINE_CLASS_DECLARATION