1

I have a bounding area of a contour after the slicing operation. Now to generate the tool-path over the contour, I need to distribute the bounding area into grid space so that each each cell maintain a certain precomputed width.

I am doing the math as follows, but I am not sure if the whole area will be covered as there is floating point values concatenated to integer coordinates.

       short int xDist = std::abs(xMax - xMin);
       short int yDist = std::abs(yMax - yMin);

       short int xCells = (xDist/scanSpacingStep) + 1;
       short int yCells = (yDist/scanSpacingStep) + 1;

The indexing starts from (0,0).

Thanks

sajis997
  • 1,279
  • 1
  • 10
  • 15
  • Are you doing coding by deferring to stackexhange, perchance? – joojaa May 31 '16 at 12:38
  • I totally missed your last question ? – sajis997 May 31 '16 at 12:52
  • if xMax and xMin are floats, why is xDist an int? – Rotem May 31 '16 at 14:32
  • All the declared variable are in short int . The only floating point issue may arise with xDist/scanSpacingStep. – sajis997 May 31 '16 at 14:47
  • I'm not quite sure what you are asking. Are xMax and xMin pixel locations? If so are both inclusive? If xMin=2 and xMax=4, does that cover 2 columns of pixels or 3? – trichoplax is on Codidact now Jun 01 '16 at 00:22
  • yes , it can be associated with pixel locations. (xMin,yMin) and (xMax,yMax) are inclusive. If xMin = 2 and xMax = 4 , and if both of them are inclusive , it should cover three columns, is not it ? – sajis997 Jun 01 '16 at 11:04
  • Could you explain what "tool-path" and "scanSpacingStep" mean in this context? – trichoplax is on Codidact now Jun 07 '16 at 09:03
  • The tool-path is basically the path that follows a series of coordinate points over a grid cell. And the scanSpacingStep is the distance between two adjacent lines. Check the link http://imgur.com/NTtPYoB The fractal path in the image could be a tool path that is defined by series of coordinates and the in-between distance of each and every fractal line segments is the scanSpacingStep. – sajis997 Jun 07 '16 at 09:09

0 Answers0