00001 /***************************************************************************\ 00002 * Copyright (C) by University Paris-Est - MISS team 00003 * GeometryTools.hpp created in 10 2008. 00004 * Mail : biri@univ-mlv.fr 00005 * 00006 * This file is part of the OpenKraken-geometry. 00007 * 00008 * The OpenKraken-geometry is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License as published by 00010 * the Free Software Foundation; either version 3 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * The OpenKraken-geometry is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public License 00019 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00020 * 00021 \***************************************************************************/ 00022 00023 00024 /* 00025 * Anti-doublon 00026 */ 00027 #ifndef __OPENKN_GEOMETRY__GEOMETRYTOOLS_HPP__ 00028 #define __OPENKN_GEOMETRY__GEOMETRYTOOLS_HPP__ 00029 00030 00031 /* 00032 * External Includes 00033 */ 00034 #include <OpenKN/math/Vector3.hpp> 00035 #include <limits> 00036 00037 namespace kn{ 00038 00039 /* 00040 * Brief Max value of float 00041 */ 00042 const static float MAX_FLOAT = std::numeric_limits<float>::max(); 00043 00044 /* 00045 * Brief Min value of float 00046 */ 00047 const static float MIN_FLOAT = std::numeric_limits<float>::min(); 00048 00057 template<typename T> 00058 inline kn::Vector3<T> barycentricToPoint(const kn::Vector3<T> & pointA, const kn::Vector3<T> & pointB, const kn::Vector3<T> & pointC, 00059 const kn::Vector2<T> & bary) { 00060 return pointA * (1-bary.x()-bary.y()) + pointB*bary.x() + pointC*bary.y(); 00061 } 00062 00063 } 00064 00065 #endif