G4Line.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id$
00028 //
00029 // ----------------------------------------------------------------------
00030 // GEANT 4 class source file
00031 //
00032 // G4Line.cc
00033 //
00034 // ----------------------------------------------------------------------
00035 
00036 #include "G4Line.hh"
00037 
00038 G4Line::G4Line (){}
00039 G4Line::~G4Line (){}
00040 
00041 G4Line::G4Line(const G4Line& right)
00042   : G4Curve(), pnt(right.pnt), dir(right.dir),
00043     invDir(right.invDir), v(right.v)
00044 {
00045   bBox      = right.bBox;
00046   start     = right.start;
00047   end       = right.end;
00048   pStart    = right.pStart;
00049   pEnd      = right.pEnd;
00050   pRange    = right.pRange;
00051   bounded   = right.bounded;
00052   sameSense = right.sameSense;
00053 }
00054 
00055 G4Line& G4Line::operator=(const G4Line& right)
00056 {
00057   if (&right == this) return *this;
00058   
00059   pnt       = right.pnt;
00060   dir       = right.dir;
00061   invDir    = right.invDir;
00062   v         = right.v;
00063   bBox      = right.bBox;
00064   start     = right.start;
00065   end       = right.end;
00066   pStart    = right.pStart;
00067   pEnd      = right.pEnd;
00068   pRange    = right.pRange;
00069   bounded   = right.bounded;
00070   sameSense = right.sameSense;
00071   
00072   return *this;
00073 }
00074 
00075 G4Curve* G4Line::Project(const G4Transform3D& tr)
00076 {
00077   G4Vector3D newDir= tr*dir;
00078   
00079   if (std::abs(newDir.x())+std::abs(newDir.y()) < kCarTolerance){
00080   
00081      newDir.setX(kCarTolerance);
00082      newDir.setY(kCarTolerance);
00083   };
00084   
00085   G4Point3D newPnt= tr*pnt;
00086   newDir.setZ(0);
00087   newPnt.setZ(0);
00088   
00089   G4Line* r= new G4Line();
00090 
00091   // L. Broglia : terrible mistake !!!!
00092   //r->Init(newDir, newPnt);
00093   r->Init(newPnt, newDir);
00094 
00095   r->SetBounds(GetPStart(), GetPEnd());
00096   
00097   return r;
00098 }
00099 
00101 
00102 G4bool G4Line::Tangent(G4CurvePoint&, G4Vector3D& vec)
00103 {
00104   if(GetSameSense())
00105     vec = -dir;
00106   else
00107     vec = dir;
00108 
00109   return true;
00110 }

Generated on Mon May 27 17:48:47 2013 for Geant4 by  doxygen 1.4.7