00001 /* LIBGUL - Geometry Utility Library 00002 * Copyright (C) 1998-1999 Norbert Irmer 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Library General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Library General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Library General Public 00015 * License along with this library; if not, write to the 00016 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00017 * Boston, MA 02111-1307, USA. 00018 */ 00019 00020 #ifndef GUNU_SAMPLE_H 00021 #define GUNU_SAMPLE_H 00022 00023 namespace gunu { 00024 00025 /*-------------------------------------------------------------- 00026 Calculates the Greville abscissa values for a knot vector, 00027 'n+1' values are calculated 00028 ---------------------------------------------------------------*/ 00029 template< class T > 00030 void CalcGrevilleAbcissa( int n, int p, const Ptr<T>& U, Ptr<T>& G ); 00031 00032 /*----------------------------------------------------------------- 00033 Calculates equally spaced parameter values 00034 -----------------------------------------------------------------*/ 00035 template< class T > 00036 GULAPI void EqualSpacedParameters( int n, T u1, T u2, Ptr<T>& U ); 00037 00038 /*--------------------------------------------------------------------- 00039 Calculates a matrix of sample points for a surface, the parameter values 00040 for rows and columns must be given in the arrays 'sampV' and 'sampU' 00041 -----------------------------------------------------------------------*/ 00042 template< class T, class HP, class EP > 00043 void CalcSurfaceMesh( int nu, int pu, const Ptr<T>& U, 00044 int nv, int pv, const Ptr<T>& V, 00045 const Ptr< Ptr<HP> >& Pw, 00046 int nSampU, const Ptr<T>& sampU, 00047 int nSampV, const Ptr<T>& sampV, 00048 Ptr< Ptr<EP> >& sampP ); 00049 00050 /*--------------------------------------------------------------- 00051 Calculates the control points of a iso curve with constant u value 00052 of a nurbs surface 00053 ---------------------------------------------------------------*/ 00054 template< class T, class HP > 00055 GULAPI void ExtractIsoCurveU( T u, 00056 int nu, int pu, const Ptr<T>& U, 00057 int nv, int pv, const Ptr<T>& V, 00058 const Ptr< Ptr<HP> >& Pw, 00059 Ptr<HP>& Cw ); 00060 /*--------------------------------------------------------------- 00061 Calculates the control points of a iso curve with constant v value 00062 of a nurbs surface 00063 ---------------------------------------------------------------*/ 00064 template< class T, class HP > 00065 GULAPI void ExtractIsoCurveV( T v, 00066 int nu, int pu, const Ptr<T>& U, 00067 int nv, int pv, const Ptr<T>& V, 00068 const Ptr< Ptr<HP> >& Pw, 00069 Ptr<HP>& Cw ); 00070 00071 } 00072 00073 00074 #endif