1 | // |
---|
2 | // ******************************************************************** |
---|
3 | // * License and Disclaimer * |
---|
4 | // * * |
---|
5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
7 | // * conditions of the Geant4 Software License, included in the file * |
---|
8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
9 | // * include a list of copyright holders. * |
---|
10 | // * * |
---|
11 | // * Neither the authors of this software system, nor their employing * |
---|
12 | // * institutes,nor the agencies providing financial support for this * |
---|
13 | // * work make any representation or warranty, express or implied, * |
---|
14 | // * regarding this software system or assume any liability for its * |
---|
15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
16 | // * for the full disclaimer and the limitation of liability. * |
---|
17 | // * * |
---|
18 | // * This code implementation is the result of the scientific and * |
---|
19 | // * technical work of the GEANT4 collaboration. * |
---|
20 | // * By using, copying, modifying or distributing the software (or * |
---|
21 | // * any work based on the software) you agree to acknowledge its * |
---|
22 | // * use in resulting scientific publications, and indicate your * |
---|
23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
24 | // ******************************************************************** |
---|
25 | // |
---|
26 | // |
---|
27 | // $Id: G4ProjectedSurface.hh,v 1.7 2006/06/29 18:40:17 gunter Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-03 $ |
---|
29 | // |
---|
30 | // ---------------------------------------------------------------------- |
---|
31 | // Class G4ProjectedSurface |
---|
32 | // |
---|
33 | // Class description: |
---|
34 | // |
---|
35 | // Definition of a projected surface. |
---|
36 | |
---|
37 | // Authors: J.Sulkimo, P.Urban. |
---|
38 | // Revisions by: L.Broglia, G.Cosmo. |
---|
39 | // ---------------------------------------------------------------------- |
---|
40 | #ifndef __G4ProjectedSurface_h |
---|
41 | #define __G4ProjectedSurface_h 1 |
---|
42 | |
---|
43 | #include "G4BezierSurface.hh" |
---|
44 | |
---|
45 | class G4ProjectedSurface : public G4Surface |
---|
46 | { |
---|
47 | friend class G4BSplineSurface; |
---|
48 | |
---|
49 | friend void CopySurface(G4ProjectedSurface& proj); |
---|
50 | |
---|
51 | public: // with description |
---|
52 | |
---|
53 | G4ProjectedSurface(); |
---|
54 | virtual ~G4ProjectedSurface(); |
---|
55 | // Default constructor and destructor. |
---|
56 | |
---|
57 | void CalcBBox(); |
---|
58 | // Finds the bounds of the 2D-projected nurb, it |
---|
59 | // calculates the bounds for a bounding rectangle |
---|
60 | // to the surface. The bounding rectangle is used |
---|
61 | // for a preliminary check of intersection. |
---|
62 | |
---|
63 | public: // without description |
---|
64 | |
---|
65 | inline G4Vector3D SurfaceNormal(const G4Point3D& Pt) const; |
---|
66 | // Returns normal to surface (G4Vector3D(0,0,0)). |
---|
67 | |
---|
68 | protected: |
---|
69 | |
---|
70 | static G4int Splits; |
---|
71 | G4ControlPoints *ctl_points; |
---|
72 | // Test variables |
---|
73 | |
---|
74 | private: |
---|
75 | |
---|
76 | G4ProjectedSurface(const G4ProjectedSurface&); |
---|
77 | G4ProjectedSurface& operator=(const G4ProjectedSurface&); |
---|
78 | // Private copy constructor and assignment operator. |
---|
79 | |
---|
80 | void CopySurface(); |
---|
81 | // Copies the projected surface into a bezier surface |
---|
82 | // and adds it to the List of bezier surfaces. |
---|
83 | |
---|
84 | void ConvertToBezier (G4SurfaceList& p, G4SurfaceList& b); |
---|
85 | // Converts surface into a Bezier surface to b. |
---|
86 | |
---|
87 | inline G4int GetOrder(G4int direction) const; |
---|
88 | inline void PutOrder(G4int direction, G4int value); |
---|
89 | |
---|
90 | void SplitNURBSurface(); |
---|
91 | // Divides the surface in two parts. Uses the oslo-algorithm to calculate |
---|
92 | // the new knot-vectors and control-points for the subsurfaces. |
---|
93 | |
---|
94 | G4int CheckBezier(); |
---|
95 | // Checks if the surface is a Bezier surface by verifying |
---|
96 | // if internal knots exist. If no internal knots exist the quantity |
---|
97 | // of knots is 2*order of the surface. Returns 1 if the surface |
---|
98 | // is a Bezier. |
---|
99 | |
---|
100 | void CalcOsloMatrix(); |
---|
101 | // Calculates the oslo-matrix, which is used in mapping the new |
---|
102 | // knot-vector and the control-point values. |
---|
103 | // This algorithm is described in the paper "Making the Oslo-algorithm |
---|
104 | // more efficient" in SIAM J.NUMER.ANAL. Vol.23, No. 3, June '86. |
---|
105 | |
---|
106 | void MapSurface(G4ProjectedSurface* srf); |
---|
107 | // Maps the new control-points into the new surface. |
---|
108 | // This algorithm is described in the paper "Making the Oslo-algorithm |
---|
109 | // more efficient" in SIAM J.NUMER.ANAL. Vol.23, No. 3, June '86. |
---|
110 | |
---|
111 | inline G4int Amax(G4int i, G4int j) const; |
---|
112 | inline G4int Amin(G4int i, G4int j) const; |
---|
113 | inline G4int AhIndex(G4int j, G4int t, G4int iorder) const; |
---|
114 | |
---|
115 | private: |
---|
116 | |
---|
117 | short dir; |
---|
118 | G4KnotVector *u_knots; |
---|
119 | G4KnotVector *v_knots; |
---|
120 | |
---|
121 | G4SurfaceList* projected_list; |
---|
122 | G4SurfaceList* bezier_list; |
---|
123 | |
---|
124 | G4int order[2]; |
---|
125 | G4KnotVector *new_knots; |
---|
126 | G4int ord; |
---|
127 | G4int lower,upper; |
---|
128 | |
---|
129 | G4OsloMatrix* oslo_m; |
---|
130 | G4Point3D vmin; |
---|
131 | G4Point3D vmax; |
---|
132 | }; |
---|
133 | |
---|
134 | #include "G4ProjectedSurface.icc" |
---|
135 | |
---|
136 | #endif |
---|