public BowyerSimpliceFacet(IVoronoiVertex owner, IVoronoiVertex external, IEnumerable<BowyerNuclei> nucleis)
        {
            this.Owner = owner;
            this.External = external;
            this.nucleis = nucleis.ToArray();

            if (owner == null)
                throw new ArgumentException("it's needed at least a parent voronoi vertex for a simplice facet");

            if (External != null)
                CalculateConstraint();
        }
Beispiel #2
0
        public BowyerSimpliceFacet(IVoronoiVertex owner, IVoronoiVertex external, IEnumerable <BowyerNuclei> nucleis)
        {
            this.Owner    = owner;
            this.External = external;
            this.nucleis  = nucleis.ToArray();

            if (owner == null)
            {
                throw new ArgumentException("it's needed at least a parent voronoi vertex for a simplice facet");
            }

            if (External != null)
            {
                CalculateConstraint();
            }
        }
Beispiel #3
0
        /// <summary>
        /// This is a lazy calculation of the voronoi Vertex, its not calculated if it isn't required.
        /// </summary>
        private void CalculateSimpliceCentroid()
        {
            Debug.Print("Calculating Simplice centroid");

            if (Nucleis.Any(n => n.Coordinates.Length != Dimensionality))
            {
                throw new ArgumentException("Incorrect dimensionality in the nucleis. some nucleis have no the right dimensionality");
            }

            voroniVertex = new VoronoiVertex(Dimensionality, this);
            Helpers.CalculateSimpliceCentroid(Nucleis, voroniVertex);

            for (int i = 0; i < VoronoiVertex.Coordinates.Length; i++)
            {
                double diff = VoronoiVertex.Coordinates[i] - Nucleis.First().Coordinates[i];
                squaredDistance += diff * diff;
            }
        }
 internal void Dispose()
 {
     this.external = null;
     this.Owner = null;
     this.constraint = null;
 }
Beispiel #5
0
 private static bool VerifyRestriction(IVoronoiVertex a, IVoronoiVertex b)
 {
     throw new NotImplementedException();
 }
Beispiel #6
0
 public static PointF ToPoint(this IVoronoiVertex a)
 {
     return(new PointF((float)a.Coordinates.ElementAt(0), (float)a.Coordinates.ElementAt(1)));
 }
Beispiel #7
0
 internal void Dispose()
 {
     this.external   = null;
     this.Owner      = null;
     this.constraint = null;
 }
        /// <summary>
        /// This is a lazy calculation of the voronoi Vertex, its not calculated if it isn't required.
        /// </summary>
        private void CalculateSimpliceCentroid()
        {
            Debug.Print("Calculating Simplice centroid");

            if (Nucleis.Any(n => n.Coordinates.Length != Dimensionality))
                throw new ArgumentException("Incorrect dimensionality in the nucleis. some nucleis have no the right dimensionality");

            voroniVertex = new VoronoiVertex(Dimensionality,this);
            Helpers.CalculateSimpliceCentroid(Nucleis, voroniVertex);

            for (int i = 0; i < VoronoiVertex.Coordinates.Length; i++)
            {
                double diff = VoronoiVertex.Coordinates[i] - Nucleis.First().Coordinates[i];
                squaredDistance += diff * diff;
            }
        }
 private static bool VerifyRestriction(IVoronoiVertex a, IVoronoiVertex b)
 {
     throw new NotImplementedException();
 }