private void InitializeThinSearch(double thinThickness, double xBasis, double yBasis, List <SearchPoint> pattern) { // simply loop through all pixels that could possibly be closer than // a half pixel from a line through (0,0) and parallel to the basis vector int ijmax = (int)(thinThickness + 0.5) + 1; for (int j = -ijmax; j <= ijmax; j++) { for (int i = -ijmax; i <= ijmax; i++) { double x = (double)i; double y = (double)j; // this point must be in same direction as the basis vector. use dot product if (x * xBasis + y * yBasis > 0) { // this point must be within a half pixel of the basis vector if (NuGenMath.DistanceToLine(x, y, 0.0, 0.0, xBasis, yBasis) <= 0.5) { // add new search point SearchPoint p = new SearchPoint(i, j, Math.Sqrt(i * i + j * j)); pattern.Add(p); } } } } pattern.Sort(); }
private void InitializeThinSearch(double thinThickness, double xBasis, double yBasis, List<SearchPoint> pattern) { // simply loop through all pixels that could possibly be closer than // a half pixel from a line through (0,0) and parallel to the basis vector int ijmax = (int)(thinThickness + 0.5) + 1; for (int j = -ijmax; j <= ijmax; j++) for (int i = -ijmax; i <= ijmax; i++) { double x = (double)i; double y = (double)j; // this point must be in same direction as the basis vector. use dot product if (x * xBasis + y * yBasis > 0) { // this point must be within a half pixel of the basis vector if (NuGenMath.DistanceToLine(x, y, 0.0, 0.0, xBasis, yBasis) <= 0.5) { // add new search point SearchPoint p = new SearchPoint(i, j, Math.Sqrt(i * i + j * j)); pattern.Add(p); } } } pattern.Sort(); }
public int CompareTo(object other) { SearchPoint otherPoint = (SearchPoint)other; return((int)(distance - otherPoint.Distance)); }