public void GetPointClusters_ReturnTheCorrectNumberOfPoints_GivenANumber()
        {
            var pathClusterFinderWithListNeighboringPoints = new PathClusterFinderWithList(_listOfCoordinates, _pointPerCluster).GetPointClusters().ToList();

            pathClusterFinderWithListNeighboringPoints[0].Count().Should().Be(_pointPerCluster);
            pathClusterFinderWithListNeighboringPoints.SelectMany(p => p).Count().Should().Be(_numberOfCoordinates);
        }
Ejemplo n.º 2
0
        public void KdTreeLinearSearchCoordinate_ReturnsTheSameResultAs_NearestNeighbourBruteForce()
        {
            var pathClusterFinderWithListNeighboringPoints = new PathClusterFinderWithList(_listOfCoordinates, _pointPerCluster)
                                                             .GetPointClusters().ToList();

            var nearestPointsKdTreeLinear =
                new KDTreeCoordinate <Coordinate>(2, ArrayOfCoordinates,
                                                  KdTreeHelper.L2Norm_Squared_Coordinate)
                .NearestNeighborClusterLinear(_pointPerCluster, ArrayOfCoordinates)
                .ToList();

            pathClusterFinderWithListNeighboringPoints[0].OrderBy(k => k.CoordinateId)
            .SequenceEqual(nearestPointsKdTreeLinear[0].OrderBy(k => k.CoordinateId))
            .Should()
            .BeTrue();

            pathClusterFinderWithListNeighboringPoints[1].OrderBy(k => k.CoordinateId)
            .SequenceEqual(nearestPointsKdTreeLinear[1].OrderBy(k => k.CoordinateId))
            .Should()
            .BeTrue();
        }
        public void GetPointClusters_ReturnTheCorrectType()
        {
            var pathClusterFinderWithListNeighboringPoints = new PathClusterFinderWithList(_listOfCoordinates, _pointPerCluster).GetPointClusters().ToList();

            pathClusterFinderWithListNeighboringPoints.Should().BeOfType <List <List <Coordinate> > >();
        }