source: trunk/source/geometry/solids/specific/test/testG4TwistedBox.cc @ 1347

Last change on this file since 1347 was 1316, checked in by garnier, 14 years ago

update geant4-09-04-beta-cand-01 interfaces-V09-03-09 vis-V09-03-08

File size: 3.0 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: testG4TwistedBox.cc,v 1.6 2006/06/29 18:49:51 gunter Exp $
28// GEANT4 tag $Name:
29//
30
31// testG4TwistedBox
32//
33//  Test file for class G4TwistedBox
34//
35//             Ensure asserts are compiled in
36
37#include <assert.h>
38#include <cmath>
39
40#include "globals.hh"
41#include "geomdefs.hh"
42
43#include "G4ThreeVector.hh"
44#include "G4TwistedBox.hh"
45#include "G4RotationMatrix.hh"
46#include "G4AffineTransform.hh"
47#include "G4VoxelLimits.hh"
48
49
50G4bool testG4TwistedBox()
51{
52
53    G4ThreeVector pzero(0,0,0);
54    G4ThreeVector pout ( 200*cm,200*cm,200*cm) ;
55    G4ThreeVector dir = pzero-pout ;
56   
57    dir *= 1./dir.mag();
58
59    G4TwistedBox t1("Solid Twisted Box #1",
60                          20*deg ,    // twisted angle
61                          10*cm,       // half x-length
62                          15*cm,       // half y-length
63                          20*cm) ;      // half z-length
64
65    G4double dist = t1.DistanceToIn(pout,dir) ;
66    G4cout << "distance = " << dist << G4endl ;
67
68// Check Inside
69
70    G4cout << "Test Inside(p) " << G4endl << G4endl ;
71
72    G4cout << "pzero : " << t1.Inside(pzero) << G4endl ;
73    //assert(t1.Inside(pzero)==kInside) ;
74
75    // testing the volume
76
77    G4double volume = t1.GetCubicVolume() ;
78    G4cout << G4endl << G4endl ;
79    G4cout << "Twisted Box volume = " << volume / cm / cm /cm << " cm^3" << G4endl ;
80
81    return true;
82}
83
84int main()
85{
86#ifdef NDEBUG
87    G4Exception("FAIL: *** Assertions must be compiled in! ***");
88#endif
89    assert(testG4TwistedBox());
90    return 0;
91}
92
93
Note: See TracBrowser for help on using the repository browser.