source: trunk/source/geometry/solids/BREPS/include/G4Curve.hh

Last change on this file was 1337, checked in by garnier, 14 years ago

tag geant4.9.4 beta 1 + modifs locales

File size: 6.3 KB
Line 
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.hh,v 1.11 2007/05/11 13:49:31 gcosmo Exp $
28// GEANT4 tag $Name: geant4-09-04-beta-01 $
29//
30// ----------------------------------------------------------------------
31// Class G4Curve
32//
33// Class Description:
34//
35// Definition of a generic curve.
36// To Initialize objects derived from G4Curve:
37//   - Construct curve (the constructor takes no parameters)
38//   - call Init()
39//   - if the curve is bounded, call one of the SetBounds() methods.
40
41// Author: J.Sulkimo, P.Urban.
42// Revisions by: L.Broglia, G.Cosmo.
43// ----------------------------------------------------------------------
44#ifndef __CURVE_H
45#define __CURVE_H
46
47#include "geomdefs.hh"
48#include "G4Point3D.hh"
49#include "G4Vector3D.hh"
50#include "G4BoundingBox3D.hh"
51#include "G4Transform3D.hh"
52#include "G4Ray.hh"
53
54class G4Ray;
55class G4CurveRayIntersection;
56class G4CurvePoint;
57class G4Surface;
58
59class G4Curve
60{
61
62 public:  // with description
63
64  G4Curve();
65  virtual ~G4Curve();
66    // Constructor & destructor.
67
68  G4Curve(const G4Curve& c);
69  G4Curve& operator=(const G4Curve& c);
70    // Copy contructor and assignment operator.
71
72  inline G4bool operator==(const G4Curve& right) const;
73    // Equality operator.
74
75  virtual G4String GetEntityType() const;
76    // Returns shape identifier.
77
78  virtual G4Curve* Project(const G4Transform3D& tr =
79                           HepGeom::Transform3D::Identity)= 0;
80    // Projection onto the xy plane after the transformation tr.
81    // The returned object is allocated dynamically; it's caller's
82    // responsibility to delete it.
83    // In case the projection maps two distinct points into one, 0 is returned.
84    // NOTE: this should not occur when using projection with
85    //       G4SurfaceOfRevolution.
86
87  virtual G4bool Tangent(G4CurvePoint& cp, G4Vector3D& v)= 0;
88    // Returns tangent vector v to a curve at the point cp.
89    // Returns true if v exists.
90
91  virtual G4int IntersectRay2D(const G4Ray& ray)= 0;
92    // Intersects a 2D curve with a ray.
93    // The ray is projected onto the xy plane.
94    // If no intersection it returns false, otherwise it returns true,
95    // the intersection point is ray.start+ray.dir*intersection0.
96
97  inline const G4Point3D& GetStart() const;
98  inline const G4Point3D& GetEnd() const;
99    // Return start and endpoints in 3D space.
100
101  inline G4double GetPStart() const;
102  inline G4double GetPEnd() const;
103    // Return start and endpoints in parameter space.
104
105  inline void SetBounds(G4double p1, G4double p2);
106  inline void SetBounds(G4double p1, const G4Point3D& p2);
107  inline void SetBounds(const G4Point3D& p1, G4double p2);
108  inline void SetBounds(const G4Point3D& p1, const G4Point3D& p2);
109    // Set start and endpoints, given points as parameter values
110    // or 3D points.
111
112  inline G4bool IsBounded() const;
113    // Returns if the curve is bounded.
114
115  inline G4bool IsPOn(G4double param) const;
116    // Returns if the parameter is on the curve.
117
118  inline void   SetSameSense(G4int sameSense0);
119  inline G4int  GetSameSense() const;
120    // The sameSense flag can be used to reverse the orientation
121    // of the curve (value false).
122    // The curves themselves never use the value of this flag;
123    // this is just a convenient mean of storing this piece of
124    // topological information.
125
126  virtual G4double GetPMax() const = 0;
127    // If the parameter space is closed, return the max value
128    // if not, return <=0.
129
130  virtual G4Point3D GetPoint(G4double param) const = 0;
131    // Return the point in the 3D space, given correspondent parameter.
132
133  virtual G4double GetPPoint(const G4Point3D& p) const = 0;
134    // Return parapmeter give a point in space.
135    // In case the point is further off the curve than some tolerance
136    // the result is undefined.
137
138  const G4BoundingBox3D* BBox() const;
139    // Gets the bounding box for the curve
140    // If the curve is not bounded, the result is undefined.
141
142  virtual const char* Name() const;
143    // Returns type name.
144
145 public:  // without description
146
147  // virtual void Transform(const G4Transform3D& tr);
148     // Transformation of the curve.
149  // virtual void IntersectRay2D(const G4Ray&, G4CurveRayIntersection&)= 0;
150
151  virtual void SetParentSrfPtr(const G4Surface*);
152    // To be moved to a derived class. Is it really needed?
153
154 protected:
155
156  virtual void InitBounded()= 0;
157    // This function will be called after the bounds are set.
158
159 protected:
160
161  G4BoundingBox3D bBox;
162  G4Point3D start;
163  G4Point3D end;
164  G4double  pStart;
165  G4double  pEnd;
166  G4double  pRange;
167  G4bool    bounded;
168  G4int     sameSense;
169  G4double  kCarTolerance;
170
171 private:
172 
173  inline void SetStart(const G4Point3D& pt);
174  inline void SetStart(G4double p);
175  inline void SetEnd(const G4Point3D& p);
176  inline void SetEnd(G4double p);
177  inline void SetBoundsRest();
178
179};
180
181#include "G4Curve.icc"
182
183#endif
Note: See TracBrowser for help on using the repository browser.