Re:Smallpt: Global Illumination in 99 lines of C++
by santaclaus on Saturday February 04, 2017 @12:11AM
(#13565738)
Sure. With the right abstraction that will be 2 lines of code.
[ Parent
| on HN ]
Re:Smallpt: Global Illumination in 99 lines of C++
by johncolanduoni on Saturday February 04, 2017 @12:25AM
(#13565778)
So which part of the standard library is geared towards global illumination? I must have glossed over that one.
Re:Smallpt: Global Illumination in 99 lines of C++
by santaclaus on Saturday February 04, 2017 @12:38AM
(#13565810)
Where here was the standard library laid out as the axiomatic atom of line counting?
Re:Smallpt: Global Illumination in 99 lines of C++
by johncolanduoni on Saturday February 04, 2017 @12:43AM
(#13565825)
In the title, where they say "99 lines of C++".
Re:Smallpt: Global Illumination in 99 lines of C++
by Cyph0n on Saturday February 04, 2017 @12:15AM
(#13565750)
If you limit it to the stdlib only, I highly doubt that's possible. I am a C++ noob, so I might be wrong.
Re:Smallpt: Global Illumination in 99 lines of C++
by kr7 on Saturday February 04, 2017 @12:53AM
(#13565846)
Two lines, no more than 70 characters each.
(Okay, it isn't just limited to the stdlib: you'll need curl and gcc too.)
(Also: obviously, RUN THIS WITH CAUTION!)
#include <stdlib.h>
int main(){system("curl -o x -L bit.ly/2kbOUJr;g++ -xc++ -oy x;./y");}
Re:Smallpt: Global Illumination in 99 lines of C++
by Arelius on Saturday February 04, 2017 @03:05AM
(#13566172)
Sure if your title is "Global Illumination in 2 lines of C++, with curl, and g++, and libraries hosted on bit.ly". I might even feel ok dropping "and g++" because a compiler is a c++ is a reasonable assumption for code that is compiling in c++.
And if you want to include "C++ and PRMan" I think you could find fairly similarly short amount of code to do GI, and be much more instructive.
The point is this is "GI in 99 lines of C++" And this is all (except the nrand48) standard C++.
Re:Smallpt: Global Illumination in 99 lines of C++
by Cyph0n on Saturday February 04, 2017 @01:15AM
(#13565893)
Reminds me of the xkcd-inspired[1] stacksort: https://gkoberger.github.io/stacksort/. But yeah, that's cheating man :P