00001 /************************************************************************************************** 00002 Software License Agreement (BSD License) 00003 00004 Copyright (c) 2011-2013, LAR toolkit developers - University of Aveiro - http://lars.mec.ua.pt 00005 All rights reserved. 00006 00007 Redistribution and use in source and binary forms, with or without modification, are permitted 00008 provided that the following conditions are met: 00009 00010 *Redistributions of source code must retain the above copyright notice, this list of 00011 conditions and the following disclaimer. 00012 *Redistributions in binary form must reproduce the above copyright notice, this list of 00013 conditions and the following disclaimer in the documentation and/or other materials provided 00014 with the distribution. 00015 *Neither the name of the University of Aveiro nor the names of its contributors may be used to 00016 endorse or promote products derived from this software without specific prior written permission. 00017 00018 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 00019 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 00020 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 00021 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00022 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00023 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 00024 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00025 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 ***************************************************************************************************/ 00032 #include <hd_hl_apis_aux.h> 00033 00034 /*~~~~~~~~~~~~~~~~~ 00035 || AUX FUNCTIONS || 00036 ~~~~~~~~~~~~~~~~~~*/ 00037 hduVector3Dd TransformWorldCoordinatesToPHaNToMCoordinates(hduVector3Dd source) 00038 { 00039 static hduVector3Dd destination; 00040 static Eigen::Vector3d coord_in_world_ref; 00041 00042 coord_in_world_ref = (rotz(-90.) * roty(-90.)) * (Eigen::Vector3d) source ; 00043 00044 destination[0] = coord_in_world_ref[0]; 00045 destination[1] = coord_in_world_ref[1]; 00046 destination[2] = coord_in_world_ref[2]; 00047 00048 return destination; 00049 } 00050 00051 hduVector3Dd TransformPHANToMCoordinatesToWorldCoordinates(hduVector3Dd source) 00052 { 00053 static hduVector3Dd destination; 00054 static Eigen::Vector3d coord_in_phantom_ref; 00055 00056 coord_in_phantom_ref = (rotz(90.) * rotx(90.)) * (Eigen::Vector3d) source ; 00057 00058 destination[0] = coord_in_phantom_ref[0]; 00059 destination[1] = coord_in_phantom_ref[1]; 00060 destination[2] = coord_in_phantom_ref[2]; 00061 00062 return destination; 00063 } 00064 00065 hduMatrix TransformPHANToMCoordinateMatrixToWorldCoordinateMatrix(hduMatrix source) 00066 { 00067 // static hduMatrix destination; 00068 00069 static const hduMatrix rotation_x_90(1,0,0,0, 00070 0,0,-1,0, 00071 0,1,0,0, 00072 0,0,0,1); 00073 00074 static const hduMatrix rotation_z_90(0,-1,0,0, 00075 1,0,0,0, 00076 0,0,1,0, 00077 0,0,0,1); 00078 00079 return (rotation_z_90 * rotation_x_90) * source; 00080 }