From: Michał C. <mi...@gm...> - 2012-04-28 14:18:20
|
Two holes are required because triangulator needs a pointer to the end of data. If I strip that last one '7' and use vertex count I will be forced to allocate new buffer for hole indices, copy it's content and apply 7 at the end. I tried to avoid dynamic allocations in triangulator as much as possible. As I mentioned earlier, better name for an array is 'splits' instead of 'holes'. On 27 April 2012 00:35, Elias Pschernig <eli...@gm...> wrote: > On Thu, 26 Apr 2012 23:53:43 +0200 > Evert Glebbeek <eg...@dd...> wrote: > >> Would it be possible for someone to document >> al_draw_filled_polygon_with_holes and relatives? It's not obvious to >> me how to use them and I can't work it out from the code. >> > > I found an example, I can try document off that maybe: > > float xy[] = { > 0, 0, > 0, 100, > 100, 100, > 100, 0, > > 10, 10, > 90, 10, > 50, 90}; > int holes[] = {4, 7}; > al_draw_filled_polygon_with_holes(xy, 7, holes, 2, color) > > Basically the first 4 xy pairs are a polygon (it can be non-convex). > Then follows another 3 xy pairs denoting a hole. The holes array > specifies the index positions where vertices change direction. So > index 4 is the start of a hole. I never tried more than one hole but > without that 7 it didn't work. > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > -- > https://lists.sourceforge.net/lists/listinfo/alleg-developers -- thedmd, Michał Cichoń Artifex Mundi mi...@gm... http://www.artifexmundi.com |