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: G4Curve.icc,v 1.7 2006/06/29 18:38:58 gunter Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-02-ref-02 $ |
---|
29 | // |
---|
30 | // -------------------------------------------------------------------- |
---|
31 | // GEANT 4 inline definitions file |
---|
32 | // |
---|
33 | // G4Curve.icc |
---|
34 | // |
---|
35 | // Implementation of inline methods of G4Curve |
---|
36 | // -------------------------------------------------------------------- |
---|
37 | |
---|
38 | inline G4bool G4Curve::operator==(const G4Curve& right) const |
---|
39 | { |
---|
40 | return this == &right; |
---|
41 | } |
---|
42 | |
---|
43 | inline |
---|
44 | const G4BoundingBox3D* G4Curve::BBox() const |
---|
45 | { |
---|
46 | return &bBox; |
---|
47 | } |
---|
48 | |
---|
49 | // bounds related |
---|
50 | |
---|
51 | inline |
---|
52 | const G4Point3D& G4Curve::GetStart() const |
---|
53 | { |
---|
54 | return start; |
---|
55 | } |
---|
56 | |
---|
57 | inline |
---|
58 | const G4Point3D& G4Curve::GetEnd() const |
---|
59 | { |
---|
60 | return end; |
---|
61 | } |
---|
62 | |
---|
63 | inline |
---|
64 | G4double G4Curve::GetPStart() const |
---|
65 | { |
---|
66 | return pStart; |
---|
67 | } |
---|
68 | |
---|
69 | inline |
---|
70 | G4double G4Curve::GetPEnd() const |
---|
71 | { |
---|
72 | return pEnd; |
---|
73 | } |
---|
74 | |
---|
75 | inline |
---|
76 | void G4Curve::SetStart(const G4Point3D& pt) |
---|
77 | { |
---|
78 | start= pt; |
---|
79 | pStart= GetPPoint(pt); |
---|
80 | } |
---|
81 | |
---|
82 | inline |
---|
83 | void G4Curve::SetStart(G4double p) |
---|
84 | { |
---|
85 | pStart= p; |
---|
86 | start= GetPoint(p); |
---|
87 | } |
---|
88 | |
---|
89 | inline |
---|
90 | void G4Curve::SetEnd(const G4Point3D& pt) |
---|
91 | { |
---|
92 | end= pt; |
---|
93 | pEnd= GetPPoint(pt); |
---|
94 | } |
---|
95 | |
---|
96 | inline |
---|
97 | void G4Curve::SetEnd(G4double p) |
---|
98 | { |
---|
99 | pEnd= p; |
---|
100 | end= GetPoint(p); |
---|
101 | } |
---|
102 | |
---|
103 | inline |
---|
104 | void G4Curve::SetBoundsRest() |
---|
105 | { |
---|
106 | pRange= pEnd-pStart; |
---|
107 | G4double pMax= GetPMax(); |
---|
108 | if (pMax>0) |
---|
109 | { |
---|
110 | // Find the range in the first determination |
---|
111 | pRange-= (std::ceil(pRange/pMax)-1)*pMax; |
---|
112 | } |
---|
113 | |
---|
114 | bounded= true; |
---|
115 | InitBounded(); |
---|
116 | } |
---|
117 | |
---|
118 | inline |
---|
119 | void G4Curve::SetBounds(G4double p1, G4double p2) |
---|
120 | { |
---|
121 | SetStart(p1); |
---|
122 | SetEnd(p2); |
---|
123 | SetBoundsRest(); |
---|
124 | } |
---|
125 | |
---|
126 | inline |
---|
127 | void G4Curve::SetBounds(G4double p1, const G4Point3D& p2) |
---|
128 | { |
---|
129 | SetStart(p1); |
---|
130 | SetEnd(p2); |
---|
131 | SetBoundsRest(); |
---|
132 | } |
---|
133 | |
---|
134 | inline |
---|
135 | void G4Curve::SetBounds(const G4Point3D& p1, G4double p2) |
---|
136 | { |
---|
137 | SetStart(p1); |
---|
138 | SetEnd(p2); |
---|
139 | SetBoundsRest(); |
---|
140 | } |
---|
141 | |
---|
142 | inline |
---|
143 | void G4Curve::SetBounds(const G4Point3D& p1, const G4Point3D& p2) |
---|
144 | { |
---|
145 | SetStart(p1); |
---|
146 | SetEnd(p2); |
---|
147 | SetBoundsRest(); |
---|
148 | } |
---|
149 | |
---|
150 | inline |
---|
151 | G4bool G4Curve::IsPOn(G4double param) const |
---|
152 | { |
---|
153 | G4double diff= param-pStart; |
---|
154 | G4double pMax= GetPMax(); |
---|
155 | |
---|
156 | if (pMax>0) |
---|
157 | diff-= std::floor(diff/pMax)*pMax; |
---|
158 | |
---|
159 | return diff<=pRange; |
---|
160 | } |
---|
161 | |
---|
162 | inline |
---|
163 | G4bool G4Curve::IsBounded() const |
---|
164 | { |
---|
165 | return bounded; |
---|
166 | } |
---|
167 | |
---|
168 | inline |
---|
169 | void G4Curve::SetSameSense(G4int sameSense0) |
---|
170 | { |
---|
171 | sameSense= sameSense0; |
---|
172 | } |
---|
173 | |
---|
174 | inline |
---|
175 | G4int G4Curve::GetSameSense() const |
---|
176 | { |
---|
177 | return sameSense; |
---|
178 | } |
---|