3 ms·
One of the most beautiful pieces of code I've ever read is this: https://github.com/solvespace/solvespace/blob/master/src/srf/ratpoly.cpp https://github.com/so
by phkahler 6y ago
One of the most beautiful pieces of code I've ever read is this:
https://github.com/solvespace/solvespace/blob/master/src/srf/ratpoly.cpp https://github.com/solvespace/solvespace/blob/master/src/srf...
If you have a basic understanding of spline and NURBS surfaces but never knew how you might actually implement that, well there it is. Incredibly readable IMHO.
- kgraves 6y agosorry, but I see no beauty in this.
- phkahler 6y agoYou have to read it to see the straight forward simplicity in it. Like I said, it also helps to have a high level understanding of the subject matter. The culmination at the end - finding the intersection point of 3 parametric surfaces - is artful IMHO.
- mathgladiator 6y agoI'm right there with you.
- paulcole 6y agoI see a lot of beauty in this.
- amelius 6y agoIf you want to write truly beautiful geometric code, watch this: https://www.youtube.com/watch?v=tX4H_ctggYo https://www.youtube.com/watch?v=tX4H_ctggYo Discussed here: https://news.ycombinator.com/item?id=22282452 https://news.ycombinator.com/item?id=22282452
- phkahler 6y agoI kid you not, I just watched that 2 days ago at the suggestion of a friend. It will take more viewings and study to digest. Really amzing!
- brabel 6y agoHm.. my concept of beauty greatly differs from yours. This code looks completely mechanical to me, the opposite of "beautiful" (but it's great code nonetheless). Beautiful code to me involves the creative composition of parts to form a whole in a way that seems obvious only in hindsight, but takes a form of "genius" to come up with. I've written a few compilers and seen how the way you model the problem radically changes how easy/hard the implementation of "features" (as opposed to said "model") becomes. That, to me, is programming beauty, therefore, art. Code that model the problem so well that it brings up clear as water problems you hadn't event thought existed. Code that makes apparently difficult transformations trivial. I wish I could give you some examples, but I can't think of any right now. If you know of some, I'd love to look at it.
- phkahler 6y agoI can appreciate that distinction. The code I linked is mostly clean and readable, but it also does things IMHO very simply - that's not to say it does simple thing though some of them are. I was taken aback the first time I read the last function. I agree that choosing the right definitions and structures can make more problems solvable. That's a major driver of data structure choices - the things we build need to support the things we want to do, and getting that right is also part of the art.