Wednesday, June 21, 2006

So kinda a fustrating day today. I didnt get much done, probably a hazzard of working at home. I'm still trying to implmenet a Voronoi algorithm, but got sidetracked into the details. The number of algorithms that exist for clipping a line to the insides of a polygon (a necessary part of voronoi) are huge, and i spent the morning just trying to find one that wasn't too slow, but wouldn't take forever to implment.

In the evening I ened up at a Jazz concert at Girton, tis a reall poncy college (photo top) in Cambridge, somewhere that Wills would of given his back teeth to have in Bristol (but just blends in with general cambridge poncy buildings). It did get me thinking about the roofs in the above photo (while not listening to my little brothers clarinet solo). To build a roof with a slight overhang, all you need is to add a hole to the inside of the roof. Here it is!:

Google video now has to be verified (since i started the blog) but has beter colour reproduction. YouTube has naff colour but no edge aliasing errors.

The other thing that this video shows at the end is the strange effect of two split events at the same location not being treated correctly. It starts to go wrong at the top of the gabled roof, and spreads upwards. It still generate a valid roof, but part of it is upside down. To solve this I either need to ensure that no perfect rectangles are present (unlikely in real architecutre) or spend a day adding code to collect split events...but its not needed now so it'll wait.

Last thing I finally figured out the maths for my parametric line clipper. I think its just a Cyrus and Beck repetition, using GCSE math, but I hadn't done any real thinking about maths for 3 years so it took a while:
It means that the line segments can clipped against cells in the Voronoi. I used the cross product from the two lines to determine if the maximum or minimum parametric value should be set. If, by the end there is no start or end or the min is greater than the max then the line has been clipped out of existance. Its also nicely efficient as it just by keeps track of the max and min paramatric value (t2 above).

No comments:

Post a Comment