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: kcurve.h
// update: 11/13/02
#ifndef _KCURVE_H
#define _KCURVE_H
#include <cassert>
#include <cstdlib>
#include <iostream>
#include "bigrational.h"
#include "kratpoly.h"
#include "kpoint2d.h"
#include "ksegment.h"
using namespace std;
class K_GRAPH;
class K_SOLID;
class K_SEGMENT;
class K_CURVE
{
friend class K_PATCH;
friend class K_PARTITION;
friend class K_SOLID;
K_RATPOLY* poly;
K_SEGMENT** segments;
unsigned long num_segments;
K_CURVE* curve_in_other_dom;
int dir_in_other_dom;
unsigned long ref_count;
// stream
ostream& output(ostream&) const;
// primitives
int assoc(K_CURVE* const, const int);
int reverse();
int subdivide(const unsigned long);
public:
// constructors, assignment and destructor
K_CURVE();
K_CURVE(const K_RATPOLY&, K_SEGMENT* const [], const unsigned long);
K_CURVE(K_RATPOLY* const, K_SEGMENT* const [], const unsigned long);
K_CURVE(const K_CURVE&, const unsigned long, const unsigned long);
K_CURVE(const K_CURVE&);
K_CURVE& operator =(const K_CURVE&);
~K_CURVE();
// stream
friend ostream& operator <<(ostream&, const K_CURVE&);
// primitives
K_POINT2D* start() const;
K_POINT2D* end() const;
K_BOXCO2 bbox() const;
int is_closed() const;
int rotate_closed_curve(const unsigned long);
// comparisons
int sort_pts(K_POINT2D** const, const unsigned long) const;
// other functions
unsigned long locate_pt_seg_start(K_POINT2D&);
unsigned long locate_pt_seg_end(K_POINT2D&);
int is_start_or_end(K_POINT2D&);
int contains(K_POINT2D&, const int = 1);
K_POINT2D pt_on();
int add_pt(K_POINT2D* const, const int = 0);
unsigned long find_intersections(const K_RATPOLY&, K_POINT2D**&, const int);
int add_on(const K_CURVE&);
int split(const unsigned long, K_CURVE&, K_CURVE&);
int mk_seg_fw(int* const, const int,
const long,
K_POINT2D** const, const unsigned long,
K_POINT2D** const, const unsigned long) const;
int mk_seg_bw(int* const, const int,
const long,
K_POINT2D** const, const unsigned long,
K_POINT2D** const, const unsigned long) const;
friend int pt_inside_trim_curves(K_POINT2D&,
K_CURVE** const, const unsigned long);
friend int pt_in_on_out_trim_curves(K_POINT2D&,
K_CURVE** const, const unsigned long);
// gen_curve_topo()
friend unsigned long gen_curve_topo(const K_RATPOLY&,
const bigrational&, const bigrational&,
const bigrational&, const bigrational&,
K_CURVE**&);
friend unsigned long gen_curve_topo_proto(const K_RATPOLY&,
const bigrational&,
const bigrational&,
const bigrational&,
const bigrational&,
K_POINT2D** const,
const unsigned long,
K_POINT2D** const,
const unsigned long,
K_POINT2D** const,
const unsigned long,
K_POINT2D** const,
const unsigned long,
K_POINT2D** const,
const unsigned long,
K_POINT2D** const,
const unsigned long,
K_CURVE**&);
// gen_box(), gen_cyl(), gen_ell(), gen_tor()
friend int get_patch4(const bigrational_vector [4], K_PATCH*&);
friend K_SOLID gen_box(const bigrational_vector [], const unsigned long);
friend int get_cyl_cap(const bigrational_vector&,
const bigrational_vector&, const bigrational_vector&,
const bool,
K_PATCH*&);
friend int get_cyl_side(K_RATPOLY* const,
K_RATPOLY* const, K_RATPOLY* const, K_RATPOLY* const,
K_RATPOLY* const,
K_PATCH*&);
friend K_SOLID gen_cyl(const bigrational_vector&, const bigrational_vector&,
const bigrational_vector&, const bigrational_vector&,
const bigrational_vector&, const bigrational_vector&);
friend unsigned long get_patches_ell(const bigrational_vector [4],
K_PATCH**&);
friend K_SOLID gen_ell(const bigrational_vector [4]);
friend int get_patch_tor(K_RATPOLY* const,
K_RATPOLY* const,
K_RATPOLY* const,
K_RATPOLY* const,
K_RATPOLY* const,
K_PATCH*&);
friend K_SOLID gen_tor(const bigrational_vector&,
const bigrational_vector&,
const bigrational_vector&,
const bigrational_vector&,
const bigrational&, const bigrational&);
friend unsigned long gen_partitions(K_PATCH* const, K_PARTITION**&);
friend unsigned long gen_adjacency(K_PARTITION** const, const unsigned long,
K_GRAPH*&,
long*&, K_GRAPH*&);
// friend K_SOLID gen_new_solid(K_PARTITION**, const unsigned long,
// K_PARTITION**, const unsigned long);
friend K_SOLID gen_new_solid(K_PARTITION**, const unsigned long,
K_PARTITION**, const unsigned long,
const char);
};
#endif
|