Recent

Author Topic: Contouring with TAContour  (Read 3649 times)

stab

  • Full Member
  • ***
  • Posts: 234
Contouring with TAContour
« on: March 03, 2015, 02:16:00 am »
Hi wp,

Have tried to use your TAContour and it sure works great and fast.
One question I have is about how to make closed polygons towards the edge of a 3D-grid. I'm attaching an image showing the edge as a black rectangle in the test I've made. How could I get closed polygons towards the edge?

Regards
stab

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: Contouring with TAContour
« Reply #1 on: March 03, 2015, 10:15:51 am »
Not sure what you mean by "closed polygon towards the edge of the 3D grid". That the contour line suddenly leaves its correct path and jumps to the edge? This is certainly not correct, but without having seen your code and your data I can't tell very much. How are the data points distributed? Add code which shows you where the data points are located. Maybe there are no data points near the edge?

If you don't find a solution yourself, try to extract the contour creation and drawing code from your program into a little demo which shows the issues and which you can upload here, if possible along with data file (or information how I could get it if it is too big). Pack pas, lfm, lpr and lpi files of the demo into a single zip and upload it (no exe and no ppu please).

stab

  • Full Member
  • ***
  • Posts: 234
Re: Contouring with TAContour
« Reply #2 on: March 03, 2015, 11:37:44 am »
Thanks for your answer,

Attaching an image showing what I want to achieve.
The data is distributed in a regular grid within the boundary rectangle with a point distance of 50 m and outside the edge is "NoData" a specially assigned value. Along the edge where the contours are not closed there is the same contour level so I thought it should automatically get closed.
I'm making physical 3D-landscape models on a milling-machine
and I need to have closed polygons like in the attached image to specify areas where no milling should be done.

/stab
« Last Edit: March 03, 2015, 11:54:08 am by stab »

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: Contouring with TAContour
« Reply #3 on: March 04, 2015, 12:21:07 am »
The contour finder always closes the polygon. In order to hide the line along the edge I had inserted NaN values into the series (which does not draw the connection line). Therefore you just have to use grid points along the edge to get the polygon closed.

The attached demo contains a modified version of the TAContour unit which I had published in http://forum.lazarus.freepascal.org/index.php/topic,19399.msg114039.html. The ContourFinder has a new property PolygonCloseMode which allows you to close the polygon along the edges.

Please note that the contour finder follows the contour line in clockwise orientation. This means that the contour closes around the high parts of the "landscape". The demo draws one contour level for a paraboloid shape which has its minimum at 0/0. Towards the edges of the chart the "landscape" is increasing. You can see that the polygon runs around the high parts.

I hope that is what you need. If you'd need to enclose the low parts of the landscape by the polygon then some work would be required because the clockwise orientation is pretty much hard-coded in the algorithm. As a workaround I'd recommend that you just invert your data values, e.g. multiply the z values by -1.

stab

  • Full Member
  • ***
  • Posts: 234
Re: Contouring with TAContour
« Reply #4 on: March 04, 2015, 01:30:58 am »
Thanks alot!!!

/stab

 

TinyPortal © 2005-2018