PSCalib/src/SegGeometry.cpp

Go to the documentation of this file.
00001 //--------------------------------------------------------------------------
00002 // File and Version Information:
00003 //      $Id: SegGeometry.cpp 10588 2015-08-10 21:06:34Z dubrovin@SLAC.STANFORD.EDU $
00004 //
00005 // Description:
00006 //      Class SegGeometry...
00007 //
00008 // Author List:
00009 //      Mikhail S. Dubrovin
00010 //
00011 //------------------------------------------------------------------------
00012 
00013 //-----------------------
00014 // This Class's Header --
00015 //-----------------------
00016 #include "PSCalib/SegGeometry.h"
00017 
00018 //-----------------
00019 // C/C++ Headers --
00020 //-----------------
00021 #include <math.h>      // sin, cos
00022 //#include <cmath> 
00023 //#include <algorithm> // std::copy
00024 #include <iostream>    // cout
00025 //#include <fstream>
00026 //#include <string>
00027 
00028 //-------------------------------
00029 // Collaborating Class Headers --
00030 //-------------------------------
00031 
00032 
00033 
00034 namespace PSCalib {
00035 
00036 //----------------
00037 // GLOBAL methods
00038 //----------------
00039 
00040 void rotation_ang(const double* x, const double* y, unsigned size, double angle_deg, double* xrot, double* yrot)
00041 {
00042     const double angle_rad = angle_deg * DEG_TO_RAD;
00043     const double C = cos(angle_rad);
00044     const double S = sin(angle_rad);
00045     rotation_cs(x, y, size, C, S, xrot, yrot);
00046 }
00047 
00048 //--------------
00049 
00050 void rotation_cs(const double* x, const double* y, unsigned size, double C, double S, double* xrot, double* yrot)
00051 {
00052   for (unsigned i=0; i<size; i++, xrot++, yrot++, x++, y++) {
00053     *xrot = *x *C - *y *S;
00054     *yrot = *y *C + *x *S; 
00055   }
00056 }
00057 
00058 //--------------
00059 
00060 double min_of_arr(const double* arr, unsigned size)
00061 {
00062   double min=arr[0]; for(unsigned i=1; i<size; ++i) { if(arr[i] < min) min=arr[i]; } 
00063   return min;
00064 }
00065 
00066 //--------------
00067 
00068 double max_of_arr(const double* arr, unsigned size)
00069 {
00070   double max=arr[0]; for(unsigned i=1; i<size; ++i) { if(arr[i] > max) max=arr[i]; } 
00071   return max;
00072 }
00073 
00074 //----------------
00075 // Constructors --
00076 //----------------
00077 //SegGeometry::SegGeometry (){}
00078 
00079 //--------------
00080 // Destructor --
00081 //--------------
00082 //SegGeometry::~SegGeometry (){}
00083 
00084 //--------------
00085 //--------------
00086 //--------------
00087 //--------------
00088 
00089 } // namespace PSCalib
00090 
00091 //--------------

Generated on 19 Dec 2016 for PSANAmodules by  doxygen 1.4.7