Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Plane3d.hh

00001 /*===========================================================================*\
00002  *                                                                           *
00003  *                               OpenMesh                                    *
00004  *      Copyright (C) 2001-2005 by Computer Graphics Group, RWTH Aachen      *
00005  *                           www.openmesh.org                                *
00006  *                                                                           *
00007  *---------------------------------------------------------------------------* 
00008  *                                                                           *
00009  *                                License                                    *
00010  *                                                                           *
00011  *  This library is free software; you can redistribute it and/or modify it  *
00012  *  under the terms of the GNU Library General Public License as published   *
00013  *  by the Free Software Foundation, version 2.                              *
00014  *                                                                           *
00015  *  This library is distributed in the hope that it will be useful, but      *
00016  *  WITHOUT ANY WARRANTY; without even the implied warranty of               *
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU        *
00018  *  Library General Public License for more details.                         *
00019  *                                                                           *
00020  *  You should have received a copy of the GNU Library General Public        *
00021  *  License along with this library; if not, write to the Free Software      *
00022  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                *
00023  *                                                                           *
00024 \*===========================================================================*/
00025 
00026 //=============================================================================
00027 //
00028 //  CLASS Plane3D
00029 //
00030 //=============================================================================
00031 
00032 
00033 #ifndef OPENMESH_PLANE3D_HH
00034 #define OPENMESH_PLANE3D_HH
00035 
00036 
00037 //== INCLUDES =================================================================
00038 
00039 #include <OpenMesh/Core/Math/VectorT.hh>
00040 
00041 
00042 //== FORWARDDECLARATIONS ======================================================
00043 
00044 //== NAMESPACES ===============================================================
00045 
00046 namespace OpenMesh {
00047 namespace VDPM {
00048 
00049 //== CLASS DEFINITION =========================================================
00050 
00051               
00058 class Plane3d
00059 {
00060 public:
00061 
00062   typedef OpenMesh::Vec3f         vector_type;
00063   typedef vector_type::value_type value_type;
00064 
00065 public:
00066 
00067   Plane3d()
00068     : d_(0)
00069   { }
00070 
00071   Plane3d(const vector_type &_dir, const vector_type &_pnt)
00072     : n_(_dir), d_(0)
00073   { 
00074     n_.normalize();
00075     d_ = -dot(n_,_pnt); 
00076   }
00077 
00078   value_type signed_distance(const OpenMesh::Vec3f &_p)
00079   {
00080     return  dot(n_ , _p) + d_;
00081   }
00082 
00083   // back compatibility
00084   value_type singed_distance(const OpenMesh::Vec3f &point)
00085   { return signed_distance( point ); }
00086 
00087 public:
00088 
00089   vector_type n_;
00090   value_type  d_;
00091 
00092 };
00093 
00094 //=============================================================================
00095 } // namespace VDPM
00096 } // namespace OpenMesh
00097 //=============================================================================
00098 #endif // OPENMESH_PLANE3D_HH defined
00099 //=============================================================================

acg pic Project OpenMesh, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .