/// <summary> /// Initializes a new instance of the Interval2D class /// </summary> /// <param name="intervalX">Interval in the axe X </param> /// <param name="intervalY">Interval in the axe Y</param> public Interval2D( Interval intervalX, Interval intervalY, Interval intervalZ) { this.IntervalX = intervalX; this.IntervalY = intervalY; this.IntervalZ= intervalZ; }
/// <summary> /// This evaluates if That(interval) is intersected /// </summary> /// <param name="that">Interval to be evaluated</param> /// <returns>True if the interval is intersected</returns> public bool Intersects( Interval that) { if (this.Less(this.High, that.Low)) { return false; } if (this.Less(that.High, this.Low)) { return false; } return true; }
/// <summary> /// Searching the points around of a position /// </summary> /// <param name="cpointsF">Point founds</param> /// <param name="nPn">Number of point searched</param> /// <param name="x">Coordinate X of the point to calculate</param> /// <param name="y">Coordinate Y of the point to calculate</param> public void ListPointAvailables( out List<Kpoint> cpointsF, double x, double y, double z, bool includePoint) { Kpoint center = new Kpoint(x, y, z, 0); if (kpoints.Count <= type * minPointsPerSector ) { if (includePoint) cpointsF = kpoints; else { cpointsF = new List<Kpoint>(); foreach (Kpoint k in kpoints) { if (!(k==center)) cpointsF.Add( k); } return; } } // double searchDistance = (this.extent[2] - this.extent[0]) * 0.05; double[] v = zone(center); double xsize=v[0]/2; double ysize = v[1]/2; double zsize = v[2]/2; double xmin=double.NaN; double ymin=double.NaN; double zmin=double.NaN; double xmax=double.NaN; double ymax = double.NaN; double zmax=double.NaN; int jj = 0; double dmult=0.1; do { ListToCheck = new List<KDistance>[type]; for (int i = 0; i < type; i++) { ListToCheck[i] = new List<KDistance>(); } mult = jj * dmult; this.quadTreeValues.Clean(); xmin = x - (xsize * (1 + mult )); ymin = y - (xsize * (1 + mult)); zmin = y - (zsize * (1 + mult)); xmax = x + (ysize * (1 + mult)); ymax = y + (ysize * (1 + mult)); zmax = y + (zsize * (1 + mult)); Interval intX = new Interval(xmin, xmax); Interval intY = new Interval(ymin, ymax); Interval intZ = new Interval(zmin, zmax); Interval2D rect = new Interval2D(intX, intY,intZ); this.quadTreeValues.Query(rect); dmult++; jj++; if (jj>1) v[1]=0; ConfigEllipse(center); } while (Conditions(center,this.quadTreeValues.GetData(),includePoint) && (v[0]*5) > Math.Abs(xmax-xmin) ); cpointsF = new List<Kpoint>(); for (int i = 0; i < type; i++) { int val=evaluteNumPoints(jj,ListToCheck[i].Count); for (int j = 0; j < ListToCheck[i].Count && j < val ; j++) cpointsF.Add(ListToCheck[i][j].point); } selectedPoints = cpointsF; }
/// <summary> /// Evaluate if two intervals are equal /// </summary> /// <param name="that">Interval to be evaluated</param> /// <returns>True if the interval are equal</returns> public bool Equals( Interval that) { return this.Low.Equals(that.Low) && this.High.Equals(that.High); }