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: CurveTest.cc,v 1.6 2006/06/29 18:43:01 gunter Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ |
---|
29 | ////////////////////////////////////////////////////////////////////////// |
---|
30 | // |
---|
31 | // |
---|
32 | // L. Broglia |
---|
33 | // October 26, 1998 |
---|
34 | // |
---|
35 | // Test the basic functionnality of the different curves : |
---|
36 | // - line |
---|
37 | // - circular curve |
---|
38 | // - ellipse |
---|
39 | // - parabola |
---|
40 | // - hyperbola |
---|
41 | // |
---|
42 | // Test the functionality of Axis2Placement3D and Project |
---|
43 | // |
---|
44 | // Use the function included in TestFunction.hh |
---|
45 | // |
---|
46 | |
---|
47 | |
---|
48 | #include "CurveTestFunction.hh" |
---|
49 | |
---|
50 | |
---|
51 | int main() |
---|
52 | { |
---|
53 | G4cout<<"\n\n//////////////////////////////////////////////////////////////"; |
---|
54 | G4cout<<"\n\n Test the basic functionality of G4Axis2Placement3D"; |
---|
55 | G4cout<<"\n\n"; |
---|
56 | |
---|
57 | G4Axis2Placement3D p; |
---|
58 | p.Init( G4Vector3D(-1, 0, 0), |
---|
59 | G4Vector3D( 1, 2, 3), |
---|
60 | G4Point3D ( 1, 1, 1) ); |
---|
61 | TestPlacement(&p); |
---|
62 | |
---|
63 | G4Axis2Placement3D p2; |
---|
64 | p2.Init( G4Vector3D( 1, 0, 0), |
---|
65 | G4Vector3D(-1, 2, 3), |
---|
66 | G4Point3D (-1, 1, 1) ); |
---|
67 | TestPlacement(&p2); |
---|
68 | |
---|
69 | |
---|
70 | |
---|
71 | G4cout<<"\n\n//////////////////////////////////////////////////////////////"; |
---|
72 | G4cout<<"\n\n Test the basic functionality of G4Line"; |
---|
73 | G4cout<<"\n\n"; |
---|
74 | |
---|
75 | G4Line l; |
---|
76 | l.Init(G4Point3D(2, 3, 4), G4Vector3D(-1, -1, -1)); |
---|
77 | |
---|
78 | l.SetBounds(-10, +10); |
---|
79 | G4cout << "G4Line " << l.GetPnt() << " " << l.GetDir() << G4endl; |
---|
80 | TestCurve(&l); |
---|
81 | |
---|
82 | |
---|
83 | |
---|
84 | G4cout<<"\n\n//////////////////////////////////////////////////////////////"; |
---|
85 | G4cout<<"\n\n Test the basic functionality of G4CircularCurve"; |
---|
86 | G4cout<<"\n\n"; |
---|
87 | |
---|
88 | G4CircularCurve c; |
---|
89 | c.Init(p, 5); |
---|
90 | |
---|
91 | c.SetBounds(0, 0); |
---|
92 | G4cout << "G4CircularCurve with radius=" << c.GetRadius() << G4endl; |
---|
93 | TestCurve(&c); |
---|
94 | |
---|
95 | c.SetBounds(pi/4, 3*pi/4); |
---|
96 | G4cout << "G4CircularCurve again" << G4endl; |
---|
97 | TestCurve(&c); |
---|
98 | |
---|
99 | |
---|
100 | |
---|
101 | G4cout<<"\n\n//////////////////////////////////////////////////////////////"; |
---|
102 | G4cout<<"\n\n Test the basic functionality of G4Ellipse"; |
---|
103 | G4cout<<"\n\n"; |
---|
104 | |
---|
105 | G4Ellipse e; |
---|
106 | e.Init(p, 2, 10); |
---|
107 | |
---|
108 | e.SetBounds(0, 0); |
---|
109 | G4cout << "G4Ellipse " << e.GetSemiAxis1() |
---|
110 | << " " << e.GetSemiAxis2() << G4endl; |
---|
111 | TestCurve(&e); |
---|
112 | |
---|
113 | e.SetBounds(100, 100+8*pi); |
---|
114 | G4cout << "G4Ellipse again" << G4endl; |
---|
115 | TestCurve(&e); |
---|
116 | |
---|
117 | e.SetBounds(3.21, 4.1); |
---|
118 | G4cout << "G4Ellipse again" << G4endl; |
---|
119 | TestCurve(&e); |
---|
120 | |
---|
121 | |
---|
122 | |
---|
123 | G4cout<<"\n\n//////////////////////////////////////////////////////////////"; |
---|
124 | G4cout<<"\n\n Test the basic functionality of G4Parabola"; |
---|
125 | G4cout<<"\n\n"; |
---|
126 | |
---|
127 | G4Parabola par; |
---|
128 | par.Init(p, 6); |
---|
129 | |
---|
130 | par.SetBounds(-100, 100); |
---|
131 | G4cout << "G4Parabola " << par.GetFocalDist() << G4endl; |
---|
132 | TestCurve(&par); |
---|
133 | |
---|
134 | par.SetBounds(-1, 10); |
---|
135 | G4cout << "G4Parabola again" << G4endl; |
---|
136 | TestCurve(&par); |
---|
137 | |
---|
138 | par.SetBounds(-6.2, -5.1); |
---|
139 | G4cout << "G4Parabola again" << G4endl; |
---|
140 | TestCurve(&par); |
---|
141 | |
---|
142 | |
---|
143 | |
---|
144 | G4cout<<"\n\n//////////////////////////////////////////////////////////////"; |
---|
145 | G4cout<<"\n\n Test the basic functionality of G4Hyperbola"; |
---|
146 | G4cout<<"\n\n"; |
---|
147 | |
---|
148 | G4Hyperbola h; |
---|
149 | h.Init(p, 5, 3); |
---|
150 | |
---|
151 | h.SetBounds(-2, 2); |
---|
152 | G4cout << "G4Hyperbola " << h.GetSemiAxis() |
---|
153 | << " " << h.GetSemiImagAxis() << G4endl; |
---|
154 | TestCurve(&h); |
---|
155 | |
---|
156 | h.SetBounds(1, 2); |
---|
157 | G4cout << "G4Hyperbola again" << G4endl; |
---|
158 | TestCurve(&h); |
---|
159 | |
---|
160 | h.SetBounds(-1, 0); |
---|
161 | G4cout << "G4Hyperbola again" << G4endl; |
---|
162 | TestCurve(&h); |
---|
163 | |
---|
164 | |
---|
165 | |
---|
166 | G4cout<<"\n\n//////////////////////////////////////////////////////////////"; |
---|
167 | G4cout<<"\n\n Test the basic functionality of Projection"; |
---|
168 | G4cout<<"\n\n"; |
---|
169 | |
---|
170 | TestProject( &e, G4Rotate3D( pi/2, G4Vector3D(1, 1, 1) ) ); |
---|
171 | |
---|
172 | |
---|
173 | |
---|
174 | return EXIT_SUCCESS; |
---|
175 | } |
---|