Main Page   Class Hierarchy   Compound List   File List   Compound Members  

hnurbs.h

00001 /*=============================================================================
00002         File: hnurbsS.h
00003      Purpose:       
00004     Revision: $Id: hnurbs.h,v 1.2 2002/05/13 21:07:46 philosophil Exp $
00005   Created by: Philippe Lavoie          (3 Oct, 1996)
00006  Modified by: 
00007 
00008  Copyright notice:
00009           Copyright (C) 1996-1997 Philippe Lavoie
00010  
00011           This library is free software; you can redistribute it and/or
00012           modify it under the terms of the GNU Library General Public
00013           License as published by the Free Software Foundation; either
00014           version 2 of the License, or (at your option) any later version.
00015  
00016           This library is distributed in the hope that it will be useful,
00017           but WITHOUT ANY WARRANTY; without even the implied warranty of
00018           MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019           Library General Public License for more details.
00020  
00021           You should have received a copy of the GNU Library General Public
00022           License along with this library; if not, write to the Free
00023           Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00024 =============================================================================*/
00025 #ifndef _nurbs_hnurbs_h_
00026 #define _nurbs_hnurbs_h_
00027 
00028 #include "nurbs.h"
00029 
00030 class PlHNurbsCurveNode ;
00031 
00032 class PlHNurbsCurve : public PlParaCurve {
00033 public:
00034   PlHNurbsCurve() ;
00035   virtual ~PlHNurbsCurve() { reset() ; }
00036   
00037   void add(const PlNurbsCurve& curve, T uS, T uE) ;
00038   void remove(void) ;
00039   void reset(void) ;
00040 
00041   T minKnot() const { return 0.0 ; }
00042   T maxKnot() const { return 1.0 ; }
00043 
00044   HPoint_nD<T,N> operator()(T u) const;
00045   void deriveAt(T u, int, PlVector< HPoint_nD<T,N> >&) const;
00046   void deriveAt(T u, int, PlVector< Point_nD<T,N> >&) const;
00047 
00048   void interpolate(const PlVector< Point_nD<T,N> > &Pts, int deg, T acceptError=0.5, int nSample=100,  int maxTries=100, int nInitPoints=-1, int nPoints=-1);
00049 
00050   void draw(Image_Color& img, const Color& col) const ;
00051   void draw(Image_UBYTE& img, unsigned char col) const ;
00052 private:
00053   PlHNurbsCurveNode *first, *last ;
00054 };
00055 
00056 class PlHNurbsCurveNode: public PlParaCurve{
00057 public:
00058   T &u0, &u1 ;
00059 
00060 
00061   PlHNurbsCurveNode *prev,*next ;
00062   PlNurbsCurve *curve ;
00063 
00064   PlHNurbsCurveNode() ;
00065   PlHNurbsCurveNode(const PlNurbsCurve& c, T uS, T uE) ;
00066 
00067 
00068   T minKnot() const { return u0_ ; }
00069   T maxKnot() const { return u1_ ; }
00070 
00071   HPoint_nD<T,N> operator()(T u) const;
00072   void deriveAt(T u, int, PlVector< HPoint_nD<T,N> >&) const;
00073   void deriveAt(T u, int, PlVector< Point_nD<T,N> >&) const;
00074 
00075 protected:
00076   T u0_,u1_ ;
00077   T uD ; 
00078 };
00079 
00080 
00081 #endif // _nurbs_hnurbs_h_

Generated on Tue Jun 24 13:26:55 2003 for NURBS++ by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002