-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrapezoidalmap.h
More file actions
67 lines (61 loc) · 1.38 KB
/
trapezoidalmap.h
File metadata and controls
67 lines (61 loc) · 1.38 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//
// trapezoidalmap.h
// tmp
//
// Created by CynsierWang on 2020/4/14.
// Copyright © 2020年 CynsierWang. All rights reserved.
//
#ifndef trapezoidalmap_h
#define trapezoidalmap_h
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <utility>
using namespace std;
typedef struct point{
float x;
float y;
point(float x1, float y1){x=x1;y=y1;}
point(){x=0;y=0;}
}Point,*PointPtr;
typedef struct line{
PointPtr pointl;
PointPtr pointr;
line(PointPtr l,PointPtr r){pointl = l;pointr = r;}
line(){pointl = NULL;pointr = NULL;}
}Line, *LinePtr;
struct node;
typedef struct leaf{
PointPtr pointl;
PointPtr pointr;
LinePtr up;
LinePtr bottom;
leaf * rightUp;
leaf * rightDown;
node * parent;
leaf(PointPtr l,PointPtr r,LinePtr u,LinePtr b){
pointl = l;
pointr = r;
up = u;
bottom = b;
rightUp = NULL;
rightDown = NULL;
parent = NULL;
}
leaf(){};
}Area, *AreaPtr;
typedef struct node{
int classid;//0 point, 1 line, 2 area leaf
PointPtr p;
LinePtr l;
AreaPtr s;
node * leftchild;
node * rightchild;
}Node,*NodeList;
void initTrape(int n, float * arr);
bool isAbove(LinePtr l, float x, float y);
NodeList LookArea(float x,float y);
void insertLine(int lineid);
void passleaves(NodeList r);
void printTrape();
#endif /* trapezoidalmap_h */