- Various tweaks to make the code build with gcc-2.95 under linux.
- added a -n <num> option to specify a minimum number of nodes to emit irregardless of the error threshold.
This commit is contained in:
parent
1a3c24506b
commit
37d4e6f738
8 changed files with 117 additions and 4 deletions
|
@ -209,7 +209,8 @@ Edge *GreedySubdivision::select(int sx, int sy, Triangle *t)
|
|||
|
||||
is_used(sx,sy) = DATA_POINT_USED;
|
||||
count++;
|
||||
return insert(Vec2(sx,sy), t);
|
||||
Vec2 tmp(sx,sy);
|
||||
return insert(tmp, t);
|
||||
}
|
||||
|
||||
|
||||
|
|
89
src/Prep/Terra/Makefile-gcc-2.95
Normal file
89
src/Prep/Terra/Makefile-gcc-2.95
Normal file
|
@ -0,0 +1,89 @@
|
|||
#################################################################
|
||||
#
|
||||
# Configuration variables.
|
||||
# You should change these to fit your system.
|
||||
#
|
||||
|
||||
CC = cc
|
||||
C++ = g++-2.95
|
||||
|
||||
# For compiling on SGI's with the pre-5.3 (ie. cfront-based) compiler:
|
||||
# add '-ptr/tmp/terra_ptrepository' to OPTFLAGS
|
||||
# add '-pte.cc' to LFLAGS
|
||||
|
||||
OPTFLAGS = -O2 -g
|
||||
#OPTFLAGS = -g -mips2
|
||||
# OPTFLAGS = -O2 -mips2
|
||||
|
||||
GUI_LIBS = -lglut -lGLU -lGL -L/usr/X11R6/lib -lXmu -lX11
|
||||
LIBS =
|
||||
|
||||
#
|
||||
# This defines the location of the GLUT libraries
|
||||
#
|
||||
ANIM = /afs/cs/project/anim/garland
|
||||
GLUT_FLAGS =
|
||||
GLUT_INCDIR = $(ANIM)/include
|
||||
GLUT_LIBDIR = $(ANIM)/lib
|
||||
|
||||
#
|
||||
# Include any other search directories you need here
|
||||
#
|
||||
INCDIR = -I$(GLUT_INCDIR)
|
||||
LIBDIR = -L$(GLUT_LIBDIR)
|
||||
|
||||
#
|
||||
# These are the flags for compilation (CFLAGS) and linking (LFLAGS)
|
||||
#
|
||||
# CFLAGS = $(INCDIR) $(OPTFLAGS) -DSAFETY
|
||||
CFLAGS = $(INCDIR) $(OPTFLAGS) -DSAFETY -DIOSTREAMH
|
||||
LFLAGS = $(LIBDIR) $(OPTFLAGS)
|
||||
|
||||
|
||||
#################################################################
|
||||
#
|
||||
# Rules for building the Terra programs.
|
||||
# You should not need to change anything here.
|
||||
#
|
||||
|
||||
.SUFFIXES: .cc
|
||||
.cc.o:
|
||||
$(C++) $(CFLAGS) -c $<
|
||||
|
||||
.C.o:
|
||||
$(C++) $(CFLAGS) -c $<
|
||||
|
||||
|
||||
BASE_SRCS = Quadedge.cc Subdivision.cc Map.cc Mask.cc cmdline.cc \
|
||||
GreedyInsert.cc Heap.cc greedy.cc output.cc
|
||||
GUI_SRCS = glHacks.cc gui.cc xterra.cc
|
||||
|
||||
TERRA_SRCS = terra.cc $(BASE_SRCS)
|
||||
XTERRA_SRCS = $(GUI_SRCS) $(BASE_SRCS)
|
||||
|
||||
TERRA_OBJS = $(TERRA_SRCS:.cc=.o)
|
||||
XTERRA_OBJS = $(XTERRA_SRCS:.cc=.o)
|
||||
|
||||
|
||||
TARGETS = terra xterra
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
terra: $(TERRA_OBJS)
|
||||
$(C++) $(LFLAGS) -o terra $(TERRA_OBJS) $(LIBS)
|
||||
|
||||
xterra: $(XTERRA_OBJS)
|
||||
$(C++) $(LFLAGS) -o xterra $(XTERRA_OBJS) $(GUI_LIBS) $(LIBS)
|
||||
|
||||
clean :
|
||||
/bin/rm -f $(XTERRA_OBJS) $(TERRA_OBJS) $(TARGETS)
|
||||
/bin/rm -f -r ii_files ptrepository
|
||||
find . -name '*~' -print -exec rm -f {} \;
|
||||
find . -name 'core' -print -exec rm -f {} \;
|
||||
|
||||
depend :
|
||||
touch Makefile.depend
|
||||
makedepend -fMakefile.depend $(INCDIR) -I/usr/include/CC $(BASE_SRCS) $(GUI_SRCS)
|
||||
/bin/rm -f Makefile.depend.bak
|
||||
|
||||
sinclude Makefile.depend
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef VEC2_INCLUDED // -*- C++ -*-
|
||||
#define VEC2_INCLUDED
|
||||
|
||||
#include <iostream>
|
||||
|
||||
class Vec2 {
|
||||
protected:
|
||||
real elt[2];
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <fstream.h>
|
||||
#include <string.h>
|
||||
|
@ -11,6 +12,7 @@ ImportMask *MASK;
|
|||
|
||||
|
||||
real error_threshold = 0.0;
|
||||
int min_points = -1;
|
||||
int point_limit = -1;
|
||||
real height_scale = 1.0;
|
||||
FileFormat output_format;
|
||||
|
@ -18,10 +20,11 @@ char *output_filename = NULL;
|
|||
char *mask_filename = NULL;
|
||||
char *script_filename = NULL;
|
||||
|
||||
static char *options = "e:p:h:o:m:s:";
|
||||
static char *options = "e:n:p:h:o:m:s:";
|
||||
|
||||
static char *usage_string =
|
||||
"-e <thresh> Sets the tolerable error threshold\n"
|
||||
"-n <count> Sets the *minimum* number of points regardless of <thresh>\n"
|
||||
"-p <count> Sets the maximum number of allowable points\n"
|
||||
"-h <factor> Sets the height scaling factor. For example,\n"
|
||||
" if grid points are 25m apart, use a factor of 0.04\n"
|
||||
|
@ -59,6 +62,11 @@ void process_cmdline(int argc, char **argv)
|
|||
cerr << " Setting error threshold to " <<error_threshold <<endl;
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
min_points = atoi(optarg);
|
||||
cerr << " Setting minumum points to " << min_points << endl;
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
point_limit = atoi(optarg);
|
||||
cerr << " Setting point limit to " << point_limit << endl;
|
||||
|
@ -159,6 +167,9 @@ void process_cmdline(int argc, char **argv)
|
|||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
if( min_points < 0 )
|
||||
min_points = 1;
|
||||
|
||||
if( point_limit < 0 )
|
||||
point_limit = DEM->width * DEM->height;
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef GLHACKS_INCLUDED // -*- C++ -*-
|
||||
#define GLHACKS_INCLUDED
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <GL/glx.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
|
|
|
@ -63,8 +63,11 @@ void subsample_insertion(int target_width)
|
|||
|
||||
inline int goal_not_met()
|
||||
{
|
||||
return mesh->maxError() > error_threshold &&
|
||||
mesh->pointCount() < point_limit;
|
||||
return
|
||||
( mesh->maxError() > error_threshold &&
|
||||
mesh->pointCount() < point_limit ) ||
|
||||
mesh->pointCount() < min_points;
|
||||
|
||||
}
|
||||
|
||||
static void announce_goal()
|
||||
|
|
|
@ -433,12 +433,15 @@ void gui_interact()
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if 0
|
||||
extern "C" {
|
||||
#include <GL/glutint.h>
|
||||
}
|
||||
#endif
|
||||
|
||||
void xglutKeepAspect(float width, float height)
|
||||
{
|
||||
#if 0
|
||||
Window win;
|
||||
XSizeHints hints;
|
||||
|
||||
|
@ -453,4 +456,5 @@ void xglutKeepAspect(float width, float height)
|
|||
|
||||
XSetWMNormalHints(__glutDisplay, win, &hints);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ extern Map *DEM;
|
|||
extern ImportMask *MASK;
|
||||
|
||||
extern real error_threshold;
|
||||
extern int min_points;
|
||||
extern int point_limit;
|
||||
extern real height_scale;
|
||||
enum FileFormat {NULLfile, TINfile, EPSfile, DEMfile, OBJfile, RMSfile};
|
||||
|
|
Loading…
Reference in a new issue