while working on a contourf function, I noticed that patch handles convex polygons only. I think we need support for concave polygons too. This could be solved by at least 2 approaches:
* 1st, use of delaunay to triangulate the polygon, this could be done in patch.m. The resulting 'triangle matrix' could be forwarded to the patch object. The drawback is the dependence on libqhull and a different interface to the patch object.
* 2nd - my favored approach - the use of the OpenGl utilities library. In this case we would add a dependence of libglu to octplot. After a first look into Chapter 11 about tesselation ('red book' [1] ) I think this could be done with limited effort.
So, especially Shai, what do you think? If you agree, I would go forward with the 2nd option and try to implement it.
I Agree with you completely -- glu is the way to go. Especially since octplot already depends on glu through FTGL which I use for text rendering. (I wasn't aware of this myself, but searching for glu turned this up -- google desktop is sometimes quite amazing). In fact, FTGL does tesselations -- have a look in src/FTGL/FTVectoriser.cpp
Adding the ability to draw convex polygons will greatly improve octplot.
Shai
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
thanks for you response. I take your reference to FTGL just as a remark, to look how they have done it. FTVectorizer.cpp is very specialized for font rendering, so we cannot use it directly for our more general needs.
In the meantime I see the first convex patches on my screen :-) by using the GLU tesselator directly. After some debugging, I hope to send an improved patch object soon.
Kai
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Shai,
it seems I was to fast, the proposed patch for patch does not work if start and end point of the polygon are identical. I try to find a solution - it seems the combine callback does not work properly.
If you have time, maybe you can try something like:
patch([100 200 300 300 100 100],[100 120 100 200 200 100], 'FaceColor', [0 1 1], 'EdgeColor', 'r');
and see if it dies for you too.
Kai
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
please have a look at the revised patch for patch objects.
Kai
P.S.
Shai, we should resolve all/most outstanding patches (Color class, surface, and patch), since it gets more complicated to create patches against the svn tree.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
while working on a contourf function, I noticed that patch handles convex polygons only. I think we need support for concave polygons too. This could be solved by at least 2 approaches:
* 1st, use of delaunay to triangulate the polygon, this could be done in patch.m. The resulting 'triangle matrix' could be forwarded to the patch object. The drawback is the dependence on libqhull and a different interface to the patch object.
* 2nd - my favored approach - the use of the OpenGl utilities library. In this case we would add a dependence of libglu to octplot. After a first look into Chapter 11 about tesselation ('red book' [1] ) I think this could be done with limited effort.
So, especially Shai, what do you think? If you agree, I would go forward with the 2nd option and try to implement it.
Kai
[1] http://glprogramming.com/red/chapter11.html
Kai,
I Agree with you completely -- glu is the way to go. Especially since octplot already depends on glu through FTGL which I use for text rendering. (I wasn't aware of this myself, but searching for glu turned this up -- google desktop is sometimes quite amazing). In fact, FTGL does tesselations -- have a look in src/FTGL/FTVectoriser.cpp
Adding the ability to draw convex polygons will greatly improve octplot.
Shai
Hello Shai,
thanks for you response. I take your reference to FTGL just as a remark, to look how they have done it. FTVectorizer.cpp is very specialized for font rendering, so we cannot use it directly for our more general needs.
In the meantime I see the first convex patches on my screen :-) by using the GLU tesselator directly. After some debugging, I hope to send an improved patch object soon.
Kai
My reference to FTGL was indeed a remark -- I just wanted to be sure that we already has GLU as a dependency.
I'm eagerly waiting for your patch patch :)
Shai
Here they are,
have a look at the patch section.
Kai
Shai,
it seems I was to fast, the proposed patch for patch does not work if start and end point of the polygon are identical. I try to find a solution - it seems the combine callback does not work properly.
If you have time, maybe you can try something like:
patch([100 200 300 300 100 100],[100 120 100 200 200 100], 'FaceColor', [0 1 1], 'EdgeColor', 'r');
and see if it dies for you too.
Kai
Kai,
I'll try if I have time, but I don't think I'll have any time in the next few days ...
Thanks
Shai
Shai,
I think I have it now working :-), I'll try to send a revised patch tommorow
Kai
Shai,
please have a look at the revised patch for patch objects.
Kai
P.S.
Shai, we should resolve all/most outstanding patches (Color class, surface, and patch), since it gets more complicated to create patches against the svn tree.