-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathutility.cpp
More file actions
35 lines (30 loc) · 817 Bytes
/
Copy pathutility.cpp
File metadata and controls
35 lines (30 loc) · 817 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include<iostream>
#include<assert.h>
void readMBR(char *file, const int size,const float r,
float* &xmin, float* &ymin,float* &xmax, float* &ymax, int* &id)
{
FILE *fp = fopen(file, "r");
if (NULL == fp)
{
printf("open %s failed\n", file);
exit(1);
}
xmin = new float[size];
ymin = new float[size];
xmax = new float[size];
ymax = new float[size];
id = new int[size];
int pid,nume;
float x1,y1,x2,y2;
for (int i = 0; i < size; i++)
{
int ret = fscanf(fp, "%f,%f,%f,%f,%d,%d,%d\n",
&x1, &y1,&x2,&y2, &id[i],&pid,&nume);
xmin[i]=std::min(x1,x2)-r;
ymin[i]=std::min(y1,y2)-r;
xmax[i]=std::max(x1,x2)+r;
ymax[i]=std::max(y1,y2)+r;
assert(ret==7);
}
fclose(fp);
}