- Timestamp:
- Sep 14, 2016, 7:02:33 AM (9 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_StructOpt_integration_tests, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, GeometryObjects, Gui_displays_atomic_force_velocity, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, Ubuntu_1604_changes, stable
- Children:
- 1af2ae
- Parents:
- 36bd59
- git-author:
- Frederik Heber <heber@…> (07/12/14 19:07:44)
- git-committer:
- Frederik Heber <heber@…> (09/14/16 07:02:33)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Fragmentation/Exporters/unittests/SphericalPointDistributionUnitTest.cpp
r36bd59 rfe90ab 736 736 } 737 737 738 /** UnitTest for matchSphericalPointDistributions() with two points739 */ 740 void SphericalPointDistributionTest:: matchSphericalPointDistributionsTest_2()738 /** UnitTest for getRemainingPoints() with two points 739 */ 740 void SphericalPointDistributionTest::getRemainingPointsTest_2() 741 741 { 742 742 SphericalPointDistribution SPD(1.); … … 745 745 SphericalPointDistribution::WeightedPolygon_t polygon; 746 746 polygon += std::make_pair(Vector(1.,0.,0.), 1); 747 SphericalPointDistribution::Polygon_t newpolygon =748 SPD.get<2>();749 747 SphericalPointDistribution::Polygon_t expected; 750 748 expected += Vector(-1.,0.,0.); 751 749 SphericalPointDistribution::Polygon_t remaining = 752 SphericalPointDistribution::matchSphericalPointDistributions( 753 polygon, 754 newpolygon); 750 SPD.getRemainingPoints(polygon, 2); 755 751 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 756 752 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); … … 761 757 SphericalPointDistribution::WeightedPolygon_t polygon; 762 758 polygon += std::make_pair( Vector(0.,1.,0.), 1); 763 SphericalPointDistribution::Polygon_t newpolygon =764 SPD.get<2>();765 759 SphericalPointDistribution::Polygon_t expected; 766 760 expected += Vector(0.,-1.,0.); 767 761 SphericalPointDistribution::Polygon_t remaining = 768 SphericalPointDistribution::matchSphericalPointDistributions( 769 polygon, 770 newpolygon); 762 SPD.getRemainingPoints(polygon, 2); 771 763 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 772 764 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); … … 777 769 SphericalPointDistribution::WeightedPolygon_t polygon; 778 770 polygon += std::make_pair( Vector(0.,0.,-1.), 1); 779 SphericalPointDistribution::Polygon_t newpolygon =780 SPD.get<2>();781 771 SphericalPointDistribution::Polygon_t expected; 782 772 expected += Vector(0.,0.,1.); 783 773 SphericalPointDistribution::Polygon_t remaining = 784 SphericalPointDistribution::matchSphericalPointDistributions( 785 polygon, 786 newpolygon); 774 SPD.getRemainingPoints(polygon, 2); 787 775 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 788 776 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); … … 794 782 SphericalPointDistribution::WeightedPolygon_t polygon; 795 783 polygon += std::make_pair(RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180*M_PI), 1); 796 SphericalPointDistribution::Polygon_t newpolygon =797 SPD.get<2>();798 784 SphericalPointDistribution::Polygon_t expected; 799 785 expected += RotationAxis.rotateVector(Vector(-1.,0.,0.), 47.6/180*M_PI); 800 786 SphericalPointDistribution::Polygon_t remaining = 801 SphericalPointDistribution::matchSphericalPointDistributions( 802 polygon, 803 newpolygon); 804 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 805 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); 806 } 807 } 808 809 /** UnitTest for matchSphericalPointDistributions() with three points 810 */ 811 void SphericalPointDistributionTest::matchSphericalPointDistributionsTest_3() 787 SPD.getRemainingPoints(polygon, 2); 788 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 789 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); 790 } 791 } 792 793 /** UnitTest for getRemainingPoints() with three points 794 */ 795 void SphericalPointDistributionTest::getRemainingPointsTest_3() 812 796 { 813 797 SphericalPointDistribution SPD(1.); … … 817 801 SphericalPointDistribution::WeightedPolygon_t polygon; 818 802 polygon += std::make_pair( Vector(1.,0.,0.), 1); 819 SphericalPointDistribution::Polygon_t newpolygon=803 SphericalPointDistribution::Polygon_t expected = 820 804 SPD.get<3>(); 821 SphericalPointDistribution::Polygon_t expected = newpolygon; 822 expected.pop_front(); // remove first point 823 SphericalPointDistribution::Polygon_t remaining = 824 SphericalPointDistribution::matchSphericalPointDistributions( 825 polygon, 826 newpolygon); 805 expected.pop_front(); // remove first point 806 SphericalPointDistribution::Polygon_t remaining = 807 SPD.getRemainingPoints(polygon, 3); 827 808 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 828 809 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); … … 833 814 SphericalPointDistribution::WeightedPolygon_t polygon; 834 815 polygon += std::make_pair( Vector(0.,1.,0.), 1); 835 SphericalPointDistribution::Polygon_t newpolygon=816 SphericalPointDistribution::Polygon_t expected = 836 817 SPD.get<3>(); 837 SphericalPointDistribution::Polygon_t expected = newpolygon;838 818 expected.pop_front(); // remove first point 839 819 for (SphericalPointDistribution::Polygon_t::iterator iter = expected.begin(); … … 843 823 } 844 824 SphericalPointDistribution::Polygon_t remaining = 845 SphericalPointDistribution::matchSphericalPointDistributions( 846 polygon, 847 newpolygon); 825 SPD.getRemainingPoints(polygon, 3); 848 826 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 849 827 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); … … 855 833 polygon += std::make_pair( Vector(1.,0.,0.), 1); 856 834 polygon += std::make_pair( Vector(-0.5, sqrt(3)*0.5,0.), 1); 857 SphericalPointDistribution::Polygon_t newpolygon=835 SphericalPointDistribution::Polygon_t expected = 858 836 SPD.get<3>(); 859 SphericalPointDistribution::Polygon_t expected = newpolygon; 860 expected.pop_front(); // remove first point 861 expected.pop_front(); // remove second point 862 SphericalPointDistribution::Polygon_t remaining = 863 SphericalPointDistribution::matchSphericalPointDistributions( 864 polygon, 865 newpolygon); 837 expected.pop_front(); // remove first point 838 expected.pop_front(); // remove second point 839 SphericalPointDistribution::Polygon_t remaining = 840 SPD.getRemainingPoints(polygon, 3); 866 841 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 867 842 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); … … 878 853 polygon += std::make_pair(RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180*M_PI), 1); 879 854 polygon += std::make_pair(RotationAxis.rotateVector(Vector(-0.5, sqrt(3)*0.5,0.), 47.6/180*M_PI), 1); 880 SphericalPointDistribution::Polygon_t newpolygon=855 SphericalPointDistribution::Polygon_t expected = 881 856 SPD.get<3>(); 882 SphericalPointDistribution::Polygon_t expected = newpolygon;883 857 expected.pop_front(); // remove first point 884 858 expected.pop_front(); // remove second point … … 887 861 *iter = RotationAxis.rotateVector(*iter, 47.6/180*M_PI); 888 862 SphericalPointDistribution::Polygon_t remaining = 889 SphericalPointDistribution::matchSphericalPointDistributions( 890 polygon, 891 newpolygon); 863 SPD.getRemainingPoints(polygon, 3); 892 864 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 893 865 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); … … 908 880 SphericalPointDistribution::Polygon_t expected; // empty cause none are vacant 909 881 SphericalPointDistribution::Polygon_t remaining = 910 SphericalPointDistribution::matchSphericalPointDistributions( 911 polygon, 912 newpolygon); 882 SPD.getRemainingPoints(polygon, 3); 913 883 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 914 884 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); … … 931 901 SphericalPointDistribution::Polygon_t expected; // empty cause none are vacant 932 902 SphericalPointDistribution::Polygon_t remaining = 933 SphericalPointDistribution::matchSphericalPointDistributions( 934 polygon, 935 newpolygon); 936 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 937 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); 938 // also slightly perturbed 939 const double amplitude = 0.05; 940 perturbPolygon(polygon, amplitude); 941 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, amplitude) ); 942 } 943 } 944 945 /** UnitTest for matchSphericalPointDistributions() with four points 946 */ 947 void SphericalPointDistributionTest::matchSphericalPointDistributionsTest_4() 903 SPD.getRemainingPoints(polygon, 3); 904 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 905 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); 906 // also slightly perturbed 907 const double amplitude = 0.05; 908 perturbPolygon(polygon, amplitude); 909 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, amplitude) ); 910 } 911 } 912 913 /** UnitTest for getRemainingPoints() with four points 914 */ 915 void SphericalPointDistributionTest::getRemainingPointsTest_4() 948 916 { 949 917 SphericalPointDistribution SPD(1.); … … 953 921 SphericalPointDistribution::WeightedPolygon_t polygon; 954 922 polygon += std::make_pair( Vector(1.,0.,0.), 1); 955 SphericalPointDistribution::Polygon_t newpolygon=923 SphericalPointDistribution::Polygon_t expected = 956 924 SPD.get<4>(); 957 SphericalPointDistribution::Polygon_t expected = newpolygon; 958 expected.pop_front(); // remove first point 959 SphericalPointDistribution::Polygon_t remaining = 960 SphericalPointDistribution::matchSphericalPointDistributions( 961 polygon, 962 newpolygon); 925 expected.pop_front(); // remove first point 926 SphericalPointDistribution::Polygon_t remaining = 927 SPD.getRemainingPoints(polygon, 4); 963 928 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 964 929 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); … … 969 934 SphericalPointDistribution::WeightedPolygon_t polygon; 970 935 polygon += std::make_pair( Vector(0.,1.,0.), 1); 971 SphericalPointDistribution::Polygon_t newpolygon=936 SphericalPointDistribution::Polygon_t expected = 972 937 SPD.get<4>(); 973 SphericalPointDistribution::Polygon_t expected = newpolygon;974 938 expected.pop_front(); // remove first point 975 939 for (SphericalPointDistribution::Polygon_t::iterator iter = expected.begin(); … … 979 943 } 980 944 SphericalPointDistribution::Polygon_t remaining = 981 SphericalPointDistribution::matchSphericalPointDistributions( 982 polygon, 983 newpolygon); 945 SPD.getRemainingPoints(polygon, 4); 984 946 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 985 947 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); … … 991 953 polygon += std::make_pair( Vector(1.,0.,0.), 1); 992 954 polygon += std::make_pair( Vector(-1./3.0, 2.0*M_SQRT2/3.0,0.), 1); 993 SphericalPointDistribution::Polygon_t newpolygon=955 SphericalPointDistribution::Polygon_t expected = 994 956 SPD.get<4>(); 995 SphericalPointDistribution::Polygon_t expected = newpolygon; 996 expected.pop_front(); // remove first point 997 expected.pop_front(); // remove second point 998 SphericalPointDistribution::Polygon_t remaining = 999 SphericalPointDistribution::matchSphericalPointDistributions( 1000 polygon, 1001 newpolygon); 957 expected.pop_front(); // remove first point 958 expected.pop_front(); // remove second point 959 SphericalPointDistribution::Polygon_t remaining = 960 SPD.getRemainingPoints(polygon, 4); 1002 961 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 1003 962 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); … … 1013 972 polygon += std::make_pair( Vector(1.,0.,0.), 1); 1014 973 polygon += std::make_pair( Vector(-1./3.0, 2.0*M_SQRT2/3.0,0.), 1); 1015 SphericalPointDistribution::Polygon_t newpolygon=974 SphericalPointDistribution::Polygon_t expected = 1016 975 SPD.get<4>(); 1017 SphericalPointDistribution::Polygon_t expected = newpolygon; 1018 expected.pop_front(); // remove first point 1019 expected.pop_front(); // remove second point 1020 SphericalPointDistribution::Polygon_t remaining = 1021 SphericalPointDistribution::matchSphericalPointDistributions( 1022 polygon, 1023 newpolygon); 976 expected.pop_front(); // remove first point 977 expected.pop_front(); // remove second point 978 SphericalPointDistribution::Polygon_t remaining = 979 SPD.getRemainingPoints(polygon, 4); 1024 980 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 1025 981 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); … … 1036 992 polygon += std::make_pair(RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180*M_PI), 1); 1037 993 polygon += std::make_pair(RotationAxis.rotateVector(Vector(-1./3.0, 2.0*M_SQRT2/3.0,0.), 47.6/180*M_PI), 1); 1038 SphericalPointDistribution::Polygon_t newpolygon=994 SphericalPointDistribution::Polygon_t expected = 1039 995 SPD.get<4>(); 1040 SphericalPointDistribution::Polygon_t expected = newpolygon;1041 996 expected.pop_front(); // remove first point 1042 997 expected.pop_front(); // remove second point … … 1045 1000 *iter = RotationAxis.rotateVector(*iter, 47.6/180*M_PI); 1046 1001 SphericalPointDistribution::Polygon_t remaining = 1047 SphericalPointDistribution::matchSphericalPointDistributions( 1048 polygon, 1049 newpolygon); 1002 SPD.getRemainingPoints(polygon, 4); 1050 1003 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 1051 1004 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); … … 1062 1015 polygon += std::make_pair( Vector(-1./3.0, 2.0*M_SQRT2/3.0,0.), 1); 1063 1016 polygon += std::make_pair( Vector(-1./3.0, -M_SQRT2/3.0, M_SQRT2/sqrt(3)), 1); 1064 SphericalPointDistribution::Polygon_t newpolygon=1017 SphericalPointDistribution::Polygon_t expected = 1065 1018 SPD.get<4>(); 1066 SphericalPointDistribution::Polygon_t expected = newpolygon;1067 1019 expected.pop_front(); // remove first point 1068 1020 expected.pop_front(); // remove second point 1069 1021 expected.pop_front(); // remove third point 1070 1022 SphericalPointDistribution::Polygon_t remaining = 1071 SphericalPointDistribution::matchSphericalPointDistributions( 1072 polygon, 1073 newpolygon); 1023 SPD.getRemainingPoints(polygon, 4); 1074 1024 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 1075 1025 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); … … 1087 1037 polygon += std::make_pair(RotationAxis.rotateVector(Vector(-1./3.0, 2.0*M_SQRT2/3.0,0.), 47.6/180*M_PI), 1); 1088 1038 polygon += std::make_pair(RotationAxis.rotateVector(Vector(-1./3.0, -M_SQRT2/3.0, M_SQRT2/sqrt(3)), 47.6/180*M_PI), 1); 1089 SphericalPointDistribution::Polygon_t newpolygon=1039 SphericalPointDistribution::Polygon_t expected = 1090 1040 SPD.get<4>(); 1091 SphericalPointDistribution::Polygon_t expected = newpolygon;1092 1041 expected.pop_front(); // remove first point 1093 1042 expected.pop_front(); // remove second point … … 1097 1046 *iter = RotationAxis.rotateVector(*iter, 47.6/180*M_PI); 1098 1047 SphericalPointDistribution::Polygon_t remaining = 1099 SphericalPointDistribution::matchSphericalPointDistributions( 1100 polygon, 1101 newpolygon); 1102 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 1103 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); 1104 // also slightly perturbed 1105 const double amplitude = 0.05; 1106 perturbPolygon(polygon, amplitude); 1107 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, amplitude) ); 1108 } 1109 } 1110 1111 /** UnitTest for matchSphericalPointDistributions() with four points and weights 1048 SPD.getRemainingPoints(polygon, 4); 1049 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 1050 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); 1051 // also slightly perturbed 1052 const double amplitude = 0.05; 1053 perturbPolygon(polygon, amplitude); 1054 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, amplitude) ); 1055 } 1056 } 1057 1058 /** UnitTest for getRemainingPoints() with four points and weights 1112 1059 * not all equal to one. 1113 1060 */ 1114 void SphericalPointDistributionTest:: matchSphericalPointDistributionsTest_multiple()1061 void SphericalPointDistributionTest::getRemainingPointsTest_multiple() 1115 1062 { 1116 1063 SphericalPointDistribution SPD(1.); … … 1126 1073 expected += Vector(-0.5773502691896,-5.551115123126e-17,-0.8164965809277); 1127 1074 SphericalPointDistribution::Polygon_t remaining = 1128 SphericalPointDistribution::matchSphericalPointDistributions( 1129 polygon, 1130 newpolygon); 1075 SPD.getRemainingPoints(polygon, 4); 1131 1076 // std::cout << std::setprecision(13) << "Matched polygon is " << remaining << std::endl; 1132 1077 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); … … 1145 1090 expected += Vector(-0.3535533905933,-0.3535533905933,-0.8660254037844); 1146 1091 SphericalPointDistribution::Polygon_t remaining = 1147 SphericalPointDistribution::matchSphericalPointDistributions( 1148 polygon, 1149 newpolygon); 1150 // std::cout << std::setprecision(13) << "Matched polygon is " << remaining << std::endl; 1092 SPD.getRemainingPoints(polygon, 5); 1093 std::cout << std::setprecision(13) << "Matched polygon is " << remaining << std::endl; 1151 1094 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 1152 1095 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); … … 1165 1108 expected += Vector(0.3535534025157,-0.3535533856548,0.8660254009332); 1166 1109 SphericalPointDistribution::Polygon_t remaining = 1167 SphericalPointDistribution::matchSphericalPointDistributions( 1168 polygon, 1169 newpolygon); 1110 SPD.getRemainingPoints(polygon, 5); 1170 1111 // std::cout << std::setprecision(13) << "Matched polygon is " << remaining << std::endl; 1171 1112 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); … … 1181 1122 SPD.get<6>(); 1182 1123 SphericalPointDistribution::Polygon_t expected; 1124 expected += Vector(0.,0.,1.); 1183 1125 expected += Vector(0.,0.,-1.); 1184 expected += Vector(0.,0.,1.); 1185 SphericalPointDistribution::Polygon_t remaining = 1186 SphericalPointDistribution::matchSphericalPointDistributions( 1187 polygon, 1188 newpolygon); 1126 SphericalPointDistribution::Polygon_t remaining = 1127 SPD.getRemainingPoints(polygon, 6); 1189 1128 // std::cout << std::setprecision(13) << "Matched polygon is " << remaining << std::endl; 1190 1129 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); … … 1193 1132 } 1194 1133 1195 /** UnitTest for matchSphericalPointDistributions() with five points1196 */ 1197 void SphericalPointDistributionTest:: matchSphericalPointDistributionsTest_5()1134 /** UnitTest for getRemainingPoints() with five points 1135 */ 1136 void SphericalPointDistributionTest::getRemainingPointsTest_5() 1198 1137 { 1199 1138 SphericalPointDistribution SPD(1.); … … 1203 1142 SphericalPointDistribution::WeightedPolygon_t polygon; 1204 1143 polygon += std::make_pair( Vector(1.,0.,0.), 1); 1205 SphericalPointDistribution::Polygon_t newpolygon=1144 SphericalPointDistribution::Polygon_t expected = 1206 1145 SPD.get<5>(); 1207 SphericalPointDistribution::Polygon_t expected = newpolygon; 1208 expected.pop_front(); // remove first point 1209 SphericalPointDistribution::Polygon_t remaining = 1210 SphericalPointDistribution::matchSphericalPointDistributions( 1211 polygon, 1212 newpolygon); 1146 expected.pop_front(); // remove first point 1147 SphericalPointDistribution::Polygon_t remaining = 1148 SPD.getRemainingPoints(polygon, 5); 1213 1149 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 1214 1150 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); … … 1219 1155 SphericalPointDistribution::WeightedPolygon_t polygon; 1220 1156 polygon += std::make_pair( Vector(0.,1.,0.), 1); 1221 SphericalPointDistribution::Polygon_t newpolygon=1157 SphericalPointDistribution::Polygon_t expected = 1222 1158 SPD.get<5>(); 1223 SphericalPointDistribution::Polygon_t expected = newpolygon;1224 1159 expected.pop_front(); // remove first point 1225 1160 for (SphericalPointDistribution::Polygon_t::iterator iter = expected.begin(); … … 1229 1164 } 1230 1165 SphericalPointDistribution::Polygon_t remaining = 1231 SphericalPointDistribution::matchSphericalPointDistributions( 1232 polygon, 1233 newpolygon); 1166 SPD.getRemainingPoints(polygon, 5); 1234 1167 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 1235 1168 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); … … 1241 1174 polygon += std::make_pair( Vector(1.,0.,0.), 1); 1242 1175 polygon += std::make_pair( Vector(-1.,0.,0.), 1); 1243 SphericalPointDistribution::Polygon_t newpolygon=1176 SphericalPointDistribution::Polygon_t expected = 1244 1177 SPD.get<5>(); 1245 SphericalPointDistribution::Polygon_t expected = newpolygon; 1246 expected.pop_front(); // remove first point 1247 expected.pop_front(); // remove second point 1248 SphericalPointDistribution::Polygon_t remaining = 1249 SphericalPointDistribution::matchSphericalPointDistributions( 1250 polygon, 1251 newpolygon); 1178 expected.pop_front(); // remove first point 1179 expected.pop_front(); // remove second point 1180 SphericalPointDistribution::Polygon_t remaining = 1181 SPD.getRemainingPoints(polygon, 5); 1252 1182 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 1253 1183 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); … … 1264 1194 polygon += std::make_pair(RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180.*M_PI), 1); 1265 1195 polygon += std::make_pair(RotationAxis.rotateVector(Vector(-1.,0.,0.), 47.6/180.*M_PI), 1); 1266 SphericalPointDistribution::Polygon_t newpolygon=1196 SphericalPointDistribution::Polygon_t expected = 1267 1197 SPD.get<5>(); 1268 SphericalPointDistribution::Polygon_t expected = newpolygon;1269 1198 expected.pop_front(); // remove first point 1270 1199 expected.pop_front(); // remove second point … … 1273 1202 *iter = RotationAxis.rotateVector(*iter, 47.6/180.*M_PI); 1274 1203 SphericalPointDistribution::Polygon_t remaining = 1275 SphericalPointDistribution::matchSphericalPointDistributions( 1276 polygon, 1277 newpolygon); 1204 SPD.getRemainingPoints(polygon, 5); 1278 1205 // the three remaining points sit on a plane that may be rotated arbitrarily 1279 1206 // so we cannot simply check for equality between expected and remaining … … 1295 1222 polygon += std::make_pair( Vector(-1., 0.0, 0.0), 1); 1296 1223 polygon += std::make_pair( Vector(0.0, 1., 0.0), 1); 1297 SphericalPointDistribution::Polygon_t newpolygon=1224 SphericalPointDistribution::Polygon_t expected = 1298 1225 SPD.get<5>(); 1299 SphericalPointDistribution::Polygon_t expected = newpolygon;1300 1226 expected.pop_front(); // remove first point 1301 1227 expected.pop_front(); // remove second point 1302 1228 expected.pop_front(); // remove third point 1303 1229 SphericalPointDistribution::Polygon_t remaining = 1304 SphericalPointDistribution::matchSphericalPointDistributions( 1305 polygon, 1306 newpolygon); 1230 SPD.getRemainingPoints(polygon, 5); 1307 1231 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 1308 1232 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); … … 1320 1244 polygon += std::make_pair(RotationAxis.rotateVector(Vector(-1., 0.0, 0.0), 47.6/180*M_PI), 1); 1321 1245 polygon += std::make_pair(RotationAxis.rotateVector(Vector(0.0, 1., 0.0), 47.6/180*M_PI), 1); 1322 SphericalPointDistribution::Polygon_t newpolygon=1246 SphericalPointDistribution::Polygon_t expected = 1323 1247 SPD.get<5>(); 1324 SphericalPointDistribution::Polygon_t expected = newpolygon;1325 1248 expected.pop_front(); // remove first point 1326 1249 expected.pop_front(); // remove second point … … 1330 1253 *iter = RotationAxis.rotateVector(*iter, 47.6/180*M_PI); 1331 1254 SphericalPointDistribution::Polygon_t remaining = 1332 SphericalPointDistribution::matchSphericalPointDistributions( 1333 polygon, 1334 newpolygon); 1335 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 1336 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); 1337 // also slightly perturbed 1338 const double amplitude = 0.05; 1339 perturbPolygon(polygon, amplitude); 1340 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, amplitude) ); 1341 } 1342 } 1343 1344 /** UnitTest for matchSphericalPointDistributions() with six points 1345 */ 1346 void SphericalPointDistributionTest::matchSphericalPointDistributionsTest_6() 1255 SPD.getRemainingPoints(polygon, 5); 1256 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 1257 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); 1258 // also slightly perturbed 1259 const double amplitude = 0.05; 1260 perturbPolygon(polygon, amplitude); 1261 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, amplitude) ); 1262 } 1263 } 1264 1265 /** UnitTest for getRemainingPoints() with six points 1266 */ 1267 void SphericalPointDistributionTest::getRemainingPointsTest_6() 1347 1268 { 1348 1269 SphericalPointDistribution SPD(1.); … … 1352 1273 SphericalPointDistribution::WeightedPolygon_t polygon; 1353 1274 polygon += std::make_pair( Vector(1.,0.,0.), 1); 1354 SphericalPointDistribution::Polygon_t newpolygon=1275 SphericalPointDistribution::Polygon_t expected = 1355 1276 SPD.get<6>(); 1356 SphericalPointDistribution::Polygon_t expected = newpolygon; 1357 expected.pop_front(); // remove first point 1358 SphericalPointDistribution::Polygon_t remaining = 1359 SphericalPointDistribution::matchSphericalPointDistributions( 1360 polygon, 1361 newpolygon); 1277 expected.pop_front(); // remove first point 1278 SphericalPointDistribution::Polygon_t remaining = 1279 SPD.getRemainingPoints(polygon, 6); 1362 1280 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 1363 1281 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); … … 1368 1286 SphericalPointDistribution::WeightedPolygon_t polygon; 1369 1287 polygon += std::make_pair( Vector(0.,1.,0.), 1); 1370 SphericalPointDistribution::Polygon_t newpolygon=1288 SphericalPointDistribution::Polygon_t expected = 1371 1289 SPD.get<6>(); 1372 SphericalPointDistribution::Polygon_t expected = newpolygon;1373 1290 expected.pop_front(); // remove first point 1374 1291 for (SphericalPointDistribution::Polygon_t::iterator iter = expected.begin(); … … 1378 1295 } 1379 1296 SphericalPointDistribution::Polygon_t remaining = 1380 SphericalPointDistribution::matchSphericalPointDistributions( 1381 polygon, 1382 newpolygon); 1297 SPD.getRemainingPoints(polygon, 6); 1383 1298 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 1384 1299 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); … … 1390 1305 polygon += std::make_pair( Vector(1.,0.,0.), 1); 1391 1306 polygon += std::make_pair( Vector(-1.,0.,0.), 1); 1392 SphericalPointDistribution::Polygon_t newpolygon=1307 SphericalPointDistribution::Polygon_t expected = 1393 1308 SPD.get<6>(); 1394 SphericalPointDistribution::Polygon_t expected = newpolygon;1395 1309 expected.pop_front(); // remove first point 1396 1310 expected.pop_front(); // remove second spoint 1397 1311 SphericalPointDistribution::Polygon_t remaining = 1398 SphericalPointDistribution::matchSphericalPointDistributions( 1399 polygon, 1400 newpolygon); 1312 SPD.getRemainingPoints(polygon, 6); 1401 1313 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 1402 1314 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); … … 1413 1325 polygon += std::make_pair(RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180*M_PI), 1); 1414 1326 polygon += std::make_pair(RotationAxis.rotateVector(Vector(-1.,0.,0.), 47.6/180*M_PI), 1); 1415 SphericalPointDistribution::Polygon_t newpolygon=1327 SphericalPointDistribution::Polygon_t expected = 1416 1328 SPD.get<6>(); 1417 SphericalPointDistribution::Polygon_t expected = newpolygon;1418 1329 expected.pop_front(); // remove first point 1419 1330 expected.pop_front(); // remove second spoint … … 1422 1333 *iter = RotationAxis.rotateVector(*iter, 47.6/180*M_PI); 1423 1334 SphericalPointDistribution::Polygon_t remaining = 1424 SphericalPointDistribution::matchSphericalPointDistributions( 1425 polygon, 1426 newpolygon); 1335 SPD.getRemainingPoints(polygon, 6); 1427 1336 // the four remaining points sit on a plane that may have been rotated arbitrarily 1428 1337 // so we cannot simply check for equality between expected and remaining … … 1444 1353 polygon += std::make_pair( Vector(-1., 0.0, 0.0), 1); 1445 1354 polygon += std::make_pair( Vector(0.0, 1., 0.0), 1); 1446 SphericalPointDistribution::Polygon_t newpolygon=1355 SphericalPointDistribution::Polygon_t expected = 1447 1356 SPD.get<6>(); 1448 SphericalPointDistribution::Polygon_t expected = newpolygon;1449 1357 expected.pop_front(); // remove first point 1450 1358 expected.pop_front(); // remove second point 1451 1359 expected.pop_front(); // remove third point 1452 1360 SphericalPointDistribution::Polygon_t remaining = 1453 SphericalPointDistribution::matchSphericalPointDistributions( 1454 polygon, 1455 newpolygon); 1361 SPD.getRemainingPoints(polygon, 6); 1456 1362 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 1457 1363 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); … … 1469 1375 polygon += std::make_pair(RotationAxis.rotateVector(Vector(-1., 0.0, 0.0), 47.6/180*M_PI), 1); 1470 1376 polygon += std::make_pair(RotationAxis.rotateVector(Vector(0.0, 1., 0.0), 47.6/180*M_PI), 1); 1471 SphericalPointDistribution::Polygon_t newpolygon=1377 SphericalPointDistribution::Polygon_t expected = 1472 1378 SPD.get<6>(); 1473 SphericalPointDistribution::Polygon_t expected = newpolygon;1474 1379 expected.pop_front(); // remove first point 1475 1380 expected.pop_front(); // remove second point … … 1479 1384 *iter = RotationAxis.rotateVector(*iter, 47.6/180*M_PI); 1480 1385 SphericalPointDistribution::Polygon_t remaining = 1481 SphericalPointDistribution::matchSphericalPointDistributions( 1482 polygon, 1483 newpolygon); 1484 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 1485 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); 1486 // also slightly perturbed 1487 const double amplitude = 0.05; 1488 perturbPolygon(polygon, amplitude); 1489 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, amplitude) ); 1490 } 1491 } 1492 1493 /** UnitTest for matchSphericalPointDistributions() with seven points 1494 */ 1495 void SphericalPointDistributionTest::matchSphericalPointDistributionsTest_7() 1386 SPD.getRemainingPoints(polygon, 6); 1387 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 1388 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); 1389 // also slightly perturbed 1390 const double amplitude = 0.05; 1391 perturbPolygon(polygon, amplitude); 1392 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, amplitude) ); 1393 } 1394 } 1395 1396 /** UnitTest for getRemainingPoints() with seven points 1397 */ 1398 void SphericalPointDistributionTest::getRemainingPointsTest_7() 1496 1399 { 1497 1400 SphericalPointDistribution SPD(1.); … … 1501 1404 SphericalPointDistribution::WeightedPolygon_t polygon; 1502 1405 polygon += std::make_pair( Vector(1.,0.,0.), 1); 1503 SphericalPointDistribution::Polygon_t newpolygon=1406 SphericalPointDistribution::Polygon_t expected = 1504 1407 SPD.get<7>(); 1505 SphericalPointDistribution::Polygon_t expected = newpolygon; 1506 expected.pop_front(); // remove first point 1507 SphericalPointDistribution::Polygon_t remaining = 1508 SphericalPointDistribution::matchSphericalPointDistributions( 1509 polygon, 1510 newpolygon); 1408 expected.pop_front(); // remove first point 1409 SphericalPointDistribution::Polygon_t remaining = 1410 SPD.getRemainingPoints(polygon, 7); 1511 1411 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 1512 1412 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); … … 1517 1417 SphericalPointDistribution::WeightedPolygon_t polygon; 1518 1418 polygon += std::make_pair( Vector(0.,1.,0.), 1); 1519 SphericalPointDistribution::Polygon_t newpolygon=1419 SphericalPointDistribution::Polygon_t expected = 1520 1420 SPD.get<7>(); 1521 SphericalPointDistribution::Polygon_t expected = newpolygon;1522 1421 expected.pop_front(); // remove first point 1523 1422 for (SphericalPointDistribution::Polygon_t::iterator iter = expected.begin(); … … 1527 1426 } 1528 1427 SphericalPointDistribution::Polygon_t remaining = 1529 SphericalPointDistribution::matchSphericalPointDistributions( 1530 polygon, 1531 newpolygon); 1428 SPD.getRemainingPoints(polygon, 7); 1532 1429 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 1533 1430 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); … … 1539 1436 polygon += std::make_pair( Vector(1.,0.,0.), 1); 1540 1437 polygon += std::make_pair( Vector(-1.,0.,0.), 1); 1541 SphericalPointDistribution::Polygon_t newpolygon=1438 SphericalPointDistribution::Polygon_t expected = 1542 1439 SPD.get<7>(); 1543 SphericalPointDistribution::Polygon_t expected = newpolygon; 1544 expected.pop_front(); // remove first point 1545 expected.pop_front(); // remove second point 1546 SphericalPointDistribution::Polygon_t remaining = 1547 SphericalPointDistribution::matchSphericalPointDistributions( 1548 polygon, 1549 newpolygon); 1440 expected.pop_front(); // remove first point 1441 expected.pop_front(); // remove second point 1442 SphericalPointDistribution::Polygon_t remaining = 1443 SPD.getRemainingPoints(polygon, 7); 1550 1444 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 1551 1445 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); … … 1562 1456 polygon += std::make_pair(RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180*M_PI), 1); 1563 1457 polygon += std::make_pair(RotationAxis.rotateVector(Vector(-1.,0.,0.), 47.6/180*M_PI), 1); 1564 SphericalPointDistribution::Polygon_t newpolygon=1458 SphericalPointDistribution::Polygon_t expected = 1565 1459 SPD.get<7>(); 1566 SphericalPointDistribution::Polygon_t expected = newpolygon;1567 1460 expected.pop_front(); // remove first point 1568 1461 expected.pop_front(); // remove second point … … 1571 1464 *iter = RotationAxis.rotateVector(*iter, 47.6/180*M_PI); 1572 1465 SphericalPointDistribution::Polygon_t remaining = 1573 SphericalPointDistribution::matchSphericalPointDistributions( 1574 polygon, 1575 newpolygon); 1466 SPD.getRemainingPoints(polygon, 7); 1576 1467 // the five remaining points sit on a plane that may have been rotated arbitrarily 1577 1468 // so we cannot simply check for equality between expected and remaining … … 1593 1484 polygon += std::make_pair( Vector(-1., 0.0, 0.0), 1); 1594 1485 polygon += std::make_pair( Vector(0.0, 1., 0.0), 1); 1595 SphericalPointDistribution::Polygon_t newpolygon=1486 SphericalPointDistribution::Polygon_t expected = 1596 1487 SPD.get<7>(); 1597 SphericalPointDistribution::Polygon_t expected = newpolygon;1598 1488 expected.pop_front(); // remove first point 1599 1489 expected.pop_front(); // remove second point 1600 1490 expected.pop_front(); // remove third point 1601 1491 SphericalPointDistribution::Polygon_t remaining = 1602 SphericalPointDistribution::matchSphericalPointDistributions( 1603 polygon, 1604 newpolygon); 1492 SPD.getRemainingPoints(polygon, 7); 1605 1493 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 1606 1494 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); … … 1618 1506 polygon += std::make_pair(RotationAxis.rotateVector(Vector(-1., 0.0, 0.0), 47.6/180*M_PI), 1); 1619 1507 polygon += std::make_pair(RotationAxis.rotateVector(Vector(0.0, 1., 0.0), 47.6/180*M_PI), 1); 1620 SphericalPointDistribution::Polygon_t newpolygon=1508 SphericalPointDistribution::Polygon_t expected = 1621 1509 SPD.get<7>(); 1622 SphericalPointDistribution::Polygon_t expected = newpolygon;1623 1510 expected.pop_front(); // remove first point 1624 1511 expected.pop_front(); // remove second point … … 1628 1515 *iter = RotationAxis.rotateVector(*iter, 47.6/180*M_PI); 1629 1516 SphericalPointDistribution::Polygon_t remaining = 1630 SphericalPointDistribution::matchSphericalPointDistributions( 1631 polygon, 1632 newpolygon); 1633 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 1634 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); 1635 // also slightly perturbed 1636 const double amplitude = 0.05; 1637 perturbPolygon(polygon, amplitude); 1638 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, amplitude) ); 1639 } 1640 } 1641 1642 /** UnitTest for matchSphericalPointDistributions() with eight points 1643 */ 1644 void SphericalPointDistributionTest::matchSphericalPointDistributionsTest_8() 1517 SPD.getRemainingPoints(polygon, 7); 1518 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 1519 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); 1520 // also slightly perturbed 1521 const double amplitude = 0.05; 1522 perturbPolygon(polygon, amplitude); 1523 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, amplitude) ); 1524 } 1525 } 1526 1527 /** UnitTest for getRemainingPoints() with eight points 1528 */ 1529 void SphericalPointDistributionTest::getRemainingPointsTest_8() 1645 1530 { 1646 1531 SphericalPointDistribution SPD(1.); … … 1650 1535 SphericalPointDistribution::WeightedPolygon_t polygon; 1651 1536 polygon += std::make_pair( Vector(1.,0.,0.), 1); 1652 SphericalPointDistribution::Polygon_t newpolygon=1537 SphericalPointDistribution::Polygon_t expected = 1653 1538 SPD.get<8>(); 1654 SphericalPointDistribution::Polygon_t expected = newpolygon; 1655 expected.pop_front(); // remove first point 1656 SphericalPointDistribution::Polygon_t remaining = 1657 SphericalPointDistribution::matchSphericalPointDistributions( 1658 polygon, 1659 newpolygon); 1539 expected.pop_front(); // remove first point 1540 SphericalPointDistribution::Polygon_t remaining = 1541 SPD.getRemainingPoints(polygon, 8); 1660 1542 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 1661 1543 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); … … 1666 1548 SphericalPointDistribution::WeightedPolygon_t polygon; 1667 1549 polygon += std::make_pair( Vector(0.,1.,0.), 1); 1668 SphericalPointDistribution::Polygon_t newpolygon=1550 SphericalPointDistribution::Polygon_t expected = 1669 1551 SPD.get<8>(); 1670 SphericalPointDistribution::Polygon_t expected = newpolygon;1671 1552 expected.pop_front(); // remove first point 1672 1553 for (SphericalPointDistribution::Polygon_t::iterator iter = expected.begin(); … … 1675 1556 (*iter)[0] *= -1.; 1676 1557 } 1677 SphericalPointDistribution::Polygon_t remaining = 1678 SphericalPointDistribution::matchSphericalPointDistributions( 1679 polygon, 1680 newpolygon); 1558 SphericalPointDistribution::Polygon_t remaining = 1559 SPD.getRemainingPoints(polygon, 8); 1681 1560 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 1682 1561 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); … … 1688 1567 polygon += std::make_pair( Vector(1.,0.,0.), 1); 1689 1568 polygon += std::make_pair( Vector(-1.,0.,0.), 1); 1690 SphericalPointDistribution::Polygon_t newpolygon=1569 SphericalPointDistribution::Polygon_t expected = 1691 1570 SPD.get<8>(); 1692 SphericalPointDistribution::Polygon_t expected = newpolygon; 1693 expected.pop_front(); // remove first point 1694 expected.pop_front(); // remove second point 1695 SphericalPointDistribution::Polygon_t remaining = 1696 SphericalPointDistribution::matchSphericalPointDistributions( 1697 polygon, 1698 newpolygon); 1571 expected.pop_front(); // remove first point 1572 expected.pop_front(); // remove second point 1573 SphericalPointDistribution::Polygon_t remaining = 1574 SPD.getRemainingPoints(polygon, 8); 1699 1575 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 1700 1576 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); … … 1711 1587 polygon += std::make_pair(RotationAxis.rotateVector(Vector(1.,0.,0.), 47.6/180*M_PI), 1); 1712 1588 polygon += std::make_pair(RotationAxis.rotateVector(Vector(-1.,0.,0.), 47.6/180*M_PI), 1); 1713 SphericalPointDistribution::Polygon_t newpolygon=1589 SphericalPointDistribution::Polygon_t expected = 1714 1590 SPD.get<8>(); 1715 SphericalPointDistribution::Polygon_t expected = newpolygon;1716 1591 expected.pop_front(); // remove first point 1717 1592 expected.pop_front(); // remove second point … … 1720 1595 *iter = RotationAxis.rotateVector(*iter, 47.6/180*M_PI); 1721 1596 SphericalPointDistribution::Polygon_t remaining = 1722 SphericalPointDistribution::matchSphericalPointDistributions( 1723 polygon, 1724 newpolygon); 1597 SPD.getRemainingPoints(polygon, 8); 1725 1598 // the six remaining points sit on two planes that may have been rotated arbitrarily 1726 1599 // so we cannot simply check for equality between expected and remaining … … 1746 1619 polygon += std::make_pair( Vector(-1., 0.0, 0.0), 1); 1747 1620 polygon += std::make_pair( Vector(-1./3.0, 2.0*M_SQRT2/3.0, 0.0), 1); 1748 SphericalPointDistribution::Polygon_t newpolygon=1621 SphericalPointDistribution::Polygon_t expected = 1749 1622 SPD.get<8>(); 1750 SphericalPointDistribution::Polygon_t expected = newpolygon;1751 1623 expected.pop_front(); // remove first point 1752 1624 expected.pop_front(); // remove second point 1753 1625 expected.pop_front(); // remove third point 1754 1626 SphericalPointDistribution::Polygon_t remaining = 1755 SphericalPointDistribution::matchSphericalPointDistributions( 1756 polygon, 1757 newpolygon); 1627 SPD.getRemainingPoints(polygon, 8); 1758 1628 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 1759 1629 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); … … 1771 1641 polygon += std::make_pair(RotationAxis.rotateVector(Vector(-1., 0.0, 0.0), 47.6/180*M_PI), 1); 1772 1642 polygon += std::make_pair(RotationAxis.rotateVector(Vector(-1./3.0, 2.0*M_SQRT2/3.0, 0.0), 47.6/180*M_PI), 1); 1773 SphericalPointDistribution::Polygon_t newpolygon=1643 SphericalPointDistribution::Polygon_t expected = 1774 1644 SPD.get<8>(); 1775 SphericalPointDistribution::Polygon_t expected = newpolygon;1776 1645 expected.pop_front(); // remove first point 1777 1646 expected.pop_front(); // remove second point … … 1781 1650 *iter = RotationAxis.rotateVector(*iter, 47.6/180*M_PI); 1782 1651 SphericalPointDistribution::Polygon_t remaining = 1783 SphericalPointDistribution::matchSphericalPointDistributions( 1784 polygon, 1785 newpolygon); 1786 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 1787 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); 1788 // also slightly perturbed 1789 const double amplitude = 0.05; 1790 perturbPolygon(polygon, amplitude); 1791 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, amplitude) ); 1792 } 1793 } 1652 SPD.getRemainingPoints(polygon, 8); 1653 // CPPUNIT_ASSERT_EQUAL( expected, remaining ); 1654 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, CenterAccuracy) ); 1655 // also slightly perturbed 1656 const double amplitude = 0.05; 1657 perturbPolygon(polygon, amplitude); 1658 CPPUNIT_ASSERT( areEqualToWithinBounds(expected, remaining, amplitude) ); 1659 } 1660 }
Note:
See TracChangeset
for help on using the changeset viewer.