SpherePackingScenarioGenerator
|
00001 #ifndef BasicGeometryOperations_H_ 00002 #define BasicGeometryOperations_H_ 00003 00004 #include "algorithms/geometries/Channel.h" 00005 #include "tarch/la/Vector.h" 00006 00007 //todo move this function into a geometry operations class... 00012 //tarch::la::Vector<2,double>& 00013 //rotatePoint( 00014 // tarch::la::Vector<2,double>& pointToBeRotated, 00015 // const double& sinRotationAngle, 00016 // const double& cosRotationAngle, 00017 // const double& rotationCenterX, 00018 // const double& rotationCenterY 00019 //); 00020 // 00022 // * Rotates the Point around the offspring 00023 // */ 00024 //algorithms::geometries::Channel 00025 //rotateChannel( 00026 // algorithms::geometries::Channel& channelToBeRotated, 00027 // const double& rotationAngle, 00028 // const double& sinRotationAngle, 00029 // const double& cosRotationAngle, 00030 // const tarch::la::Vector<2,double>& rotationCenter, 00031 //); 00032 // 00033 //std::vector<algorithms::geometries::Channel*> 00034 //getPtrVectorGeometryChannels( 00035 // std::vector<algorithms::geometries::Channel>& channels 00036 //); 00037 00038 /* 00039 * BasicGeometryOperations.cpp 00040 * 00041 * Created on: Mar 13, 2012 00042 * Author: michael 00043 */ 00044 00045 00046 //todo move this function into a geometry operations class... 00050 static tarch::la::Vector<2,double>& 00051 rotatePoint( 00052 tarch::la::Vector<2,double>& pointToBeRotated, 00053 const double& sinRotationAngle, 00054 const double& cosRotationAngle, 00055 const double& rotationCenterX, 00056 const double& rotationCenterY 00057 ) { 00058 double x=pointToBeRotated(0)-rotationCenterX; 00059 double y=pointToBeRotated(1)-rotationCenterY; 00060 pointToBeRotated(0)=cosRotationAngle*x-sinRotationAngle*y+rotationCenterX; 00061 pointToBeRotated(1)=sinRotationAngle*x+cosRotationAngle*y+rotationCenterY; 00062 return pointToBeRotated; 00063 } 00064 00065 #endif // BasicGeometryOperations_H_ 00066