summaryrefslogtreecommitdiff
path: root/include/ksurf.h
blob: 73a337499ac76f716e17311174552230c9791688 (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
#ifndef _KSURF_H
#define _KSURF_H

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

#include <bigrational.h>
#include <bigrational_vector.h>
#include <kratpoly.h>
#include <kpoint2d.h>
#include <kbox3d.h>

using namespace std;

class K_SOLID;

class K_SURF
{
friend class PT_SURF_ASSOC;  
friend class K_PATCH;
friend class K_PARTITION;
friend class K_SOLID;
  
  K_RATPOLY* Impl;
  int        Impl_ok;
  
  K_RATPOLY* X;
  K_RATPOLY* Y;
  K_RATPOLY* Z;
  K_RATPOLY* W;
  int        mon_ok;
  
  unsigned long ref_count;
  
  //  stream
  
  ostream& output(ostream&) const;
  
public:
  
  //  constructors, assignment and destructor
  
  K_SURF();
  K_SURF(const K_RATPOLY&);
  K_SURF(K_RATPOLY* const,
         K_RATPOLY* const, K_RATPOLY* const, K_RATPOLY* const,
         K_RATPOLY* const);
  
  K_SURF(const K_SURF&);
  K_SURF& operator =(const K_SURF&);
  
  ~K_SURF();
  
  //  stream
  
  friend ostream& operator <<(ostream&, const K_SURF&);
  
  int Bezier_output(ostream&,
                    const bigrational&, const bigrational&,
                    const bigrational&, const bigrational&) const;
  
  //  other functions
  
  //  int param_to_coord(const bigrational& s, const bigrational& t,
  //                     bigrational& x, bigrational& y, bigrational& z) const
  //    compute (x, y, z) =
  //              (X(s, t) / W(s, t), Y(s, t) / W(s, t), Z(s, t) / W(s, t)).
  
  int param_to_coord(const bigrational&, const bigrational&,
                     bigrational&, bigrational&, bigrational&) const;
  
  //  int param_to_coord(const bigrational_vector& p,
  //                     bigrational_vector& c) const
  //    compute
  //      c = (X(p) / W(p), Y(p) / W(p), Z(p) / W(p)).
  
  int param_to_coord(const bigrational_vector&, bigrational_vector&) const;
  
  K_BOX3D get_range(const bigrational&, const bigrational&,
                    const bigrational&, const bigrational&) const;
  
  friend unsigned long get_all_int_pts(const K_RATPOLY&,
                                       const K_SURF&, const K_SURF&,
                                       K_POINT2D**&);
  
  friend int match_pts(K_POINT2D** const, const unsigned long, K_SURF* const,
                       K_POINT2D** const, const unsigned long, K_SURF* const);
  
  K_SURF split_surf(const bigrational&, const unsigned long) const;
  
//  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 int get_patch4(const bigrational_vector [4], K_PATCH*&);
  
  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 K_SOLID gen_ell(const bigrational_vector [4]);
  
  friend K_SOLID gen_tor(const bigrational_vector&,
                         const bigrational_vector&,
                         const bigrational_vector&,
                         const bigrational_vector&,
                         const bigrational&, const bigrational&);
};

unsigned long get_plane_coeffs(const bigrational_vector&,
                               const bigrational_vector&,
                               const bigrational_vector&,
                               bigrational*&);

#endif