So, I was thinking one day when working on this scheme I have for this unstructured finite difference PDE thing that is one of these never-ending ongoing programming projects of mine.
Wouldn’t it be great if you could take shapes and operate one them as if they were data-types?
Well now you can! At least in 2d. This is pretty much still a work in progress on my part. I intend to add the 3d version of this same logic after I work up the plane-projection and point identification nonsense.
This library has some limitations, but it basically provides you with some shape classes and binary operators (union, intersect, difference). (fairly wide-open ones at that – I’ve tried the whole keeping data private thing, and it just introduces a lot of rigidity IMO. Eventually you want to feed these to some other algorithm, or pry them apart to do something else with, and doing that through entirely redundant set and get members is a waste of time. Why is this part of OO coding practice?)
The shape classes can have arbitrary holes. It’s based on oriented planar straight-line graph stuff.
Anyway, what do you think? Does this sound useful to you guys? I can post the code when it’s properly commented and cleaned up if so. It’ll be useful to me when I finally get the 3d stuff working, so I can build arbitrary 3d shapes.
Comments (0)