00001 // Filename: test_mathutil.cxx 00002 // Created by: drose (16Mar00) 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 #include <luse.h> 00020 #include "rotate_to.h" 00021 #include "boundingLine.h" 00022 #include "boundingSphere.h" 00023 00024 int 00025 main() { 00026 /* 00027 LVector3d a(1.0f, 0.0f, 0.0f); 00028 LVector3d b = normalize(LVector3d(0.5, 0.5, 0.0f)); 00029 00030 LMatrix3d rot; 00031 rotate_to(rot, a, b); 00032 00033 nout << "a = " << a << "\n" 00034 << "b = " << b << "\n" 00035 << "rot =\n"; 00036 rot.write(nout, 2); 00037 nout << "a * rot = " << a * rot << " length " << length(a * rot) << "\n" 00038 << "a * invert(rot) = " << a * invert(rot) 00039 << " length " << length(a * invert(rot)) << "\n" 00040 << "b * rot = " << b * rot 00041 << " length " << length(b * rot) << "\n" 00042 << "b * invert(rot) = " << b * invert(rot) 00043 << " length " << length(a * invert(rot)) << "\n"; 00044 */ 00045 00046 BoundingLine line(LPoint3f(0, 0, 1), LPoint3f(0, 0, 0)); 00047 00048 BoundingSphere s1(LPoint3f(0, 0, 10), 1); 00049 BoundingSphere s2(LPoint3f(10, 0, 10), 1); 00050 BoundingSphere s3(LPoint3f(1, 0, 0), 1); 00051 BoundingSphere s4(LPoint3f(-1, -1, -1), 1); 00052 00053 line.contains(&s1); 00054 line.contains(&s2); 00055 line.contains(&s3); 00056 line.contains(&s4); 00057 00058 /* 00059 s1.contains(LPoint3f(0, 0, 1), LPoint3f(0, 0, 0)); 00060 s2.contains(LPoint3f(0, 0, 1), LPoint3f(0, 0, 0)); 00061 s3.contains(LPoint3f(0, 0, 1), LPoint3f(0, 0, 0)); 00062 s4.contains(LPoint3f(0, 0, 1), LPoint3f(0, 0, 0)); 00063 */ 00064 00065 return (0); 00066 }