PrParametrizeBdy.h

00001 //===========================================================================
00002 // GoTools - SINTEF Geometry Tools version 1.1
00003 //
00004 // GoTools module: parametrization
00005 //
00006 // Copyright (C) 2000-2005 SINTEF ICT, Applied Mathematics, Norway.
00007 //
00008 // This program is free software; you can redistribute it and/or          
00009 // modify it under the terms of the GNU General Public License            
00010 // as published by the Free Software Foundation version 2 of the License. 
00011 //
00012 // This program is distributed in the hope that it will be useful,        
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of         
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          
00015 // GNU General Public License for more details.                           
00016 //
00017 // You should have received a copy of the GNU General Public License      
00018 // along with this program; if not, write to the Free Software            
00019 // Foundation, Inc.,                                                      
00020 // 59 Temple Place - Suite 330,                                           
00021 // Boston, MA  02111-1307, USA.                                           
00022 //
00023 // Contact information: E-mail: tor.dokken@sintef.no                      
00024 // SINTEF ICT, Department of Applied Mathematics,                         
00025 // P.O. Box 124 Blindern,                                                 
00026 // 0314 Oslo, Norway.                                                     
00027 //
00028 // Other licenses are also available for this software, notably licenses
00029 // for:
00030 // - Building commercial software.                                        
00031 // - Building software whose source code you wish to keep private.        
00032 //===========================================================================
00033 #ifndef PRPARAMETRIZEBDY_H
00034 #define PRPARAMETRIZEBDY_H
00035 
00036 #include "PrOrganizedPoints.h"
00037 #include <boost/smart_ptr.hpp>
00038 
00039 /*<PrParametrizeBdy-syntax: */
00040 
00041 
00042 enum PrBdyParamKind {
00043   PrCHORDLENGTHBDY        = 1,
00044   PrCENTRIPETAL           = 2,
00045   PrUNIFBDY               = 3
00046 };
00047 
00053 class PrParametrizeBdy
00054 {
00055 protected:
00056 
00057   PrBdyParamKind       bdyparamtype_;
00058   boost::shared_ptr<PrOrganizedPoints> g_;
00059   vector<int>            neighbours_;
00060 
00061 // PRIVATE METHODS
00062 
00064   int          findBdyNode();
00065 
00068   int          getNextBdyNode(int i);
00069 
00071   double         chord(const Vector3D& a, const Vector3D& b);
00072 
00073 
00074 public:
00076   PrParametrizeBdy();
00078   virtual ~PrParametrizeBdy();
00079 
00081   virtual void attach(boost::shared_ptr<PrOrganizedPoints> graph);
00082 
00088   void setParamKind(PrBdyParamKind bdyparamtype = PrCHORDLENGTHBDY)
00089                    {bdyparamtype_ = bdyparamtype;}
00090 
00096   double         boundaryLength(int i1, int i2);
00097 
00101   bool         parametrize();
00102 
00110     // M.F. Mar. 97.
00111   bool         parametrizeSide(int i1, int i2);
00112 
00123   bool         parametrize(int c1, int c2, int c3, int c4,
00124                            double umin = 0.0, double umax = 1.0,  
00125                            double vmin = 0.0, double vmax = 1.0);
00126 
00134   void         findCornersFromXYZ(int* c);
00135 
00141   void         findCornersFromUV(int* c);
00142 };
00143 
00144 
00145 /*>PrParametrizeBdy-syntax: */
00146 
00147 /*Class:PrParametrizeBdy
00148 
00149 Name:              PrParametrizeBdy
00150 Syntax:            @PrParametrizeBdy-syntax
00151 Keywords:
00152 Description:       This class implements an algorithm for
00153                    parametrizing the boundary of a planar graph in $R^3$.
00154                    Typical choices are uniform and chord length,
00155                    either round the whole boundary or along each "side".
00156 Member functions:
00157                    "attach(GoHandle<PrOrganizedPoints> graph)" --\\
00158                    Set the graph.
00159 
00160                    "setParamKind()" --\\
00161                    Set type of parametrization to be used along the boundary.
00162                    Unless you have a strong reason to do so you should
00163                    set the parametrization to "PrCHORDLENGTHBDY".
00164 
00165                    "parametrize()" --\\
00166                    Parametrize the boundary of the planar graph.
00167                    The parameter domain will be the unit circle.
00168 
00169                    "parametrize(int& c1, int& c2, int& c3, int& c4)" --\\
00170                    Parametrize the boundary of the given planar graph.
00171                    The parameter domain will be the rectangle
00172                    [umin,umax]*[vmin,vmax]. Node c1 will be
00173                    mapped to (umin,vmin), c2 to (umax,vmin),
00174                    c3 to (umax,vmax) and c4 to (umin,vmax).
00175                    The nodes c1,c2,c3,c4 should be boundary nodes and
00176                    should be in anticlockwise sequence around the boundary.
00177                    The kind of parametrization along the four sides
00178                    of the square will be specified by setParamKind().
00179 
00180                    "findCornersFromXYZ(int* c)" --\\
00181                    Find four corner nodes c[0],c[1],c[2],c[3] by taking
00182                    c[0] to be an arbitrary boundary node and choosing
00183                    c[1],c[2],c[3] so that the lengths of four boundary
00184                    curves delimited by c[0],c[1],c[2],c[3] are as equal
00185                    in "chord" length (defined by setParamKind()) as possible.
00186                    The array c should be allocated outside with length 4.
00187 
00188                    "findCornersFromUV(int* c)" --\\
00189                    Find the indices c[0],c[1],c[2],c[3] of the four vertices
00190                    of the graph whose (u,v) points are the furthest
00191                    SW, SE, NE, and NW in that order.
00192                    The array c should be allocated outside with length 4.
00193 
00194 Constructors:
00195 Files:
00196 Example:
00197 
00198 
00199 See also:
00200 Developed by:      SINTEF Applied Mathematics, Oslo, Norway
00201 Author:            Michael Floater, SINTEF
00202 Date:              Nov. 98 (modified from previous PrParametrizer).
00203 */
00204 
00205 #endif // PRPARAMETRIZEBDY_H

Generated on Tue Jun 12 11:05:05 2007 for GoTools Parametrization Library by  doxygen 1.5.1