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

vlvoxelop_centraldiff.h

Go to the documentation of this file.
00001 // $Id: vlvoxelop_centraldiff.h,v 1.3 2003/06/13 07:14:13 sarang Exp $
00002 //
00003 // OpenVL - A Library for working with volumetric datasets.
00004 //          http://openvl.sf.net
00005 //
00006 // Copyright (C) 2000-2003  Sarang Lakare <sarang#users.sf.net>
00007 //
00008 // This library is free software; you can redistribute it and/or
00009 // modify it under the terms of the GNU Library General Public
00010 // License as published by the Free Software Foundation; either
00011 // version 2 of the License, or (at your option) any later version.
00012 //
00013 // This library is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016 // Library General Public License for more details.
00017 //
00018 // You should have received a copy of the GNU Library General Public
00019 // License along with this library; if not, write to the Free Software
00020 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00021 // USA.
00022 //
00023 // Please report all bugs and problems to openvl-devel@lists.sf.net or
00024 // at the OpenVL website.
00025 //
00026 
00027 #ifndef _vlVoxelOpCentralDiff_h
00028 #define _vlVoxelOpCentralDiff_h
00029 
00030 #include "vlvoxeloperator.h"
00031 #include "vlvarlistadmin.h"
00032 
00040 template <typename DataType, vlLayoutType Layout>
00041 class vlVoxelOpCentralDiff : public vlVoxelOperator<DataType, Layout>
00042 {
00043 public:
00044   vlVoxelOpType type() { return vlVoxelOp::CentralDiff; };
00045 
00046   std::string name() { return ("CentralDiff"); };
00047 
00049   vlLayoutType layout() { return Layout; };
00050 
00052   vlVarList * config() { return (&m_varList); };
00053   
00058   bool getValue(vlVolIterConst<DataType, Layout> & iter, DataType & value)
00059   { return (false); };
00060 
00066   bool getValue(vlVolIterConst<DataType, Layout> & iter, vlVoxelOpValue & value)
00067   {
00068     double dx = (double)(iter.getRelativeX(1)-iter.getRelativeX(-1));
00069     double dy = (double)(iter.getRelativeY(1)-iter.getRelativeY(-1));
00070     double dz = (double)(iter.getRelativeZ(1)-iter.getRelativeZ(-1));
00071 
00072     value.setNormal3f(vlNormal3f(dx, dy, dz));
00073 
00074     value.setDl(sqrt(dx*dx+dy*dy+dz*dz));
00075 
00076     return (true);
00077   };
00078   
00079 protected:
00081   vlVarListAdmin m_varList;
00082 
00083 };
00084 
00085 #endif // _vlVoxelOpCentralDiff_h

Generated on Fri Mar 18 11:33:15 2005 for OpenVL by doxygen 1.3.3