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 
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 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:114
Plane TangentPlane
Definition: Surface.h:32
T perp() const
Definition: PV3DBase.h:72
virtual ReferenceCountingPointer< TangentPlane > tangentPlane(const GlobalPoint &) const
tangent plane to surface from global point
Definition: Cylinder.cc:23
float float float z
virtual Side side(const LocalPoint &p, Scalar toler) const
Definition: Cylinder.cc:9
Scalar radius() const
Radius of the cylinder.
Definition: Cylinder.h:67
Vector3DBase< typename PreciseFloatType< T, U >::Type, FrameTag > cross(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:119
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
TkRotation< float > RotationType
const RotationType & rotation() const
const PositionType & position() const
tuple size
Write out results.