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 /************************************************************************ 00021 CIRCLE, SURFACES OF REVOLUTION, SPHERE 00022 *************************************************************************/ 00023 00024 #ifndef GUGE_REVOLVE_H 00025 #define GUGE_REVOLVE_H 00026 00027 namespace gunu { 00028 00029 using gul::Ptr; 00030 using gul::point; 00031 using gul::hpoint; 00032 00033 /*---------------------------------------------------------------------*//** 00034 Create a circle as a NURBS curve (see "The NURBS book") */ 00035 /*------------------------------------------------------------------------*/ 00036 template< class T > 00037 void Circle( 00038 point<T> O, /* center (origin of local coordinate system) */ 00039 point<T> X, /* X-axis of loc.-coord.-syst., |X| = |Y| = 1 */ 00040 point<T> Y, /* Y-axis of loc.-coord.-syst., perpendicular to X */ 00041 T r, /* radius */ 00042 T theta_start, /* start angle (in radians)(in regard to X) */ 00043 T theta_end, /* end angle (in radians)(in regard to X) */ 00044 int *ret_n, /* => number of controlpoints - 1 */ 00045 int *ret_p, /* => degree */ 00046 Ptr<T> *retU, /* => knot vector */ 00047 Ptr< hpoint<T> > *retPw /* => control points */ ); 00048 00049 /*----------------------------------------------------------------------*//** 00050 Creates a surface of revolution */ 00051 /*-------------------------------------------------------------------------*/ 00052 template< class T, class CHP > 00053 GULAPI void Revolution( 00054 point<T> S, /* point on rotation axis */ 00055 point<T> A, /* direction of axis, |A| = 1 */ 00056 T theta, /* rotation angle (in radians) */ 00057 int m, /* number of control points -1 of rotated curve */ 00058 Ptr< CHP >& Pwj, /* control points of rotated curve */ 00059 int *ret_nu, /* number of control points -1 per row of the surface*/ 00060 int *ret_pu, /* degree of surface of revolution (for rows) */ 00061 Ptr<T> *retU, /* knotvector of surface of revolution (for rows)*/ 00062 Ptr< Ptr< hpoint<T> > >*retPw);/*control points of surface of rev. */ 00063 00064 /*-----------------------------------------------------------------------*//** 00065 Creates a unit sphere (centered at origin) */ 00066 /*--------------------------------------------------------------------------*/ 00067 template< class T > 00068 GULAPI void UnitSphere( 00069 int *ret_nu, int *ret_pu, Ptr<T> *retU, 00070 int *ret_nv, int *ret_pv, Ptr<T> *retV, 00071 Ptr< Ptr< hpoint<T> > > *retPw ); 00072 00073 } 00074 00075 #endif 00076 00077 00078 00079 00080 00081 00082 00083 00084