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 GUGR_FACE_H
00021 #define GUGR_FACE_H
00022
00023 namespace gugr {
00024
00025 using gul::Ptr;
00026 using gul::point;
00027 using gul::point2;
00028
00029 /*
00030 template< class T >
00031 bool DoTriangulateFace(
00032 int nVerts, const Ptr< point<T> >& Verts, int faceleft, int faceright,
00033 gugr::triangle_list *retTri, point<T> *retNormal,
00034 int *retFaceleft, int *retFaceright );
00035
00036 template< class T >
00037 bool FaceArea(
00038 int nVerts, const Ptr< point<T> >& Verts, int faceleft, int faceright,
00039 point<T> *retNormal, int *retFaceleft, int *retFaceright, T *retArea,
00040 int *ret_nTrii, Ptr<int[3]> *retTrii );
00041
00042
00043 template< class T >
00044 bool TriangulateFace( int nVerts, const Ptr< point<T> >& Verts,
00045 void (*trifunc)( void *,
00046 const point<T> *, const point<T> *, const point<T> *,
00047 const point<T> *, const point<T> *, const point<T> * ),
00048 void *usrdata );
00049
00050
00051 template< class T >
00052 bool TriangulateFace( int nVerts,
00053 const Ptr< point<T> >& Verts, const Ptr< point<T> >& Normals,
00054 void (*trifunc)( void *,
00055 const point<T> *, const point<T> *, const point<T> *,
00056 const point<T> *, const point<T> *, const point<T> * ),
00057 void *usrdata );
00058 */
00059
00060
00061 /*-------------------------------------------------------------------------
00062 calculates the plane in which the vertices of a polygon, consisting of a
00063 single contour with coplanar 3d vertices, lies.
00064
00065 it tries to avoid calculating a normal vector which is totally
00066 wrong (because of rounding errors) by calculating the normal at the vertex
00067 which gives the smallest upper/lower bound ratio by interval arithmetic
00068 --------------------------------------------------------------------------*/
00069 template< class T >
00070 GULAPI bool CalcPlane(
00071 int nVerts, const Ptr< point<T> >& Verts,
00072 point<T>& o, point<T>& b1, point<T>& b2, point<T>& b3 );
00073
00074 /*----------------------------------------------------------------------
00075 Check if a contour is lefthanded (if the contour self-intersects this
00076 check makes no sense)
00077 ----------------------------------------------------------------------*/
00078 template< class T >
00079 GULAPI bool CheckLeftHandedness(
00080 int nP, const Ptr< point<T> >& P, const Ptr< Ptr<T> >& Ti,
00081 bool& lefthanded, bool& selfintersect );
00082
00083 /*------------------------------------------------------------------------
00084 Triangulate a polygon with 3d vertices, normals, and texture coordinates
00085 -------------------------------------------------------------------------*/
00086 template< class T >
00087 GULAPI void TriangulatePolygon3d(
00088 const gul::List< gul::ListNode< gul::polyline< point<T> > > >& C3,
00089 const gul::List< gul::ListNode< gul::polyline< point<T> > > >& N3,
00090 const gul::List< gul::ListNode< gul::polyline< point<T> > > >& T3,
00091 const Ptr< Ptr< T > >& Ti,
00092 Ptr< point2<T> >& D,
00093 Ptr< point<T> >& F,
00094 Ptr< point<T> >& N,
00095 Ptr< point<T> >& Tx,
00096 int *nTri,
00097 Ptr<gul::itriangle>& Tri );
00098
00099
00100 }
00101
00102 #endif
00103
1.2.13.1 written by Dimitri van Heesch,
© 1997-2001