Import Geant4 3.0.0 source tree
This commit is contained in:
@@ -5,143 +5,151 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4FPlane.hh,v 1.7 2000/02/16 12:02:52 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-02-00 $
|
||||
// $Id: G4FPlane.hh,v 1.10 2000/11/08 14:22:02 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
//
|
||||
// L. Broglia
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
// Class G4FPlane
|
||||
//
|
||||
// Class Description:
|
||||
//
|
||||
// A G4FPlane is a plane created by 3 points or by an origin, an axis and
|
||||
// a direction. The plane created is a G4Plane, where his coefficient a, b,
|
||||
// c and d are stored. Be carreful that the equation of the plane is :
|
||||
// c and d are stored. The equation of the plane is:
|
||||
// ax + by + cz = d
|
||||
//
|
||||
// This class contain 2 intersection functions :
|
||||
// - closest intersection
|
||||
// - intersection by a ray
|
||||
|
||||
// Authors: J.Sulkimo, P.Urban.
|
||||
// Revisions by: L.Broglia, S.Giani, G.Cosmo.
|
||||
// ----------------------------------------------------------------------
|
||||
//
|
||||
// Corrections by S.Giani:
|
||||
//
|
||||
// History
|
||||
// -------
|
||||
// - SurfaceNormal always returns the direction of NormalX, always containing
|
||||
// the correct orientation for all faces.
|
||||
// - Addition of default argument sense = 1 in the second constructor.
|
||||
|
||||
|
||||
// the correct orientation for all faces (S.Giani).
|
||||
// - Addition of default argument sense = 1 in the second constructor (S.Giani).
|
||||
// - The constructor using iVec now properly stores both the internal and
|
||||
// external boundaries in the bounds vector (S.Giani).
|
||||
// - Proper initialization of sameSense in both the constructors (S.Giani).
|
||||
// - Addition of third argument (sense) in the second constructor to ensure
|
||||
// consistent setting of the normal in all the client code (S.Giani).
|
||||
// - Proper use of the tolerance in the Intersect function (S.Giani).
|
||||
// ----------------------------------------------------------------------
|
||||
#ifndef __PLANESURFACE_H
|
||||
#define __PLANESURFACE_H
|
||||
|
||||
|
||||
#include "G4Axis2Placement3D.hh"
|
||||
#include "G4Plane.hh"
|
||||
#include "G4Surface.hh"
|
||||
|
||||
|
||||
class G4FPlane:public G4Surface
|
||||
class G4FPlane : public G4Surface
|
||||
{
|
||||
|
||||
public:
|
||||
public: // with description
|
||||
|
||||
// Default constructor - destructor
|
||||
G4FPlane();
|
||||
~G4FPlane() { delete NormalX; }
|
||||
virtual ~G4FPlane();
|
||||
// Default constructor & destructor.
|
||||
|
||||
// Normal constructor
|
||||
G4FPlane( const G4Vector3D& direction,
|
||||
const G4Vector3D& axis ,
|
||||
const G4Point3D& Pt0 );
|
||||
|
||||
// Constructor used by G4BREPSolidBox and G4BREPSolidPolyhedra
|
||||
// Normal constructor.
|
||||
|
||||
G4FPlane(const G4Point3DVector* pVec,
|
||||
const G4Point3DVector* iVec= 0,
|
||||
int sense = 1);
|
||||
G4int sense = 1);
|
||||
// Constructor used by G4BREPSolidBox and G4BREPSolidPolyhedra.
|
||||
|
||||
// hit point of the ray on the surface
|
||||
G4Point3D hitpoint;
|
||||
G4int Intersect(const G4Ray& G4Rayref);
|
||||
// Calculates the intersection of the plane and a ray.
|
||||
|
||||
// calculate the intersection of the plane and a ray
|
||||
int Intersect(const G4Ray& G4Rayref);
|
||||
//int Evaluate(const G4Ray& ray) { return Intersect(ray); }
|
||||
|
||||
// Calculate bounding box
|
||||
void CalcBBox();
|
||||
// Calculates bounding box.
|
||||
|
||||
// Calculate the projection of the plane
|
||||
void Project();
|
||||
// Computes the projection of the plane.
|
||||
|
||||
// return the type, used in G4BREPSolid
|
||||
inline int MyType()const { return 1; }
|
||||
|
||||
// return the convexity or not
|
||||
int GetConvex() { return Convex; }
|
||||
inline G4int GetConvex() const;
|
||||
// Return plane's convexity, if so.
|
||||
|
||||
// is convex ?
|
||||
int IsConvex();
|
||||
|
||||
// deactive, used in G4Surface
|
||||
inline void Deactivate() { active=0; }
|
||||
inline G4int GetNumberOfPoints() const;
|
||||
// Gets the number of the points on the surface boundary.
|
||||
|
||||
// get the number of the points on the surface boundary
|
||||
inline int GetNumberOfPoints()
|
||||
{
|
||||
return (surfaceBoundary.GetNumberOfPoints());
|
||||
}
|
||||
inline G4Point3D GetSrfPoint() const;
|
||||
// Gets the location point on the surface.
|
||||
|
||||
inline const G4Point3D& GetPoint(G4int Count) const;
|
||||
// Gets a surface boundary point.
|
||||
|
||||
// get the location point
|
||||
G4Point3D GetSrfPoint() { return pplace.GetLocation(); }
|
||||
|
||||
// get a surface boundary point
|
||||
inline const G4Point3D& GetPoint(const int Count)
|
||||
{
|
||||
return surfaceBoundary.GetPoint(Count);
|
||||
}
|
||||
|
||||
void CalcNormal();
|
||||
|
||||
// return the normal, used in BREPSolid
|
||||
G4Ray* Norm() { return NormalX; }
|
||||
// Computes normal to surface.
|
||||
|
||||
G4Vector3D SurfaceNormal(const G4Point3D& Pt)const
|
||||
{
|
||||
return NormalX->GetDir();
|
||||
}
|
||||
|
||||
virtual const char* Name() const { return "G4FPlane"; }
|
||||
inline G4Vector3D SurfaceNormal(const G4Point3D& Pt) const;
|
||||
// Returns normal to surface.
|
||||
|
||||
inline const char* Name() const;
|
||||
// Returns the type identifier.
|
||||
|
||||
G4double ClosestDistanceToPoint(const G4Point3D& Pt);
|
||||
// Returns the closest distance from point Pt.
|
||||
|
||||
// L. Broglia : create this Surface function
|
||||
virtual G4double HowNear( const G4Vector3D& x ) const ;
|
||||
G4double HowNear( const G4Vector3D& x ) const ;
|
||||
// Computes the shortest distance from the point x to the G4FPlane.
|
||||
// The distance will always be positive.
|
||||
|
||||
inline G4Axis2Placement3D GetPplace() const { return pplace; }
|
||||
inline G4Axis2Placement3D GetPplace() const;
|
||||
inline G4Plane GetPplane() const;
|
||||
// Accessors to geometrical data.
|
||||
|
||||
inline G4Plane GetPplane() const { return Pl; }
|
||||
public: // without description
|
||||
|
||||
inline G4int MyType() const;
|
||||
// Returns the shape type (used in G4BREPSolid).
|
||||
|
||||
G4int IsConvex() const;
|
||||
// Returns -1. (?)
|
||||
|
||||
inline void Deactivate();
|
||||
// Deactive, used in G4Surface.
|
||||
|
||||
inline G4Ray* Norm();
|
||||
// Returns the normal (used in BREPSolid).
|
||||
|
||||
inline const G4Point3D& GetHitPoint() const;
|
||||
// Returns the hit point of the ray on the surface.
|
||||
|
||||
protected:
|
||||
|
||||
void InitBounded();
|
||||
|
||||
protected:
|
||||
|
||||
G4Point3D hitpoint;
|
||||
// Hit point of the ray on the surface.
|
||||
|
||||
private:
|
||||
|
||||
G4FPlane(const G4FPlane&);
|
||||
G4FPlane& operator=(const G4FPlane&);
|
||||
// Private copy constructor and assignment operator.
|
||||
|
||||
inline G4int Sign(G4double a) const;
|
||||
|
||||
private:
|
||||
|
||||
G4Axis2Placement3D pplace;
|
||||
G4Plane Pl;
|
||||
G4Ray *NormalX;
|
||||
int Convex;
|
||||
G4Ray* NormalX;
|
||||
G4int Convex;
|
||||
G4SurfaceBoundary* projectedBoundary;
|
||||
|
||||
inline int Sign(const G4double a)
|
||||
{
|
||||
register int i=1;
|
||||
if(a<0)
|
||||
i= -1;
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// P. Urban
|
||||
virtual void InitBounded();
|
||||
|
||||
};
|
||||
|
||||
#include "G4FPlane.icc"
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user