Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

MathUtils.h

00001 //
00002 // OpenVRML
00003 //
00004 // Copyright (C) 1998  Chris Morley
00005 // 
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License, or (at your option) any later version.
00010 // 
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 // 
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 // 
00020 
00021 #ifndef MATHUTILS_H
00022 #define MATHUTILS_H
00023 
00024 #include "common.h"
00025 
00026 namespace OpenVRML {
00027 
00028     inline void Vset(float V[3], const float A[3]) {
00029         V[0] = A[0];
00030         V[1] = A[1];
00031         V[2] = A[2];
00032     }
00033     
00034     inline void Vscale(float V[3], const float s) {
00035         V[0] *= s;
00036         V[1] *= s;
00037         V[2] *= s;
00038     }
00039     
00040     inline float Vdot(const float A[3], const float B[3]) {
00041         return A[0] * B[0] + A[1] * B[1] + A[2] * B[2];
00042     }
00043     
00044     void Vdiff(float V[3], const float A[3], const float B[3]);  // V <= A - B
00045     void Vcross(float V[3], const float A[3], const float B[3]); // V <= A x B
00046 
00047     void axis_aligned_bbox(float M[4][4], float *min, float *max);
00048 }
00049 
00050 #endif