[831] | 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: G4BezierSurface.hh,v 1.7 2006/06/29 18:38:20 gunter Exp $ |
---|
[1228] | 28 | // GEANT4 tag $Name: geant4-09-03 $ |
---|
[831] | 29 | // |
---|
| 30 | // ---------------------------------------------------------------------- |
---|
| 31 | // Class G4BezierSurface |
---|
| 32 | // |
---|
| 33 | // Class description: |
---|
| 34 | // |
---|
| 35 | // Definition of a generic Bezier surface. |
---|
| 36 | |
---|
| 37 | // Authors: J.Sulkimo, P.Urban. |
---|
| 38 | // Revisions by: L.Broglia, G.Cosmo. |
---|
| 39 | // ---------------------------------------------------------------------- |
---|
| 40 | #ifndef __BEZIERSURFACE_H |
---|
| 41 | #define __BEZIERSURFACE_H |
---|
| 42 | |
---|
| 43 | #include "G4Ray.hh" |
---|
| 44 | #include "G4ControlPoints.hh" |
---|
| 45 | #include "G4SurfaceList.hh" |
---|
| 46 | #include "G4PointRat.hh" |
---|
| 47 | #include "G4OsloMatrix.hh" |
---|
| 48 | #include "G4KnotVector.hh" |
---|
| 49 | |
---|
| 50 | class G4ProjectedSurface; |
---|
| 51 | |
---|
| 52 | class G4BezierSurface : public G4Surface |
---|
| 53 | { |
---|
| 54 | friend class G4BSplineSurface; |
---|
| 55 | friend class G4ProjectedSurface; |
---|
| 56 | |
---|
| 57 | public: // with description |
---|
| 58 | |
---|
| 59 | G4BezierSurface(); |
---|
| 60 | virtual ~G4BezierSurface(); |
---|
| 61 | // Constructor & destructor |
---|
| 62 | |
---|
| 63 | inline G4Point3D AveragePoint() const; |
---|
| 64 | inline void SetAveragePoint(G4Point3D p); |
---|
| 65 | |
---|
| 66 | inline G4double UAverage() const; |
---|
| 67 | inline G4double VAverage() const; |
---|
| 68 | |
---|
| 69 | inline void Dir(G4int d); |
---|
| 70 | inline void ChangeDir(); |
---|
| 71 | |
---|
| 72 | inline G4double SMin() const; |
---|
| 73 | inline G4double SMax() const; |
---|
| 74 | |
---|
| 75 | inline G4int GetOrder(G4int direction) const; |
---|
| 76 | inline void PutOrder(G4int direction, G4int value); |
---|
| 77 | |
---|
| 78 | inline G4double GetU() const; |
---|
| 79 | inline G4double GetV() const; |
---|
| 80 | |
---|
| 81 | void CalcBBox(); |
---|
| 82 | |
---|
| 83 | G4int BIntersect(G4SurfaceList&); |
---|
| 84 | |
---|
| 85 | G4int ClipBothDirs(); |
---|
| 86 | void ClipSurface(); |
---|
| 87 | |
---|
| 88 | virtual G4Vector3D SurfaceNormal(const G4Point3D& Pt) const; |
---|
| 89 | |
---|
| 90 | friend void CopySurface(G4BezierSurface& bez); |
---|
| 91 | |
---|
| 92 | protected: // without description |
---|
| 93 | |
---|
| 94 | G4SurfaceList* bezier_list; |
---|
| 95 | |
---|
| 96 | static G4int Clips; |
---|
| 97 | static G4int Splits; |
---|
| 98 | static G4double Tolerance; |
---|
| 99 | // Test variables |
---|
| 100 | |
---|
| 101 | private: |
---|
| 102 | |
---|
| 103 | void CalcAverage(); |
---|
| 104 | void CalcDistance(const G4Point3D&); |
---|
| 105 | void SetValues(); |
---|
| 106 | inline void LocalizeClipValues(); |
---|
| 107 | |
---|
| 108 | void SplitNURBSurface(); |
---|
| 109 | void GetClippedRegionFromSurface(); |
---|
| 110 | void RefineSurface(); |
---|
| 111 | void CalcOsloMatrix(); |
---|
| 112 | void MapSurface(G4Surface*); |
---|
| 113 | |
---|
| 114 | inline G4double Findzero(G4double x0, G4double x1, |
---|
| 115 | G4double y0, G4double y1) const; |
---|
| 116 | inline G4int Sign(G4double a) const; |
---|
| 117 | // For ClipSurface... |
---|
| 118 | |
---|
| 119 | inline G4int Amax(G4int i, G4int j) const; |
---|
| 120 | inline G4int Amin(G4int i, G4int j) const; |
---|
| 121 | inline G4int AhIndex(G4int j, G4int t, G4int iorder) const; |
---|
| 122 | // For calc_G4OsloMatrix... |
---|
| 123 | |
---|
| 124 | private: |
---|
| 125 | |
---|
| 126 | G4BezierSurface(const G4BezierSurface&); |
---|
| 127 | G4BezierSurface& operator=(const G4BezierSurface &); |
---|
| 128 | // Private copy constructor and assignment operator. |
---|
| 129 | |
---|
| 130 | private: |
---|
| 131 | |
---|
| 132 | G4int order[2]; |
---|
| 133 | G4double smin; |
---|
| 134 | G4double smax; |
---|
| 135 | G4Point3D line; |
---|
| 136 | G4double average_u; |
---|
| 137 | G4double average_v; |
---|
| 138 | G4Point3D average_pt; |
---|
| 139 | G4int dir; |
---|
| 140 | G4KnotVector *u_knots; |
---|
| 141 | G4KnotVector *v_knots; |
---|
| 142 | G4ControlPoints *ctl_points; |
---|
| 143 | |
---|
| 144 | G4KnotVector *new_knots; |
---|
| 145 | G4int ord; |
---|
| 146 | G4OsloMatrix * oslo_m; |
---|
| 147 | G4int lower,upper; |
---|
| 148 | G4double u[2]; |
---|
| 149 | G4double v[2]; |
---|
| 150 | G4double u_min; |
---|
| 151 | G4double u_max; |
---|
| 152 | G4double v_min; |
---|
| 153 | G4double v_max; |
---|
| 154 | G4ControlPoints* old_points; |
---|
| 155 | |
---|
| 156 | }; |
---|
| 157 | |
---|
| 158 | #include "G4BezierSurface.icc" |
---|
| 159 | |
---|
| 160 | #endif |
---|