Background:
I want to be able to take a 2d matrix (an image really), and a set of points defining a polygon, and draw that polygon into the matrix.
Before I run off and reinvent the wheel, I thought I’d ask if anyone knew of any existing libraries or code in Octave that does this. So far, my searches through the Octave packages and google have come up empty.
Failing in that, neither is too hard to implement, but I’m unsure how to draw a filled polygon. Is there an easy/efficient way to tell which points are inside a polygon and which are outside? Thanks.
Edit:
My purpose isn’t displaying anything. Actually, what I’m specifically looking at doing is some image processing stuff, like plotting a convex hull, finding its area, finding the parts of the convex hull not in the original object, etc.
I don’t see that Gnu Plot actually give me back any data I can work with. If I’m wrong, by all means tell me how. Thanks.
For finding points within a polygon, you can try Darren Engwirda’s MATLAB function posted on MATLAB Central: http://www.mathworks.com/matlabcentral/fileexchange/10391
I looked briefly through the code and don’t see anything that’s particularly MATLAB specific, so it may run as-is in Octave.