Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ControlPoints.cc
Go to the documentation of this file.
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$
28//
29// ----------------------------------------------------------------------
30// GEANT 4 class source file
31//
32// G4ControlPoints.cc
33//
34// ----------------------------------------------------------------------
35
36#include "G4ControlPoints.hh"
37
38
40{
41 nr=nc=0;
42 data=(G4PointRat**)0;
43}
44
45
47{
48 nr=rows;
49 nc=columns;
50 data = (G4PointRat**) new G4PointRat *[nr*nc];
51
52 for(G4int a =0; a<nr*nc;a++)
53 data[a]=new G4PointRat;
54}
55
56
58{
59
60// point_type is maintained only for compatibility
61// G4ControlPoints is now a array of G4pointRat only
62
63 nr=rows;
64 nc=columns;
65 data = (G4PointRat**)new G4PointRat *[nr*nc];
66
67 for(G4int a = 0; a < nr*nc ; a++ )
68 data[a]=new G4PointRat;
69}
70
71
73{
74 // copy constructor
75
76 for( G4int i = 0; i < nr*nc; i++)
77 delete data[i];
78 delete[] data;
79
80 nr = old_points.nr;
81 nc = old_points.nc;
82 data = (G4PointRat**)new G4PointRat *[nr*nc];
83
84 G4int a, b;
85
86 for (a = 0; a < nr*nc ; a++ )
87 data[a] = new G4PointRat;
88
89 for ( a = 0; a < nr ; a++ )
90 for ( b = 0; b < nc ; b++ )
91 put( a, b, old_points.GetRat(a,b));
92}
93
94
96{
97 for( G4int a = 0; a < nr*nc; a++)
98 delete data[a];
99
100 delete[] data;
101}
102
103
105{
106 // assignment operator
107
108 if (&c == this) return *this;
109
110 for( G4int i = 0; i < nr*nc; i++)
111 delete data[i];
112 delete[] data;
113
114 nr = c.nr;
115 nc = c.nc;
116 data = (G4PointRat**)new G4PointRat *[nr*nc];
117
118 G4int a, b;
119
120 for (a = 0; a < nr*nc ; a++ )
121 data[a] = new G4PointRat;
122
123 for ( a = 0; a < nr ; a++ )
124 for ( b = 0; b < nc ; b++ )
125 put( a, b, c.GetRat(a,b));
126
127 return *this;
128}
129
130
132{
133 for ( G4int a = 0; a < nr*nc; a++ )
134 (data[a])->setW(weights[a]);
135}
136
137
139 G4PointRat& pts1, G4double k2,
140 G4PointRat& pts2 )
141{
142 pts2.setX(Calc(k1,param,pts1.x(),k2,pts2.x()));
143 pts2.setY(Calc(k1,param,pts1.y(),k2,pts2.y()));
144 pts2.setZ(Calc(k1,param,pts1.z(),k2,pts2.z()));
145 pts2.setW(Calc(k1,param,pts1.w(),k2,pts2.w()));
146}
147
148
150 G4double k2, G4Point3D& pts2)
151{
152 pts2.setX(Calc(k1,param,pts1.x(),k2,pts2.x()));
153 pts2.setY(Calc(k1,param,pts1.y(),k2,pts2.y()));
154 pts2.setZ(Calc(k1,param,pts1.z(),k2,pts2.z()));
155}
156
157
159{
160 // Square distance
161
162 G4double PointDist=1.e20;
163 G4double TmpDist;
164 G4Point3D Pt2;
165
166 for(G4int a=0;a<nr;a++)
167 for(G4int b=0;b<nc;b++)
168 {
169 Pt2 = Get3D(a,b);
170 TmpDist = Pt.distance2(Pt2);
171 PointDist = ( PointDist > TmpDist ) ? TmpDist : PointDist;
172 }
173
174 return PointDist;
175}
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
void SetWeights(G4double *)
G4Point3D Get3D(G4int i, G4int j) const
G4double ClosestDistanceToPoint(const G4Point3D &)
G4ControlPoints & operator=(const G4ControlPoints &)
G4PointRat & GetRat(G4int i, G4int j) const
void CalcValues(G4double k1, G4double param, G4Point3D &pts1, G4double k2, G4Point3D &pts2)
void put(G4int i, G4int j, const G4Point3D &tmp)
G4double x() const
G4double y() const
void setX(G4double Value)
void setY(G4double Value)
G4double w() const
G4double z() const
void setZ(G4double Value)
void setW(G4double Value)