Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

OSGLine.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002  *                                OpenSG                                     *
00003  *                                                                           *
00004  *                                                                           *
00005  *             Copyright (C) 2000,2001 by the OpenSG Forum                   *
00006  *                                                                           *
00007  *                            www.opensg.org                                 *
00008  *                                                                           *
00009  *   contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de          *
00010  *                                                                           *
00011 \*---------------------------------------------------------------------------*/
00012 /*---------------------------------------------------------------------------*\
00013  *                                License                                    *
00014  *                                                                           *
00015  * This library is free software; you can redistribute it and/or modify it   *
00016  * under the terms of the GNU Library General Public License as published    *
00017  * by the Free Software Foundation, version 2.                               *
00018  *                                                                           *
00019  * This library is distributed in the hope that it will be useful, but       *
00020  * WITHOUT ANY WARRANTY; without even the implied warranty of                *
00021  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00022  * Library General Public License for more details.                          *
00023  *                                                                           *
00024  * You should have received a copy of the GNU Library General Public         *
00025  * License along with this library; if not, write to the Free Software       *
00026  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                 *
00027  *                                                                           *
00028 \*---------------------------------------------------------------------------*/
00029 /*---------------------------------------------------------------------------*\
00030  *                                Changes                                    *
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     /*==========================  PUBLIC  =================================*/
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     /*==========================  PRIVATE  ================================*/
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

Generated on Wed Jul 3 14:39:01 2002 for OpenSG by doxygen1.2.16