-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNum.h
183 lines (141 loc) · 3.65 KB
/
Num.h
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
/** @file num.h
*
* @author marco corvi
* @date 1993 - revised 2010
*
* @brief survey data processing
*
* --------------------------------------------------------
* Copyright This sowftare is distributed under GPL-3.0 or later
* See the file COPYING.
*/
#ifndef NUM_H
#define NUM_H
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
// #define scala 50 /* 1:500 */
/* #define scala 20 // 1:200 */
struct NumBranch;
struct NumMeasure;
struct NumStats
{
int n_shots;
int n_stations;
int n_loops;
double z_max, z_min;
double n_max, n_min;
double e_max, e_min;
double delta_z() const { return z_max - z_min; }
double delta_north() const { return n_max - n_min; }
double delta_east() const { return e_max - e_min; }
NumStats()
: n_shots( 0 )
, n_stations( 0 )
, n_loops( 0 )
, z_max( -10000 )
, z_min( 10000 )
, n_max( 1000000 )
, n_min( -1000000 )
, e_max( 1000000 )
, e_min( -1000000 )
{ }
void Reset()
{
n_shots = 0;
n_stations = 0;
n_loops = 0;
z_max = -10000;
z_min = 10000;
n_max = -1000000;
n_min = 1000000;
e_max = -1000000;
e_min = 1000000;
}
};
/** station point in 3D
*/
struct NumPoint {
const char * tag; //!< station name
int nms; //!< number of shots
int set;
NumBranch * br; //!< branch
NumMeasure * ms[2];
double N, E, V; // , H, X, Y; //!< 3D coords
NumPoint * next; //!< next point in the list
};
/** shot
*/
struct NumMeasure {
const char * tag1; //!< name of "from" station
const char * tag2; //!< name of "to" station
NumPoint * pt1;
NumPoint * pt2;
double dist, incl, nord;
int horz;
NumMeasure *next, *prev;
// NumMeasure *nest, *prew;
int used;
};
struct NumLoop {
double x;
int nms;
int dir; //!< direction
NumBranch * br;
NumMeasure * ms;
NumPoint * pt;
NumLoop * next, * prev;
};
struct NumBranch {
NumPoint * pt;
int nms;
NumMeasure ** ms;
NumBranch * next;
};
struct NumHomotopy {
NumLoop * lp;
NumHomotopy * next;
};
class Num
{
private:
NumPoint *pt00;
NumMeasure *ms00;
NumMeasure *ms20;
NumBranch *br00;
// NumLoop *lp00;
NumHomotopy *hm00;
int measure_number;
NumStats stats;
public:
Num();
~Num();
const NumStats & getStats() const { return stats; }
int makePoints(int i_lp, const char * fix_point = NULL ); /* Crea la lista dei punti: */
/* ritorna il n. dei punti */
void addMeasure(const char * from, const char * to,
double dist, double nord, double incl );
void setPoints();
void printPoints();
void clearLists();
const NumPoint * getPoint( const char * name ) const;
private:
NumPoint * secondPoint( NumMeasure * ms, NumPoint * pt );
NumMeasure * secondMeasure( NumPoint * pt, NumMeasure * ms );
int adjustHomotopy( NumHomotopy * hm );
void makeHomotopy();
NumMeasure * nextMeasure( NumLoop * lp, NumMeasure * ms );
NumMeasure * loopMeasure( NumLoop * lp );
NumLoop * isInLoop( NumPoint * pt, NumLoop * lp );
void branchNrMeasures( NumLoop * lp );
void makeLoop( NumPoint * pt2, NumPoint * pt1, NumMeasure * ms1);
void makeBranch( NumPoint * pt, NumMeasure * ms );
NumPoint * makePoint(NumPoint * ptlast, NumPoint * pt1, NumMeasure *ms1, int sign);
void setPoint(NumPoint * pt3, NumPoint * pt1, NumMeasure * ms1, int sign);
// void rescalePoints();
void printPoint( NumPoint * pt );
NumPoint * checkPoint( const char * tag );
void resetMeasures();
void resetPoints();
};
#endif