libnoise logo

A portable, open-source, coherent noise-generating library for C++


line.h

00001 // line.h
00002 //
00003 // Copyright (C) 2004 Keith Davies
00004 //
00005 // This library is free software; you can redistribute it and/or modify it
00006 // under the terms of the GNU Lesser General Public License as published by
00007 // the Free Software Foundation; either version 2.1 of the License, or (at
00008 // your option) any later version.
00009 //
00010 // This library is distributed in the hope that it will be useful, but WITHOUT
00011 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
00013 // License (COPYING.txt) for more details.
00014 //
00015 // You should have received a copy of the GNU Lesser General Public License
00016 // along with this library; if not, write to the Free Software Foundation,
00017 // Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 //
00019 
00020 #ifndef NOISE_MODEL_LINE_H
00021 #define NOISE_MODEL_LINE_H
00022 
00023 #include <assert.h>
00024 #include <math.h>
00025 #include <stdlib.h>
00026 #include "../module/modulebase.h"
00027 
00028 namespace noise
00029 {
00030 
00031   namespace model
00032   {
00033 
00036 
00039 
00053     class Line
00054     {
00055 
00056       public:
00057 
00059         Line ();
00060 
00065         Line (const module::Module& module);
00066 
00074         bool GetAttenuate () const
00075         {
00076           return m_attenuate;
00077         }
00078 
00085         const module::Module& GetModule () const
00086         {
00087           assert (m_pModule != NULL);
00088           return *m_pModule;
00089         }
00090 
00111         double GetValue (double p) const;
00112 
00118         void SetAttenuate (bool att)
00119         {
00120           m_attenuate = att;
00121         }
00122 
00129         void SetEndPoint (double x, double y, double z)
00130         {
00131           m_x1 = x;
00132           m_y1 = y;
00133           m_z1 = z;
00134         }
00135 
00143         void SetModule (const module::Module& module)
00144         {
00145           m_pModule = &module;
00146         }
00147 
00154         void SetStartPoint (double x, double y, double z)
00155         {
00156           m_x0 = x;
00157           m_y0 = y;
00158           m_z0 = z;
00159         }
00160 
00161       private:
00162 
00165         bool m_attenuate;
00166 
00168         const module::Module* m_pModule;
00169 
00171         double m_x0;
00172 
00174         double m_x1;
00175 
00177         double m_y0;
00178 
00180         double m_y1;
00181 
00183         double m_z0;
00184 
00186         double m_z1;
00187 
00188     };
00189 
00191 
00193 
00194   }
00195 
00196 }
00197 
00198 #endif