summaryrefslogtreecommitdiff
path: root/esolid/wrapper/include/ksegment.h
blob: 92d1f9fbe9d6ab5c87e1593918572b8c1f9eebab (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
//  file:    ksegment.h
//  update:  11/13/02

#ifndef _KSEGMENT_H
#define _KSEGMENT_H

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

#include "bigrational.h"
#include "kratpoly.h"
#include "kpoint2d.h"
#include "kboxco2.h"
#include "kpatch.h"

using namespace std;

class K_POINT2D;
class K_BOXCO2;

class K_SEGMENT
{
friend class K_CURVE;
friend class K_PATCH;
  
  K_POINT2D* start;
  K_POINT2D* end;
  
  unsigned long ref_count;
  
  //  stream
  
  ostream& output(ostream&) const;
  
//public:
  
  //  constructors, assignment and destructor
  
  //  K_SEGMENT()
  //    constructs a null segment.
  
  K_SEGMENT();
  
  //  K_SEGMENT(const K_POINT2D& x, const K_POINT2D& y)
  //    constructs a segment (x, y].
  
  K_SEGMENT(const K_POINT2D&, const K_POINT2D&);
  
  //  K_SEGMENT(K_POINT2D* const x, K_POINT2D* const y)
  //    constructs a segment (x, y].
  
  K_SEGMENT(K_POINT2D* const, K_POINT2D* const);
  
  K_SEGMENT(const K_SEGMENT&);
  K_SEGMENT& operator =(const K_SEGMENT&);
  
  ~K_SEGMENT();
  
  //  stream
  
  friend ostream& operator <<(ostream&, const K_SEGMENT&);
  
  //  primitives
  
  K_SEGMENT reverse() const;
  
  //  other functions
  
  //  K_BOXCO2 outer_box() const
  //    returns the outer box for *this.
  
  K_BOXCO2  outer_box() const;
  
  //  K_BOXCO2* inner_box() const
  //    returns a pointer to the inner box for *this.
  //    returns 0 if the inner box for *this is not well-def'ed.
  
  K_BOXCO2* inner_box() const;
  
  //  int contains(K_POINT2D& x)
  //    returns 1 if x lies inside the inner box of *this,
  //            0 if x lies outside the outer box of *this.
  //    POSSIBLY DOES NOT TERMINATE!
  //  CAUTION!!!  The start point is OUT of the segment whereas
  //              the end point is IN the segment.
  
  int contains(K_POINT2D& x);
  
  //  gen_curve_topo()
  
  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 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 unsigned long get_patches_ell(const bigrational_vector [4],
                                       K_PATCH**&);
  
  friend int get_patch_tor(K_RATPOLY* const,
                           K_RATPOLY* const,
                           K_RATPOLY* const,
                           K_RATPOLY* const,
                           K_RATPOLY* const,
                           K_PATCH*&);
};

#endif