Hello,
I've posted a similar thread before, but in the wrong section of the forums. User Jeff_M pointed me towards here, so I hope I've got it right this time 🙂
I have an ObjectARX application where I consult a TIN surface for elevation samples. I need several thousand point's elevations in a straight line. Initially, I was making thousands of FindElevationAtXY calls, but that proved to be somewhat slow, so I searched and found SampleElevation in the documentation and was hoping it'd provide me with performance gain.
I had some problems, due to my inexperience with VARIANT and SAFEARRAY types, but now I get what seems to be correct results when passing an initial and ending point. Here's a code snippet of my call, which succeeds and gives me the correct elevations;
HRESULT result = mTINSurface->SampleElevations(x,y,n_x,y,&variant); //sample in line
Note that I'm sampling a line along the x-axis (y constant).
The problem i'm facing is that the number of samples along the line provided by the method is far smaller than I expected. I need thousands of points along this line (in fact, I want all points with exact round x-coordinates), and no matter what size I provide for the safe array of doubles given by 'variant', I get only a few hundred points. Furthermore, I've checked and the offset between any two points in the resulting sample is not constant, nor are they the same when I sample a different line (increase y coordinate by one).
Here are my questions:
Thanks for in advance,
MS
Solved! Go to Solution.
Solved by Jeff_M. Go to Solution.
Thanks, Jeff_M! I figured something like that was going on. As I said, I'm not very experienced with these formats and any help is appreciated. I now wonder if my performance gain comes from the fact that I am really just sampling a few hundred points (instead of thousands). I'll see what I can do about it.
This does leave me with another question, though: when calling SampleElevation, what happens if the line defined by my x/y inputs coincides with a TIN line of my surface?
Thanks again,
MS
@Anonymous wrote:
This does leave me with another question, though: when calling SampleElevation, what happens if the line defined by my x/y inputs coincides with a TIN line of my surface?
Thanks again,
MS
Glad I can help. That is a good question and one which I have not looked into. It shouldn't be too hard to test though. My guess is that you will get the start/end points of the TIN line and nothing in between.