Life as Clay

Obj-C Voronoi library

with 6 comments


I ported Raymond Hill’s excellent Javascript-Voronoi library to Objective-C. You can find it on github here: https://github.com/ccheaton/objcvoronoi

 

Advertisements

Written by Clay

March 28, 2012 at 21:08

6 Responses

Subscribe to comments with RSS.

  1. Really great, thanks a lot for sharing ! I managed to port it in a Quartz Composer plugin. I only have a little problem. Sometimes (with a non-rotated square for example) I have a “[CircleEvent release] : message sent to deallocated instance”. Do you use ARC in the main app ?

    benoitlahoz

    March 18, 2013 at 11:51

  2. Yep, it’s ARC enabled. To be honest, I haven’t looked at it in close to a year; it would take some code archeology for me to figure out what’s going on. Did you try debugging to locate where the CircleEvent is being released? I don’t recall ever seeing that issue. By the way, I’d love to see what you come up with when you are finished with your project.

    Clay

    March 18, 2013 at 12:01

  3. Thanks for your answer ! Well… assuming the leak for the moment, I retained the CircleEvent and all works fine… except for non-rotated square or non-rotated circles made of vertices (???). It’s crashing on an objc_msgsend before detaching rArc at some place in the Voronoi.m code. But… I still confirm : very great work ! I’ll be glad to show you my results…

    benoitlahoz

    March 18, 2013 at 16:24

    • Hmm. Well, it’s hard for me to really know what’s going on when I haven’t seen your code or what you’re trying to do. Maybe if you translate the canvas before drawing to it instead of translating the elements that you’re drawing (if you know what I mean), then it won’t be a problem?

      Clay

      March 19, 2013 at 10:06

  4. By the way (and sorry for flooding…) is there a way to output the cells as polygons, “walking” on edges of the cells ? Thank you !

    benoitlahoz

    March 18, 2013 at 16:28

    • You easily can use the results data to create polygons. I did that in a followup project that uses the same code library. The relevant bit of code (again, something I haven’t looked at in a while) is here:

      Clay

      March 19, 2013 at 10:11


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: