home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
vis-ftp.cs.umass.edu
/
vis-ftp.cs.umass.edu.tar
/
vis-ftp.cs.umass.edu
/
pub
/
Software
/
ASCENDER
/
ascendMar8.tar
/
UMass
/
BuildingFinder
/
Staging
/
I_fileIO.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-04-13
|
2KB
|
64 lines
#include "../header.h"
#include <fcntl.h>
#define round(x,y) ( (modf(x,&y) > 0.5) ? ceil(x) : floor(x) )
extern c_handle image_trans;
extern c_handle view_trans;
int
printIntersections(c_handle pane, Intersection *list, char *cornerFile)
/*
* 'fname' is the name of the file that contains the projection matrix
* relavent to the image in which the intersections will be labeled.
* this is needed for the "old" system in which each corner needed
* a label.
*
*/
{
Intersection *ptr;
int type;
double certainty;
double t;
double_2 *p1;
double_2 *temp;
int fd;
FILE *fp, *fopen();
if ( (fd = open(cornerFile,O_WRONLY | O_CREAT | O_TRUNC, 0777)) < 0) {
fprintf(stderr,"Error creating temporary file.\n");
return(-1);
}
if ( (fp = fdopen(fd,"w")) == NULL) {
fprintf(stderr,"Error opening output token file!\n");
return(-1);
}
ptr = list;
while (ptr != NULL) {
certainty = (ptr->leg1.contrast + ptr->leg2.contrast) / 2.0;
fprintf(fp,"%d %d %f %d %f %f %f %f\n",
(int)floor(ptr->p.d1),(int)floor(ptr->p.d2),
ptr->height,
(int)floor(certainty),
ptr->leg1Dx,ptr->leg1Dy,ptr->leg2Dx,ptr->leg2Dy);
temp = (double_2 *) transform_point(view_trans,ptr->p.d1,
ptr->p.d2,0);
p1 = (double_2 *) inverse_transform_point(image_trans,temp->d1,
temp->d2,0);
draw_fat_point(pane,p1->d1,p1->d2,3.0);
ptr = ptr->next;
}
fclose(fp);
close(fd);
}