Mercurial > hg > orthanc-stone
diff UnitTestsSources/UnitTestsMain.cpp @ 1648:4a43106bc122
cross-hair starts to work
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 12 Nov 2020 19:27:08 +0100 |
parents | 78509230f0d7 |
children | af312e145980 |
line wrap: on
line diff
--- a/UnitTestsSources/UnitTestsMain.cpp Thu Nov 12 16:57:15 2020 +0100 +++ b/UnitTestsSources/UnitTestsMain.cpp Thu Nov 12 19:27:08 2020 +0100 @@ -887,6 +887,11 @@ ASSERT_FLOAT_EQ(c.GetNormal()[0], 0); ASSERT_FLOAT_EQ(c.GetNormal()[1], 0); ASSERT_FLOAT_EQ(c.GetNormal()[2], 1); + + ASSERT_FLOAT_EQ(0, c.ComputeDistance(OrthancStone::LinearAlgebra::CreateVector(0, 0, 0))); + ASSERT_FLOAT_EQ(0, c.ComputeDistance(OrthancStone::LinearAlgebra::CreateVector(5, 0, 0))); + ASSERT_FLOAT_EQ(0, c.ComputeDistance(OrthancStone::LinearAlgebra::CreateVector(0, 5, 0))); + ASSERT_FLOAT_EQ(5, c.ComputeDistance(OrthancStone::LinearAlgebra::CreateVector(0, 0, 5))); } { @@ -896,6 +901,13 @@ ASSERT_FLOAT_EQ(c.GetNormal()[1], 0); ASSERT_FLOAT_EQ(c.GetNormal()[2], 1); } + + { + // https://www.vedantu.com/maths/perpendicular-distance-of-a-point-from-a-plane + OrthancStone::CoordinateSystem3D c = + OrthancStone::CoordinateSystem3D::CreateFromPlaneGeneralForm(2, 4, -4, -6); + ASSERT_FLOAT_EQ(3, c.ComputeDistance(OrthancStone::LinearAlgebra::CreateVector(0, 3, 6))); + } }