ATLAS Offline Software
SbPlane.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /*
6  * VP1HEPVis
7  * SbPlane.cxx
8  *
9  * Created on: Dec 13, 2012
10  * Author: rbianchi <Riccardo.Maria.Bianchi@cern.ch>
11  *
12  */
13 
14 
15 /*
16  *
17  * New file for HEPVis
18  *
19  * taken from: http://fossies.org/dox/osc_vis_source_16.11.6/HEPVis_2include_2HEPVis_2SbPlane_8cxx_source.html
20  *
21  * R.M. Bianchi <rbianchi@cern.ch>
22  *
23  * 12.12.2012
24  *
25  *===================
26  * VP1 Customization:
27  *
28  * - look into the code for comments "// VP1 change [...] //---"
29  *
30  */
31 
32 //---
33 
34 
35 // this :
36 // VP1 change
37 //#include <HEPVis/SbPlane.h>
38 #include <VP1HEPVis/SbPlane.h>
39 //---
40 
41 
42 HEPVis::SbPlane::SbPlane(void) //private to avoid problems.
43 //NOTE : CoinGL/SbPlane() does not initialize the fields !
44 :m_normal(0,0,1) //CLHEP initialize with x-y plane (normal to z and distance 0)
45 ,m_distance(0)
46 {}
47 HEPVis::SbPlane::SbPlane(const SbVec3d& a_normal,double a_D)
48  : m_normal (a_normal),
49  m_distance (a_D)
50 {
51  m_normal.normalize();
52  //NOTE : equation of the plan is then : n[0]*x+n[1]*y+n[2]*z-distance = 0
53 }
54 HEPVis::SbPlane::SbPlane(const SbVec3d& a_normal,const SbVec3d& a_point)
55  : m_normal (a_normal)
56 {
57  //FIXME if(normalref.sqrLength()==0) //throw
58  m_normal.normalize();
59  m_distance = m_normal.dot(a_point);
60 }
61 
62 /*
63 HEPVis::SbPlane::SbPlane(double a,double b,double c,double d) {
64  // To follow CLHEP.
65  // Constructor from four numbers - creates plane a*x+b*y+c*z+d=0.
66  normal.setValue(a,b,c);
67  normal.normalize();
68  distance = -d; //NOTE : yes, it is a minus.
69 }
70 */
71 double HEPVis::SbPlane::getDistance(const SbVec3d& a_point) const {
72  return a_point.dot(m_normal) - m_distance;
73 }
74 double HEPVis::SbPlane::distance(const SbVec3d& a_point) const {
75  return getDistance(a_point);
76 }
77 const SbVec3d& HEPVis::SbPlane::getNormal() const { return m_normal;}
78 double HEPVis::SbPlane::getDistanceFromOrigin(void) const { return m_distance;}
79 
80 
SbPlane.h
HEPVis::SbPlane::distance
double distance(const SbVec3d &point) const
Definition: SbPlane.cxx:74
HEPVis::SbPlane::SbPlane
SbPlane()
Definition: SbPlane.cxx:42
HEPVis::SbPlane::m_distance
double m_distance
Definition: SbPlane.h:55
Prompt::getDistance
double getDistance(const xAOD::Vertex *vtx1, const xAOD::Vertex *vtx2)
Definition: PromptUtils.cxx:41
HEPVis::SbPlane::getDistance
double getDistance(const SbVec3d &point) const
Definition: SbPlane.cxx:71
HEPVis::SbPlane::getNormal
const SbVec3d & getNormal() const
Definition: SbPlane.cxx:77
HEPVis::SbPlane::m_normal
SbVec3d m_normal
Definition: SbPlane.h:54
HEPVis::SbPlane::getDistanceFromOrigin
double getDistanceFromOrigin() const
Definition: SbPlane.cxx:78