CMS 3D CMS Logo

PerpendicularBoundPlaneBuilder Class Reference

Constructs a plane perpendicular to an axis, and oriented in a special way. More...

#include <DataFormats/GeometryCommonDetAlgo/interface/PerpendicularBoundPlaneBuilder.h>

List of all members.

Public Member Functions

BoundPlaneoperator() (const Surface::GlobalPoint &origin, const Surface::GlobalVector &perp) const


Detailed Description

Constructs a plane perpendicular to an axis, and oriented in a special way.

Must be updated for reference counting.

Definition at line 11 of file PerpendicularBoundPlaneBuilder.h.


Member Function Documentation

BoundPlane * PerpendicularBoundPlaneBuilder::operator() ( const Surface::GlobalPoint origin,
const Surface::GlobalVector perp 
) const

Definition at line 6 of file PerpendicularBoundPlaneBuilder.cc.

References Vector3DBase< T, FrameTag >::cross(), rot, Vector3DBase< T, FrameTag >::unit(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

00008 {
00009   // z axis coincides with perp
00010   GlobalVector zAxis = perp.unit();
00011 
00012   // x axis has no global Z component
00013   GlobalVector xAxis;
00014   if ( zAxis.x() != 0 || zAxis.y() != 0) {
00015     // precision is not an issue here, just protect against divizion by zero
00016     xAxis = GlobalVector( -zAxis.y(), zAxis.x(), 0).unit();
00017   }
00018   else { // perp coincides with global Z
00019     xAxis = GlobalVector( 1, 0, 0);
00020   }
00021 
00022   // y axis obtained by cross product
00023   GlobalVector yAxis( zAxis.cross( xAxis));
00024 
00025   Surface::RotationType rot( xAxis.x(), xAxis.y(), xAxis.z(),
00026                              yAxis.x(), yAxis.y(), yAxis.z(),
00027                              zAxis.x(), zAxis.y(), zAxis.z());
00028 
00029   return new BoundPlane( origin, rot);
00030 }


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:29:39 2009 for CMSSW by  doxygen 1.5.4