Skip to content

Commit fa0c2d8

Browse files
committed
all: fix crash caused by paths containing '//' on linux #97 and #105
mesh: improve speed weighting
1 parent 019e9d6 commit fa0c2d8

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

libs/Common/Types.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ typedef signed int INT;
234234
typedef unsigned int UINT;
235235
typedef long LONG;
236236

237-
typedef LONG HRESULT;
237+
typedef int32_t HRESULT;
238238

239239
typedef CHAR* LPSTR;
240240
typedef const CHAR* LPCSTR;

libs/Common/Util.h

+11-1
Original file line numberDiff line numberDiff line change
@@ -260,12 +260,22 @@ class GENERAL_API Util
260260
#endif // _MSC_VER
261261
}
262262

263+
static String& trimUnifySlash(String& aFile)
264+
{
265+
String::size_type start = 1;
266+
while ((start = aFile.find(PATH_SEPARATOR, start)) != String::npos)
267+
if (aFile[start-1] == PATH_SEPARATOR)
268+
aFile.erase(start, 1);
269+
else
270+
++start;
271+
return aFile;
272+
}
263273
static String& ensureUnifySlash(String& aFile)
264274
{
265275
String::size_type start = 0;
266276
while ((start = aFile.find(REVERSE_PATH_SEPARATOR, start)) != String::npos)
267277
aFile[start] = PATH_SEPARATOR;
268-
return aFile;
278+
return trimUnifySlash(aFile);
269279
}
270280
static String& ensureUnifyReverseSlash(String& aFile)
271281
{

libs/MVS/SceneReconstruct.cpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -334,13 +334,12 @@ inline int orientation(const point_t& a, const point_t& b, const point_t& c, con
334334
const double& qx = b.x(); const double& qy = b.y(); const double& qz = b.z();
335335
const double& rx = c.x(); const double& ry = c.y(); const double& rz = c.z();
336336
const double& sx = p.x(); const double& sy = p.y(); const double& sz = p.z();
337-
#if 0
337+
#if 1
338338
const double det(CGAL::determinant(
339339
qx - px, qy - py, qz - pz,
340340
rx - px, ry - py, rz - pz,
341341
sx - px, sy - py, sz - pz));
342-
if (det > 0) return CGAL::POSITIVE;
343-
if (det < 0) return CGAL::NEGATIVE;
342+
const double eps(1e-12);
344343
#else
345344
const double pqx(qx - px);
346345
const double pqy(qy - py);
@@ -358,9 +357,9 @@ inline int orientation(const point_t& a, const point_t& b, const point_t& c, con
358357
const double max0(MAXF3(ABS(pqx), ABS(pqy), ABS(pqz)));
359358
const double max1(MAXF3(ABS(prx), ABS(pry), ABS(prz)));
360359
const double eps(5.1107127829973299e-15 * MAXF(max0, max1));
360+
#endif
361361
if (det > eps) return CGAL::POSITIVE;
362362
if (det < -eps) return CGAL::NEGATIVE;
363-
#endif
364363
return CGAL::COPLANAR;
365364
#endif
366365
}

0 commit comments

Comments
 (0)