From d4ca91f408a3e8e10de029cfb8bc9bad7a72d155 Mon Sep 17 00:00:00 2001 From: Hanif Bin Ariffin Date: Thu, 28 May 2020 19:20:54 -0400 Subject: [PATCH 1/3] Evaluated the following expressions to either values. --- contrib/Open3DGC/o3dgcSC3DMCDecoder.inl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/contrib/Open3DGC/o3dgcSC3DMCDecoder.inl b/contrib/Open3DGC/o3dgcSC3DMCDecoder.inl index 326297426..c965fcd50 100644 --- a/contrib/Open3DGC/o3dgcSC3DMCDecoder.inl +++ b/contrib/Open3DGC/o3dgcSC3DMCDecoder.inl @@ -72,9 +72,12 @@ namespace o3dgc unsigned char mask = bstream.ReadUChar(m_iterator, m_streamType); ifs.SetCCW ((mask & 1) == 1); - ifs.SetSolid ((mask & 2) == 1); - ifs.SetConvex ((mask & 4) == 1); - ifs.SetIsTriangularMesh((mask & 8) == 1); + // (mask & 2) == 1 + ifs.SetSolid (false); + // (mask & 4) == 1 + ifs.SetConvex (false); + // (mask & 8) == 1 + ifs.SetIsTriangularMesh(false); //bool markerBit0 = (mask & 16 ) == 1; //bool markerBit1 = (mask & 32 ) == 1; //bool markerBit2 = (mask & 64 ) == 1; From eceb8aeed1b8fdef84cf98ddc2618dc24bdf0604 Mon Sep 17 00:00:00 2001 From: Hanif Bin Ariffin Date: Thu, 28 May 2020 19:22:06 -0400 Subject: [PATCH 2/3] Cleaned up implicit conversion and code. --- test/unit/utMatrix3x3.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/test/unit/utMatrix3x3.cpp b/test/unit/utMatrix3x3.cpp index 50fa66c50..12a84e0fa 100644 --- a/test/unit/utMatrix3x3.cpp +++ b/test/unit/utMatrix3x3.cpp @@ -73,9 +73,21 @@ TEST_F(utMatrix3x3Test, FromToMatrixTest) { aiVector3D from, to; + auto random_ratio = []() -> float { + return static_cast(rand() / RAND_MAX); + }; + for (int i = 0; i < NUM_SAMPLES; ++i) { - from = aiVector3D(1.f * rand() / RAND_MAX, 1.f * rand() / RAND_MAX, 1.f * rand() / RAND_MAX).Normalize(); - to = aiVector3D(1.f * rand() / RAND_MAX, 1.f * rand() / RAND_MAX, 1.f * rand() / RAND_MAX).Normalize(); + from = aiVector3D( + 1.f * random_ratio(), + 1.f * random_ratio(), + 1.f * random_ratio()) + .Normalize(); + to = aiVector3D( + 1.f * random_ratio(), + 1.f * random_ratio(), + 1.f * random_ratio()) + .Normalize(); aiMatrix3x3::FromToMatrix(from, to, trafo); res = trafo * from; From 7db6475592ef1c0d34227c2a7c682c3d4a63cac2 Mon Sep 17 00:00:00 2001 From: Hanif Bin Ariffin Date: Fri, 29 May 2020 11:59:28 -0400 Subject: [PATCH 3/3] Change from (int division -> cast) to (cast -> float division) --- test/unit/utMatrix3x3.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/utMatrix3x3.cpp b/test/unit/utMatrix3x3.cpp index 12a84e0fa..3905b1d35 100644 --- a/test/unit/utMatrix3x3.cpp +++ b/test/unit/utMatrix3x3.cpp @@ -74,7 +74,7 @@ TEST_F(utMatrix3x3Test, FromToMatrixTest) { aiVector3D from, to; auto random_ratio = []() -> float { - return static_cast(rand() / RAND_MAX); + return static_cast(rand()) / static_cast(RAND_MAX); }; for (int i = 0; i < NUM_SAMPLES; ++i) {