00001 // Filename: rotate_to.h 00002 // Created by: drose (04Nov99) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 #ifndef ROTATE_TO_H 00020 #define ROTATE_TO_H 00021 00022 //////////////////////////////////////////////////////////////////// 00023 // 00024 // rotate_to() 00025 // 00026 // This function computes a suitable rotation matrix to rotate vector 00027 // a onto vector b. That is, it computes mat so that a * mat = b. 00028 // The rotation axis is chosen to give the smallest possible rotation 00029 // angle. 00030 // 00031 //////////////////////////////////////////////////////////////////// 00032 00033 #include <math.h> 00034 #include <pandabase.h> 00035 #include "luse.h" 00036 00037 BEGIN_PUBLISH 00038 00039 EXPCL_PANDA void rotate_to(LMatrix3f &mat, const LVector3f &a, const LVector3f &b); 00040 EXPCL_PANDA void rotate_to(LMatrix3d &mat, const LVector3d &a, const LVector3d &b); 00041 00042 EXPCL_PANDA void rotate_to(LMatrix4f &mat, const LVector3f &a, const LVector3f &b); 00043 EXPCL_PANDA void rotate_to(LMatrix4d &mat, const LVector3d &a, const LVector3d &b); 00044 00045 END_PUBLISH 00046 00047 #endif