SIMPLIFY.H

Go to the documentation of this file.
00001 /* --
00002 OpenFX version 1.0 - Modelling, Animation and Rendering Package
00003 Copyright (C) 2000 OpenFX Development Team
00004 
00005 This program is free software; you can redistribute it and/or
00006 modify it under the terms of the GNU General Public License
00007 as published by the Free Software Foundation; either version 2
00008 of the License, or (at your option) any later version.
00009 
00010 This program is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 GNU General Public License for more details.
00014 
00015 You should have received a copy of the GNU General Public License
00016 along with this program; if not, write to the Free Software
00017 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018 
00019 You may contact the OpenFX development team via elecronic mail
00020 at core@openfx.org, or visit our website at http://openfx.org for
00021 further information and support details.
00022 -- */
00023 
00024 /* SIMPLIFY.H     */
00025 
00026 
00027 #define DESELECTED 0
00028 #define SELECTED   1
00029 #define INEDITOR   6
00030 
00036 typedef struct Simplify_SELECTEDEDGE {
00037   long e;
00038   long ea[2]; 
00039 } selectededge;
00040 
00046 typedef struct Simplify_SELECTEDFACE {
00047   long f;
00048   long ea[3]; 
00049   long fa[3]; 
00050   long del;
00051   vector n;
00052 } selectedface;
00053 
00059 typedef struct Simplify_VTYADJ {
00060   long v;
00061   long nf,ne;
00062   long *flist;
00063   long *elist;
00064 } vtyadj;
00065 
00066 #ifndef min
00067 #define min(a,b)  ( ((a) < (b)) ? (a) : (b) )
00068 #endif
00069 #ifndef max
00070 #define max(a,b)  ( ((a) > (b)) ? (a) : (b) )
00071 #endif
00072 #define VECCOPY(a,b)    { b[0] = a[0]; b[1] = a[1]; b[2] = a[2]; }
00073 #define VECSUB(a,b,c)   { c[0]=a[0]-b[0]; c[1]=a[1]-b[1]; c[2]=a[2]-b[2];}
00074 #define VECSUM(a,b,c)   { c[0]=a[0]+b[0]; c[1]=a[1]+b[1]; c[2]=a[2]+b[2];}
00075 #define VECSCALE(a,b,c) { c[0]=(a)*b[0]; c[1]=(a)*b[1]; c[2]=(a)*b[2];}
00076 #define DOT(a,b)        ( (a[0]*b[0]) + (a[1]*b[1]) + (a[2]*b[2]) )
00077 #define CROSS(v1,v2,r)  { \
00078                           r[0] = (v1[1]*v2[2]) - (v2[1]*v1[2]);  \
00079                           r[1] = (v1[2]*v2[0]) - (v1[0]*v2[2]);  \
00080                           r[2] = (v1[0]*v2[1]) - (v2[0]*v1[1]);  \
00081                          }
00082 #define POINT2VECTOR(p,v) v[0]=(double)p[0]; v[1]=(double)p[1]; \
00083                           v[2]=(double)p[2];
00084 #define VECTOR2POINT(v,p) p[0]=(long)v[0]; p[1]=(long)v[1]; \
00085                           p[2]=(long)v[2];
00086 
00087 #define NO               0
00088 #define YES              1
00089 #define FAIL            -1
00090 #define OK               1
00091 #ifndef PI
00092 #define PI 3.1415926
00093 #endif
00094 #define PI2            PI/2
00095 
00096 static BOOL CALLBACK SimplifyDlgProc(HWND hwnd, UINT msg,
00097                              WPARAM wparam, LPARAM lparam);
00098 static void FreeAdjFaces(vtyadj *vl,long nvl);
00099 static vtyadj *ListAdjFaces(selectedface *wf, long nf,
00100                             selectededge *we, long ne, long *nvll);
00101 static int Simplify1(vtyadj *vl, long nvl,
00102                         selectedface *wf, long nf,
00103                         selectededge *we, long ne,
00104                         double fan, double ean);
00105 static int DeTesselate(vtyadj *vl, long nvl,
00106                         selectedface *wf, long nf,
00107                         selectededge *we, long ne,
00108                         double angle);
00109 static void SimplifyObject(long nloop, double fan, double ean);
00110 
00111 static int O_normalize(vector v){
00112  double n,nn;
00113  n= (double)((v[0]*v[0]) + (v[1]*v[1]) + (v[2]*v[2]));
00114  if(n < 1.e-10)return FAIL;
00115  nn=sqrt(n);
00116  n = 1.0 / nn;
00117  VECSCALE(n,v,v)
00118  return OK;
00119 }
00120 
00121 #define DLG_SIM                     600
00122 #define DLG_SIM_ITER                601
00123 #define DLG_SIM_FACE                602
00124 #define DLG_SIM_EDGE                603

Generated on Sun Apr 27 14:20:11 2014 for OpenFX by  doxygen 1.5.6