<div dir="ltr">Hi David,<div><br></div><div>Thanks for the reply, this is slowly starting to make sense. That call did in fact fix the bounds issues. However, the output still looks like it did in the above screenshot.</div><div><br></div><div>><span style="font-family:arial,sans-serif;font-size:13px">The plane is already composed of cells, so you should not run it</span></div><span style="font-family:arial,sans-serif;font-size:13px">through Delaunay. </span><div><font face="arial, sans-serif"><br></font><div><span style="font-family:arial,sans-serif;font-size:13px">This is what perplexed me about the above linked example. </span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">What is the best way to write the probe results to a file then? </span></div></div><div><div style><br></div></div><div style><font face="arial, sans-serif"><br></font></div><div style><font face="arial, sans-serif">Saving the after-probe'd grid does not produce the expected output.</font></div><div style><div><font face="arial, sans-serif">gridWriter->SetInputConnection ( gridPoints->GetOutputPort());</font></div><div><font face="arial, sans-serif">gridWriter->Write();</font></div><div><font face="arial, sans-serif"><br></font></div><div><font face="arial, sans-serif">I feel like I am missing something simple. Thanks for the help.</font></div></div></div><div class="gmail_extra"><br clear="all"><div><div dir="ltr"><span style="color:rgb(102,102,102)">Chris Marsh</span><br style="color:rgb(102,102,102)"><span style="color:rgb(102,102,102)">PhD Student</span><br style="color:rgb(102,102,102)"><span style="color:rgb(102,102,102)"></span><a href="http://chrismarsh.ca/" style="color:rgb(102,102,102)" target="_blank">chrismarsh.ca</a><br style="color:rgb(102,102,102)"><br style="color:rgb(102,102,102)"><span style="color:rgb(102,102,102)">13 Kirk Hall</span><br style="color:rgb(102,102,102)"><span style="color:rgb(102,102,102)">University of Saskatchewan</span><br style="color:rgb(102,102,102)"></div></div>
<br><div class="gmail_quote">On Wed, Sep 17, 2014 at 10:34 AM, David Gobbi <span dir="ltr"><<a href="mailto:david.gobbi@gmail.com" target="_blank">david.gobbi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Chris,<br>
<br>
The plane is already composed of cells, so you should not run it<br>
through Delaunay. If you want to convert its polygons (rectangles)<br>
into triangles, you should do so with vtkTriangleFilter.<br>
<br>
Delanay2D: triangulate unconnected points<br>
<br>
TriangleFilter: triangulate cells (e.g. convert polys to triangles)<br>
<br>
But there is no need to triangulate the plane. It's original set of<br>
rectangular polygons should be just fine for what you are doing.<br>
<br>
<br>
As for the bad bounds you get from gridDelaunay, it looks like<br>
you didn't call Update on the filter before getting the bounds from<br>
its output. The output of a filter is always invalid until you call<br>
Update on the filter.<br>
<span class="HOEnZb"><font color="#888888"><br>
- David<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
On Wed, Sep 17, 2014 at 10:20 AM, Chris Marsh <<a href="mailto:chris.marsh@usask.ca">chris.marsh@usask.ca</a>> wrote:<br>
> Further to this:<br>
><br>
> Tri bounds xmin:624714 xmax:629904 ymin:5.64502e+06 ymax:5.64877e+06<br>
> gridpoints bounds xmin:624714 xmax:629904 ymin:5.64502e+06 ymax:5.64877e+06<br>
> gridDelaunay bounds xmin:1 xmax:-1 ymin:1 ymax:-1<br>
><br>
> It appears the final triangulation of the probed points is the problem<br>
><br>
> vtkSmartPointer<vtkDelaunay2D> gridDelaunay =<br>
> vtkSmartPointer<vtkDelaunay2D>::New();<br>
> gridDelaunay->SetInputConnection ( probeFilter->GetOutputPort() );<br>
><br>
> vtkSmartPointer<vtkXMLPolyDataWriter> gridWriter =<br>
> vtkSmartPointer<vtkXMLPolyDataWriter>::New();<br>
> gridWriter->SetFileName ( file_name.c_str());<br>
> gridWriter->SetInputConnection ( gridDelaunay->GetOutputPort() );<br>
> gridWriter->Write();<br>
><br>
> Is this final triangulation required? Is there a better way of doing this?<br>
><br>
> Thanks, Chris<br>
><br>
> On Tue, Sep 16, 2014 at 7:03 PM, Chris Marsh <<a href="mailto:chris.marsh@usask.ca">chris.marsh@usask.ca</a>> wrote:<br>
>><br>
>> Ah I see resolution is just subdivisions.<br>
>> <a href="http://www.vtk.org/doc/nightly/html/classvtkPlaneSource.html#acd65f04a453ba87b766048f0e7597710" target="_blank">http://www.vtk.org/doc/nightly/html/classvtkPlaneSource.html#acd65f04a453ba87b766048f0e7597710</a><br>
>><br>
>> I have also confirmed bbox matches exactly the values that GetBounds()<br>
>> reports.<br>
>><br>
>> On Tue, Sep 16, 2014 at 6:16 PM, Chris Marsh <<a href="mailto:chris.marsh@usask.ca">chris.marsh@usask.ca</a>> wrote:<br>
>>><br>
>>> Yes, I was trying to be optimistic :( Good call on the bounds:<br>
>>> vtu export: xmin:624714 xmax:629904 ymin:5.64502e+06 ymax:5.64877e+06<br>
>>> vtp export: xmin:1 xmax:-1 ymin:1 ymax:-1<br>
>>><br>
>>> Presumably the problem. I'm unclear why it is doing this though?<br>
>>><br>
>>> vtkSmartPointer<vtkPlaneSource> gridPoints =<br>
>>> vtkSmartPointer<vtkPlaneSource>::New();<br>
>>><br>
>>> int gridSize = 1000;<br>
>>> gridPoints->SetResolution(gridSize, gridSize);<br>
>>> gridPoints->SetOrigin(bbox.vertex(0).x(), bbox.vertex(0).y(), 0);<br>
>>> gridPoints->SetPoint1(bbox.vertex(2).x(), bbox.vertex(0).y(), 0);<br>
>>> gridPoints->SetPoint2(bbox.vertex(0).x(), bbox.vertex(2).y(), 0);<br>
>>> gridPoints->Update();<br>
>>><br>
>>> where bbox is a bounding box (2D), index 0 is bottom left, indexing is<br>
>>> increasing CCW. So 2 is upper right corner. As far as I can tell this is<br>
>>> correct and corresponds to the vtu export numbers I had above.<br>
>>><br>
>>> I feel like I perhaps don't understand resolution: I envision it as the<br>
>>> size of each cell, however I don't think that is correct is it?<br>
>>><br>
>>><br>
>>><br>
>>> On Tue, Sep 16, 2014 at 5:23 PM, David Gobbi <<a href="mailto:david.gobbi@gmail.com">david.gobbi@gmail.com</a>><br>
>>> wrote:<br>
>>>><br>
>>>> On Tue, Sep 16, 2014 at 4:49 PM, Chris Marsh <<a href="mailto:chris.marsh@usask.ca">chris.marsh@usask.ca</a>><br>
>>>> wrote:<br>
>>>><br>
>>>> > The interpolation doesn't look very good, even after increasing the<br>
>>>> > resolution. As well, it is flipped along the y-axis. Image is a<br>
>>>> > mountain,<br>
>>>> > variable is air temp (blue = cold, red = warm).<br>
>>>> > See here: <a href="http://imgur.com/l1KpcS0" target="_blank">http://imgur.com/l1KpcS0</a><br>
>>>><br>
>>>> Honestly, I can't see any correspondence at all between the mountain<br>
>>>> and the interpolated data on that plane. Are you sure the size and<br>
>>>> position of the plane matches the size and position of your data?<br>
>>>> An easy way to check is to call GetBounds() on both of them and<br>
>>>> print out the bounds. They should match.<br>
>>>><br>
>>>> > Secondly: I need to iterate over the rows/cols of this interpolated<br>
>>>> > grid in<br>
>>>> > order to write it to an ArcGIS ascii file. What would be the best way<br>
>>>> > to do<br>
>>>> > this? The fact it is now in a delaunay triangulation somewhat doesn't<br>
>>>> > help<br>
>>>> > (now that I think about it!)<br>
>>>><br>
>>>> The interpolated data can be retrieved via GetPointData()->GetScalars(),<br>
>>>> but I'm not sure what ordering the vtkPlaneSource uses for its points.<br>
>>>> You can print GetPoint(0) and GetPoint(1) to see whether the points<br>
>>>> increase in the X direction or Y direction first.<br>
>>>><br>
>>>> Also, watch for off-by-one mistakes. SetResolution(1, 1) gives a plane<br>
>>>> with 4 points (the corners). So if you want a plane with 4x4 points,<br>
>>>> you<br>
>>>> would SetResolution(3, 3).<br>
>>>><br>
>>>> - David<br>
>>><br>
>>><br>
>><br>
><br>
</div></div></blockquote></div><br></div>