Beispiel #1
0
 public HandCollection Create(ShapeCollection shapes)
 {
     if (shapes.Count == 0) {
         this.currentValue = Clear();
     } else {
         this.currentValue = CreateHandCollection(shapes);
     }
     return this.currentValue;
 }
Beispiel #2
0
        public ShapeCollection Create(ClusterCollection clusterData)
        {
            var result = new ShapeCollection();
            foreach (var cluster in clusterData.Clusters) {
                var convexHull = new GrahamScan(cluster.Points).FindHull();
                var map = CreateMap(cluster);
                var contour = CreateContour(map, cluster);

                if (contour.Count >= settings.MinimalPointsInContour) {
                    result.Shapes.Add(new Shape(cluster.Center, cluster.Volume, contour, convexHull, cluster.Points));
                }
            }
            return result;
        }
Beispiel #3
0
        public ShapeCollection Create(ClusterCollection clusterData)
        {
            var result = new ShapeCollection();

            foreach (var cluster in clusterData.Clusters)
            {
                var convexHull = new GrahamScan(cluster.Points).FindHull();
                var map        = CreateMap(cluster);
                var contour    = CreateContour(map, cluster);

                if (contour.Count >= settings.MinimalPointsInContour)
                {
                    result.Shapes.Add(new Shape(cluster.Center, cluster.Volume, contour, convexHull, cluster.Points));
                }
            }
            return(result);
        }
Beispiel #4
0
        private HandCollection CreateHandCollection(ShapeCollection shapes)
        {
            var map = new DistanceMap<HandData, Shape>(currentValue.Hands);
            map.Map(shapes.Shapes);

            var handData = new List<HandData>();
            foreach (var tupple in map.MappedItems) {
                handData.Add(this.Create(tupple.Item1, tupple.Item2));
            }
            foreach (var shape in map.UnmappedItems) {
                handData.Add(this.Create(shape));
            }
            foreach (var discontinuedHandData in map.DiscontinuedItems) {
                this.ReturnIdToPool(discontinuedHandData.Id);
            }

            return new HandCollection(handData);
        }