summaryrefslogtreecommitdiff
path: root/esolid/wrapper/include/kpatch.h
blob: f7ba2db1bff56985ed4ee92738910567ddcbd017 (plain)
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
//  file:    kpatch.h
//  update:  11/18/02

#ifndef _KPATCH_H
#define _KPATCH_H

#include <cassert>
#include <cstdlib>
#include <iostream>

#include "bigrational.h"
#include "bigrational_vector.h"
#include "kratpoly.h"
#include "kcurve.h"
#include "ksurf.h"
#include "kpartition.h"

using namespace std;

class K_GRAPH;

class K_PATCH
{
friend class K_PARTITION;
friend class K_SOLID;
  
  unsigned long ID;
  
  K_SURF*     surf;     //  surface
  bool        is_head;  //  true if *this is the head of surf
  bigrational low_s;    //  lower bound for *this in s
  bigrational high_s;   //  upper bound for *this in s
  bigrational low_t;    //  lower bound for *this in t
  bigrational high_t;   //  upper bound for *this in t
  
  //  trimming curves
  
  unsigned long num_trim_curves;
  K_CURVE**     trim_curves;
  K_SURF**      adj_surfs;
  K_PATCH**     adj_patches;
  
  //  intersection curves
  
  unsigned long num_int_curves;
  K_CURVE**     int_curves;
  K_SURF**      adj_int_surfs;
  K_PATCH**     adj_int_patches;
  
  unsigned long  num_merged;
  K_CURVE***     ic;
  unsigned long* len_ic;
  int*           ic_closed;
  
  unsigned long ref_count;
  
  //  stream
  
  ostream& output(ostream&) const;
  
  //  primitives
  
  int set_range();
  
public:
  
  //  constructors, assignment and destructor
  
  K_PATCH();
//  K_PATCH(K_SURF* const, K_CURVE* const [], const unsigned long);
  K_PATCH(K_SURF* const, K_CURVE* const [], const unsigned long,
          const bool = true);
  K_PATCH(const K_PARTITION&);
  
  K_PATCH(const K_PATCH&);
  K_PATCH& operator =(const K_PATCH&);
  
  ~K_PATCH();
  
  //  stream
  
  friend ostream& operator <<(ostream&, const K_PATCH&);
  
  int Bezier_output(ostream&,
                    const unsigned int,
                    const unsigned int,
                    const unsigned int) const;
  
  //  primitives
  
  bigrational get_low_s() const;
  bigrational get_low_t() const;
  bigrational get_high_s() const;
  bigrational get_high_t() const;
  
  //  comparisons
  
  int in_dom(K_POINT2D&);
  int contains(K_POINT2D&);
  int in_on_out(K_POINT2D&);
  
  //  other functions
  
  int           intersect(K_PATCH&);
  int           split_trim_curves(const unsigned long, const unsigned long);
  unsigned long merge_curves();
  unsigned long split_loops(K_PATCH**&);
  
  K_POINT2D get_pt_in() const;
  
  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);
  
  friend K_SOLID gen_box(const bigrational_vector [], const unsigned long);
  
  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&);
};

#endif