CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Cylinder.cc
Go to the documentation of this file.
1 
2 
6 
7 #include <cfloat>
8 
9 Surface::Side Cylinder::side( const LocalPoint& p, Scalar toler) const
10 {
11  Scalar lz = p.perp() - radius();
12  return (fabs(lz)<toler ? SurfaceOrientation::onSurface :
14 }
15 
17 Cylinder::tangentPlane (const LocalPoint& aPoint) const
18 {
19  return tangentPlane(toGlobal(aPoint));
20 }
21 
23 Cylinder::tangentPlane (const GlobalPoint& aPoint) const
24 {
25  //
26  // Tangent plane at specified point. In order to avoid
27  // possible numerical problems currently no attempt is made
28  // to verify, if the point is actually on the cylinder.
29  //
30  // local y parallel to axis
31  GlobalVector yPlane(rotation().z());
32  // local x normal to y and a vector linking the specified
33  // point with the axis
34  GlobalVector xPlane(yPlane.cross(aPoint-position()));
35  Scalar size = std::max(std::max(std::abs(xPlane.x()),std::abs(xPlane.y())), std::abs(xPlane.z()));
36  if ( size<FLT_MIN )
37  throw GeometryError("Attempt to construct TangentPlane on cylinder axis");
38 // // local z defined by x and y (should point outwards from axis)
39 // GlobalVector zPlane(xPlane.cross(yPlane));
40  // rotation constructor will normalize...
42  RotationType(xPlane,
43  yPlane)
44  ));
45 }
TkRotation< Scalar > RotationType
Definition: Definitions.h:29
T perp() const
Definition: PV3DBase.h:72
double Scalar
Definition: Definitions.h:27
float float float z
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
const T & max(const T &a, const T &b)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Plane TangentPlane
Definition: Surface.h:34
tuple size
Write out results.