From 2cc8f285b20a169a81644b91157102f01086ede3 Mon Sep 17 00:00:00 2001 From: nicolas-f Date: Thu, 22 Jun 2017 11:21:37 +0200 Subject: [PATCH] Update fastvoxel, ply compatibility --- src/Core/mathlib.h | 177 ++++++++++++++---------- src/input_output/ply/rply_interface.cpp | 93 +++++++------ src/input_output/ply/rply_interface.hpp | 49 ++++--- src/std_tools.cpp | 72 +++++----- src/std_tools.hpp | 54 +++++--- 5 files changed, 247 insertions(+), 198 deletions(-) diff --git a/src/Core/mathlib.h b/src/Core/mathlib.h index 1c3c720..fcae0ab 100644 --- a/src/Core/mathlib.h +++ b/src/Core/mathlib.h @@ -1,47 +1,34 @@ -/*************************************************************************** - * Mathlib - * - * Copyright (C) 2003-2004, Alexander Zaprjagaev - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - *************************************************************************** - * Update 2004/08/19 - * - * added ivec2, ivec3 & ivec4 methods - * vec2, vec3 & vec4 data : added texture coords (s,t,p,q) and color enums (r,g,b,a) - * mat3 & mat4 : added multiple float constructor ad modified methods returning mat3 or mat4 - * optimisations like "x / 2.0f" replaced by faster "x * 0.5f" - * defines of multiples usefull maths values and radian/degree conversions - * vec2 : added methods : set, reset, compare, dot, closestPointOnLine, closestPointOnSegment, - * projectionOnLine, lerp, angle - * vec3 : added methods : set, reset, compare, dot, cross, closestPointOnLine, closestPointOnSegment, - * projectionOnLine, lerp, angle - * vec4 : added methods : set, reset, compare - *************************************************************************** - */ - - -/** - * 2011 Edited, add some function and typedef, templates - * FastVoxel is a voxelisation library of polygonal 3d model and do volumes identifications. - * It is dedicated to finite element solvers - * @author Nicolas Fortin , Judicael Picaut judicael.picaut (home) ifsttar.fr - * Official repository is https://github.com/nicolas-f/FastVoxel - */ -#include "std_tools.hpp" +/* ---------------------------------------------------------------------- +* I-SIMPA (http://i-simpa.ifsttar.fr). This file is part of I-SIMPA. +* +* I-SIMPA is a GUI for 3D numerical sound propagation modelling dedicated +* to scientific acoustic simulations. +* Copyright (C) 2007-2014 - IFSTTAR - Judicael Picaut, Nicolas Fortin +* +* I-SIMPA is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 3 of the License, or +* (at your option) any later version. +* +* I-SIMPA is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software Foundation, +* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or +* see +* +* For more information, please consult: or +* send an email to i-simpa@ifsttar.fr +* +* To contact Ifsttar, write to Ifsttar, 14-20 Boulevard Newton +* Cite Descartes, Champs sur Marne F-77447 Marne la Vallee Cedex 2 FRANCE +* or write to scientific.computing@ifsttar.fr +* ----------------------------------------------------------------------*/ + +#include "../std_tools.hpp" #include #include #include @@ -55,7 +42,12 @@ #ifndef __HMATHLIB__ #define __HMATHLIB__ - +// Number precision for display (after comma separator) +const int COMMA_PRECISION_DB = 1; +const int COMMA_PRECISION_TIME_S = 2; +const int COMMA_PRECISION_TIME_MS = 1; +const int COMMA_PRECISION_PERCENT = 1; +const int COMMA_PRECISION_AREA = 2; /** @@ -106,12 +98,15 @@ class base_vec3 { public: base_vec3(void) : x(0), y(0), z(0) { } base_vec3(const base_t& _x,const base_t& _y,const base_t& _z) : x(_x), y(_y), z(_z) { } - base_vec3(const base_t *_v) : x(_v[0]), y(_v[1]), z(_v[2]) { } + base_vec3(const double _v[3]) : x(_v[0]), y(_v[1]), z(_v[2]) { } + base_vec3(const float _v[3]) : x(_v[0]), y(_v[1]), z(_v[2]) { } base_vec3(const vec2 &_v,base_t _z); base_vec3(const base_vec3 &_v) : x(_v.x), y(_v.y), z(_v.z) { } base_vec3(const vec4 &_v); - int operator==(const base_vec3 &_v) { return (fabs(this->x - _v.x) < EPSILON && fabs(this->y - _v.y) < EPSILON && fabs(this->z - _v.z) < EPSILON); } + int operator==(const base_vec3 &_v) { + return (fabs(this->x - _v.x) < EPSILON && fabs(this->y - _v.y) < EPSILON && fabs(this->z - _v.z) < EPSILON); + } int operator!=(const base_vec3 &_v) { return !(*this == _v); } base_vec3 &operator=(base_t _f) { this->x=_f; this->y=_f; this->z=_f; return (*this); } @@ -136,6 +131,16 @@ class base_vec3 { base_t operator*(const base_vec3 &_v) const { return this->x * _v.x + this->y * _v.y + this->z * _v.z; } base_t operator*(const vec4 &_v) const; + /** + * Copy this vector into the float array in parameter + * @param arr[out] External array + */ + void copyTo(float* arr) { + arr[0] = x; + arr[1] = y; + arr[2] = z; + } + operator base_t*() { return this->v; } operator const base_t*() const { return this->v; } base_t &operator[](int _i) { return this->v[_i]; } @@ -238,6 +243,15 @@ class base_vec3 { typedef base_vec3 vec3; typedef base_vec3 dvec3; + +inline vec3 dvec3_to_vec3(const dvec3 &v1) { + return vec3(v1.x, v1.y, v1.z); +} + +inline dvec3 vec3_to_dvec3(const vec3 &v1) { + return dvec3(v1.x, v1.y, v1.z); +} + /*****************************************************************************/ /* */ /* vec2 */ @@ -329,8 +343,10 @@ inline void Cross(const vec3 &v1,const vec3 &v2,vec3 &vout) { vout.y=v1.z * v2.x - v1.x * v2.z; vout.z=v1.x * v2.y - v1.y * v2.x; } -inline vec3 Cross_r(const vec3 &v1,const vec3 &v2) { - return vec3(v1.y * v2.z - v1.z * v2.y,v1.z * v2.x - v1.x * v2.z,v1.x * v2.y - v1.y * v2.x); + +template +inline base_vec3 Cross_r(const base_vec3 &v1,const base_vec3 &v2) { + return base_vec3(v1.y * v2.z - v1.z * v2.y,v1.z * v2.x - v1.x * v2.z,v1.x * v2.y - v1.y * v2.x); } template inline base_vec3::base_vec3(const vec2 &_v,base_t _z) @@ -344,15 +360,18 @@ inline vec2::vec2(const vec3 &_v) { } // This calculates a vector between 2 points and returns the result -inline void Vector(const vec3 &vp1, const vec3 &vp2,vec3 &vout) { +template +inline void Vector(const base_vec3 &vp1, const base_vec3 &vp2, base_vec3 &vout) { vout.x=vp1.x - vp2.x; vout.y=vp1.y - vp2.y; vout.z=vp1.z - vp2.z; } -inline vec3 Vector_r(const vec3 &vp1, const vec3 &vp2) + +template +inline base_vec3 Vector_r(const base_vec3 &vp1, const base_vec3 &vp2) { - return vec3(vp1.x - vp2.x,vp1.y - vp2.y,vp1.z - vp2.z); + return base_vec3(vp1.x - vp2.x,vp1.y - vp2.y,vp1.z - vp2.z); } /** * This calculates determinant 3*3 @@ -372,10 +391,11 @@ inline decimal Determinant(const vec3 &vp1, const vec3 &vp2, const vec3 &vp3) { /* */ /*****************************************************************************/ -inline vec3 FaceNormal(const vec3 &vp1, const vec3 &vp2, const vec3 &vp3) +template +inline base_vec3 FaceNormal(const base_vec3 &vp1, const base_vec3 &vp2, const base_vec3 &vp3) { - vec3 vret=Cross_r(Vector_r(vp1, vp2),Vector_r(vp2, vp3)); + base_vec3 vret=Cross_r(Vector_r(vp1, vp2),Vector_r(vp2, vp3)); vret.normalize(); return vret; } @@ -470,12 +490,13 @@ inline vec2::vec2(const vec4 &_v) { this->x = _v.x; this->y = _v.y; } -inline bool colinear( const vec3& A, const vec3& B, const vec3& C, const decimal& aproximation) + +template +inline bool colinear( const base_vec3& A, const base_vec3& B, const base_vec3& C, const decimal& aproximation) { - vec3 AB=B-A; - vec3 AC=C-A; - decimal diff=(AB/AB.length()-AC/AC.length()).length(); - return diff AB=B-A; + base_vec3 AC=C-A; + return (AB / AB.length() - AC / AC.length()).length() < aproximation; } /*****************************************************************************/ /* */ @@ -543,10 +564,13 @@ class ivec3 { ivec3(void) : a(0), b(0), c(0) { } ivec3(long _a,long _b,long _c) : a(_a), b(_b), c(_c) { } ivec3(const long *iv) : a(iv[0]), b(iv[1]), c(iv[2]) { } + ivec3(const int *iv) : a(iv[0]), b(iv[1]), c(iv[2]) { } ivec3(const ivec3 &iv) : a(iv.a), b(iv.b), c(iv.c) { } ivec3(const ivec4 &iv); - int operator==(const ivec3 &iv) { return ((this->a == iv.a) && (this->b == iv.b) && (this->c == iv.c)); } + int operator==(const ivec3 &iv) { + return ((this->a == iv.a) && (this->b == iv.b) && (this->c == iv.c)); + } int operator!=(const ivec3 &iv) { return !(*this == iv); } ivec3 &operator=(long _i) { this->x=_i; this->y=_i; this->z=_i; return (*this); } @@ -567,11 +591,10 @@ class ivec3 { operator long*() { return this->i; } operator const long*() const { return this->i; } -// long &operator[](int _i) { return this->i[_i]; } -// const long &operator[](int _i) const { return this->i[_i]; } void set(long _a,long _b,long _c) { this->a = _a; this->b = _b; this->c = _c; } void set(int tab[3]) { this->a = tab[0]; this->b = tab[1]; this->c = tab[2]; } + void set(int index, const long& value) { i[index] = value; } void reset(void) { this->a = this->b = this->c = 0; } void swap(ivec3 &iv) { long tmp=a; a=iv.a; iv.a=tmp; tmp=b; b=iv.b; iv.b=tmp; tmp=c; c=iv.c; iv.c=tmp; } void swap(ivec3 *iv) { this->swap(*iv); } @@ -615,6 +638,7 @@ class ivec4 { ivec4(void) : a(0), b(0), c(0), d(1) { } ivec4(long _a,long _b,long _c,long _d) : a(_a), b(_b), c(_c), d(_d) { } ivec4(const long *iv) : a(iv[0]), b(iv[1]), c(iv[2]), d(iv[3]) { } + ivec4(const int *iv) : a(iv[0]), b(iv[1]), c(iv[2]), d(iv[3]) { } ivec4(const ivec3 &iv) : a(iv.a), b(iv.b), c(iv.c), d(1) { } ivec4(const ivec3 &iv,long _d) : a(iv.a), b(iv.b), c(iv.c), d(_d) { } ivec4(const ivec4 &iv) : a(iv.a), b(iv.b), c(iv.c), d(iv.d) { } @@ -639,8 +663,8 @@ class ivec4 { operator long*() { return this->i; } operator const long*() const { return this->i; } -// long &operator[](int _i) { return this->i[_i]; } -// const long &operator[](int _i) const { return this->i[_i]; } + long &operator[](int _i) { return this->i[_i]; } + const long &operator[](int _i) const { return this->i[_i]; } void set(long _a,long _b,long _c,long _d) { this->a = _a; this->b = _b; this->c = _c; this->d = _d; } void reset(void) { this->a = this->b = this->c = this->d = 0; } @@ -676,36 +700,39 @@ inline decimal CalcTetraVolume(vec3 A,vec3 B,vec3 C,vec3 D) /** * @return La position du point central d'un triangle */ -inline vec3 GetGTriangle(const vec3& A,const vec3& B,const vec3& C) +template +inline base_vec3 GetGTriangle(const base_vec3& A,const base_vec3& B,const base_vec3& C) { - vec3 I=(B+C)/2; - vec3 AG=(I-A)*(2.f/3.f); + base_vec3 I=(B+C)/2; + base_vec3 AG=(I-A)*(2.f/3.f); return A+AG; } inline vec3 GetGTetra(const vec3& A,const vec3& B,const vec3& C,const vec3& D) { return (A+B+C+D)/4; } -inline decimal GetAireTriangle(const vec3& a,const vec3& b,const vec3& c) +template +inline decimal GetAireTriangle(const base_vec3& a,const base_vec3& b,const base_vec3& c) { - vec3 ab; - vec3 ac; + base_vec3 ab; + base_vec3 ac; Vector(a,b,ab); Vector(a,c,ac); ab.cross(ac); - return .5f*ab.length(); + return .5*ab.length(); } /* * @param ecart Au maximum 2*PI au minimum 0 * @return Vrai si Si ecart==0 ou ecart>0.1 */ -inline bool DotIsInVertex(const vec3& dot,const vec3& va,const vec3& vb,const vec3& vc,decimal* ecart=NULL) +template +inline bool DotIsInVertex(const base_vec3& dot,const base_vec3& va,const base_vec3& vb,const base_vec3& vc,decimal* ecart=NULL) { //retourne vrai si le point est dans un triangle, le total à la fin correspond à environ 2PI si c'est le cas decimal totangle=0; // calcul des vecteurs des cotés - vec3 vda(dot-va); - vec3 vdb(dot-vb); - vec3 vdc(dot-vc); + base_vec3 vda(dot-va); + base_vec3 vdb(dot-vb); + base_vec3 vdc(dot-vc); //Calcul de la somme des angles sur le plan xy totangle+=vda.angle(vdb); totangle+=vda.angle(vdc); diff --git a/src/input_output/ply/rply_interface.cpp b/src/input_output/ply/rply_interface.cpp index d4fea36..53d244c 100644 --- a/src/input_output/ply/rply_interface.cpp +++ b/src/input_output/ply/rply_interface.cpp @@ -1,29 +1,35 @@ -/* - * This file is part of FastVoxel. - * - * FastVoxel is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * FastVoxel is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with FastVoxel. If not, see . - * FastVoxel is a voxelisation library of polygonal 3d model and do volumes identifications. - * It is dedicated to finite element solvers - * @author Nicolas Fortin - * This project is the production of IFSTTAR (www.ifsttar.fr) - * @copyright GNU Public License.V3 - * Official repository is https://github.com/nicolas-f/FastVoxel - */ +/* ---------------------------------------------------------------------- +* I-SIMPA (http://i-simpa.ifsttar.fr). This file is part of I-SIMPA. +* +* I-SIMPA is a GUI for 3D numerical sound propagation modelling dedicated +* to scientific acoustic simulations. +* Copyright (C) 2007-2014 - IFSTTAR - Judicael Picaut, Nicolas Fortin +* +* I-SIMPA is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 3 of the License, or +* (at your option) any later version. +* +* I-SIMPA is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software Foundation, +* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or +* see +* +* For more information, please consult: or +* send an email to i-simpa@ifsttar.fr +* +* To contact Ifsttar, write to Ifsttar, 14-20 Boulevard Newton +* Cite Descartes, Champs sur Marne F-77447 Marne la Vallee Cedex 2 FRANCE +* or write to scientific.computing@ifsttar.fr +* ----------------------------------------------------------------------*/ #include "rply_interface.hpp" #include "rply.h" -#include "en_numeric.hpp" namespace formatRPLY { @@ -31,7 +37,7 @@ namespace formatRPLY { parsing_instance(t_model& _currentModel):currentModel(_currentModel),lastFaceSplited(false) {} t_model& currentModel; - bool lastFaceSplited; /*!< La dernière face avait 4 sommets et a été éclaté en deux triangles */ + bool lastFaceSplited; /*!< La derni�re face avait 4 sommets et a �t� �clat� en deux triangles */ }; @@ -63,20 +69,30 @@ namespace formatRPLY parsing_instance* curInstance((parsing_instance*)ptr); t_model* model=&(curInstance->currentModel); switch (idvert) { + case -1: + // This is the vertex count + // int vCount = (int)ply_get_argument_value(argument); + break; case 0: curInstance->lastFaceSplited=false; model->modelFaces.push_back(t_face(ivec3((int)ply_get_argument_value(argument),0,0))); break; case 1: case 2: - model->modelFaces.back().indicesSommets[idvert]=(int)ply_get_argument_value(argument); - break; - case 3: - //Polygone à quatre sommets - const ivec3& lastTri(model->modelFaces.back().indicesSommets); - model->modelFaces.push_back(t_face(ivec3(lastTri[0],lastTri[2],(int)ply_get_argument_value(argument)))); - curInstance->lastFaceSplited=true; + model->modelFaces.back().indicesSommets.set((int) idvert, (long) ply_get_argument_value(argument)); break; + case 3: { + // Polygon with 4 vertices + // Push an additional triangle + const ivec3 &lastTri(model->modelFaces.back().indicesSommets); + model->modelFaces.push_back( + t_face(ivec3(lastTri.i[0], lastTri.i[2], (int) ply_get_argument_value(argument)))); + curInstance->lastFaceSplited = true; + break; + } + default: + // unhandled case for the moment + fprintf(stderr, "Unhandled polygon with %li vertices\n", idvert); } return 1; } @@ -85,9 +101,9 @@ namespace formatRPLY ply_get_argument_user_data(argument, &ptr, NULL); parsing_instance* curInstance((parsing_instance*)ptr); t_model* model=&(curInstance->currentModel); - model->modelFacesLayerIndex.push_back((int)ply_get_argument_value(argument)); + model->modelFacesLayerIndex.push_back((std::size_t) ply_get_argument_value(argument)); if(curInstance->lastFaceSplited) - model->modelFacesLayerIndex.push_back((int)ply_get_argument_value(argument)); + model->modelFacesLayerIndex.push_back((std::size_t) ply_get_argument_value(argument)); return 1; } @@ -100,10 +116,10 @@ namespace formatRPLY t_model* model=&(curInstance->currentModel); if(idchar==-1) { - std::size_t sizeOfString((int)ply_get_argument_value(argument)); + std::size_t sizeOfString((std::size_t) ply_get_argument_value(argument)); model->modelLayers.push_back(std::string(sizeOfString,' ')); }else{ - model->modelLayers.back().layerName.replace(idchar,1,1,(unsigned char)ply_get_argument_value(argument)); + model->modelLayers.back().layerName.replace((std::size_t) idchar, 1, 1, (unsigned char)ply_get_argument_value(argument)); } return 1; } @@ -127,11 +143,9 @@ namespace formatRPLY bool CPly::ImportPly(t_model& sceneconst, std::string mfilename) { - EnglishTemporaryLocale dotNumericOnly; - sceneconst.modelFaces.clear(); sceneconst.modelVertices.clear(); - p_ply plyFile=ply_open(mfilename.c_str(),NULL); + p_ply plyFile=ply_open(mfilename.c_str(),NULL, 0, NULL); if(!plyFile) return false; CloseHandle plyCloseObj(plyFile); @@ -158,9 +172,8 @@ namespace formatRPLY bool CPly::ExportPly(t_model& scene, std::string mfilename) { - EnglishTemporaryLocale dotNumericOnly; p_ply oply; - oply = ply_create(mfilename.c_str(), PLY_BIG_ENDIAN, NULL); + oply = ply_create(mfilename.c_str(), PLY_BIG_ENDIAN, NULL, 0, NULL); if (!oply) return false; CloseHandle plyCloseObj(oply); std::size_t faceCount(scene.modelFaces.size()); diff --git a/src/input_output/ply/rply_interface.hpp b/src/input_output/ply/rply_interface.hpp index a5d2f51..3136961 100644 --- a/src/input_output/ply/rply_interface.hpp +++ b/src/input_output/ply/rply_interface.hpp @@ -1,23 +1,32 @@ -/* - * This file is part of FastVoxel. - * - * FastVoxel is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * FastVoxel is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with FastVoxel. If not, see . - * FastVoxel is a voxelisation library of polygonal 3d model and do volumes identifications. - * It is dedicated to finite element solvers - * @author Nicolas Fortin , Judicaël Picaut judicael.picaut (home) ifsttar.fr - * Official repository is https://github.com/nicolas-f/FastVoxel - */ +/* ---------------------------------------------------------------------- +* I-SIMPA (http://i-simpa.ifsttar.fr). This file is part of I-SIMPA. +* +* I-SIMPA is a GUI for 3D numerical sound propagation modelling dedicated +* to scientific acoustic simulations. +* Copyright (C) 2007-2014 - IFSTTAR - Judicael Picaut, Nicolas Fortin +* +* I-SIMPA is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 3 of the License, or +* (at your option) any later version. +* +* I-SIMPA is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software Foundation, +* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or +* see +* +* For more information, please consult: or +* send an email to i-simpa@ifsttar.fr +* +* To contact Ifsttar, write to Ifsttar, 14-20 Boulevard Newton +* Cite Descartes, Champs sur Marne F-77447 Marne la Vallee Cedex 2 FRANCE +* or write to scientific.computing@ifsttar.fr +* ----------------------------------------------------------------------*/ /*! \file ply.h diff --git a/src/std_tools.cpp b/src/std_tools.cpp index ea33151..d8a5b14 100644 --- a/src/std_tools.cpp +++ b/src/std_tools.cpp @@ -1,52 +1,42 @@ -/* - * This file is part of FastVoxel. - * - * FastVoxel is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * FastVoxel is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with FastVoxel. If not, see . - * FastVoxel is a voxelisation library of polygonal 3d model and do volumes identifications. - * It is dedicated to finite element solvers - * @author Nicolas Fortin - * This project is the production of IFSTTAR (www.ifsttar.fr) - * @copyright GNU Public License.V3 - * Official repository is https://github.com/nicolas-f/FastVoxel - */ +/* ---------------------------------------------------------------------- +* I-SIMPA (http://i-simpa.ifsttar.fr). This file is part of I-SIMPA. +* +* I-SIMPA is a GUI for 3D numerical sound propagation modelling dedicated +* to scientific acoustic simulations. +* Copyright (C) 2007-2014 - IFSTTAR - Judicael Picaut, Nicolas Fortin +* +* I-SIMPA is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 3 of the License, or +* (at your option) any later version. +* +* I-SIMPA is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software Foundation, +* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or +* see +* +* For more information, please consult: or +* send an email to i-simpa@ifsttar.fr +* +* To contact Ifsttar, write to Ifsttar, 14-20 Boulevard Newton +* Cite Descartes, Champs sur Marne F-77447 Marne la Vallee Cedex 2 FRANCE +* or write to scientific.computing@ifsttar.fr +* ----------------------------------------------------------------------*/ + #include "std_tools.hpp" #include #include -#ifdef _WIN32 - #include -#endif -#ifdef _UNIX - #include - #include -#endif - -int st_mkdir(const char* pathname, int perm) -{ - #ifdef _WIN32 - return mkdir(pathname); - #endif - #ifdef _UNIX - return mkdir(pathname,perm); - #endif -} - bool st_isfinite(const float& value) { #ifdef _MSC_VER return _finite(value); #else - return isfinite(value); + return std::isfinite(value); #endif } diff --git a/src/std_tools.hpp b/src/std_tools.hpp index bba0279..6068a27 100644 --- a/src/std_tools.hpp +++ b/src/std_tools.hpp @@ -1,23 +1,33 @@ -/* - * This file is part of FastVoxel. - * - * FastVoxel is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * FastVoxel is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with FastVoxel. If not, see . - * FastVoxel is a voxelisation library of polygonal 3d model and do volumes identifications. - * It is dedicated to finite element solvers - * @author Nicolas Fortin , Judicaël Picaut judicael.picaut (home) ifsttar.fr - * Official repository is https://github.com/nicolas-f/FastVoxel - */ +/* ---------------------------------------------------------------------- +* I-SIMPA (http://i-simpa.ifsttar.fr). This file is part of I-SIMPA. +* +* I-SIMPA is a GUI for 3D numerical sound propagation modelling dedicated +* to scientific acoustic simulations. +* Copyright (C) 2007-2014 - IFSTTAR - Judicael Picaut, Nicolas Fortin +* +* I-SIMPA is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 3 of the License, or +* (at your option) any later version. +* +* I-SIMPA is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software Foundation, +* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or +* see +* +* For more information, please consult: or +* send an email to i-simpa@ifsttar.fr +* +* To contact Ifsttar, write to Ifsttar, 14-20 Boulevard Newton +* Cite Descartes, Champs sur Marne F-77447 Marne la Vallee Cedex 2 FRANCE +* or write to scientific.computing@ifsttar.fr +* ----------------------------------------------------------------------*/ + /** * Multiplatform tools */ @@ -26,8 +36,8 @@ #ifndef _ST_TOOLS_H_ #define _ST_TOOLS_H_ -int st_mkdir(const char* pathname, int perm = 777); -bool st_isfinite(const float& value); +#include +bool st_isfinite(const float& value); #endif