Mercurial > hg > orthanc-stone
comparison 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 |
comparison
equal
deleted
inserted
replaced
1647:adff3cd78775 | 1648:4a43106bc122 |
---|---|
885 OrthancStone::CoordinateSystem3D c; | 885 OrthancStone::CoordinateSystem3D c; |
886 ASSERT_FALSE(c.IsValid()); | 886 ASSERT_FALSE(c.IsValid()); |
887 ASSERT_FLOAT_EQ(c.GetNormal()[0], 0); | 887 ASSERT_FLOAT_EQ(c.GetNormal()[0], 0); |
888 ASSERT_FLOAT_EQ(c.GetNormal()[1], 0); | 888 ASSERT_FLOAT_EQ(c.GetNormal()[1], 0); |
889 ASSERT_FLOAT_EQ(c.GetNormal()[2], 1); | 889 ASSERT_FLOAT_EQ(c.GetNormal()[2], 1); |
890 | |
891 ASSERT_FLOAT_EQ(0, c.ComputeDistance(OrthancStone::LinearAlgebra::CreateVector(0, 0, 0))); | |
892 ASSERT_FLOAT_EQ(0, c.ComputeDistance(OrthancStone::LinearAlgebra::CreateVector(5, 0, 0))); | |
893 ASSERT_FLOAT_EQ(0, c.ComputeDistance(OrthancStone::LinearAlgebra::CreateVector(0, 5, 0))); | |
894 ASSERT_FLOAT_EQ(5, c.ComputeDistance(OrthancStone::LinearAlgebra::CreateVector(0, 0, 5))); | |
890 } | 895 } |
891 | 896 |
892 { | 897 { |
893 OrthancStone::CoordinateSystem3D c("nope1", "nope2"); | 898 OrthancStone::CoordinateSystem3D c("nope1", "nope2"); |
894 ASSERT_FALSE(c.IsValid()); | 899 ASSERT_FALSE(c.IsValid()); |
895 ASSERT_FLOAT_EQ(c.GetNormal()[0], 0); | 900 ASSERT_FLOAT_EQ(c.GetNormal()[0], 0); |
896 ASSERT_FLOAT_EQ(c.GetNormal()[1], 0); | 901 ASSERT_FLOAT_EQ(c.GetNormal()[1], 0); |
897 ASSERT_FLOAT_EQ(c.GetNormal()[2], 1); | 902 ASSERT_FLOAT_EQ(c.GetNormal()[2], 1); |
898 } | 903 } |
904 | |
905 { | |
906 // https://www.vedantu.com/maths/perpendicular-distance-of-a-point-from-a-plane | |
907 OrthancStone::CoordinateSystem3D c = | |
908 OrthancStone::CoordinateSystem3D::CreateFromPlaneGeneralForm(2, 4, -4, -6); | |
909 ASSERT_FLOAT_EQ(3, c.ComputeDistance(OrthancStone::LinearAlgebra::CreateVector(0, 3, 6))); | |
910 } | |
899 } | 911 } |
900 | 912 |
901 | 913 |
902 int main(int argc, char **argv) | 914 int main(int argc, char **argv) |
903 { | 915 { |