Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I understand production and community code demands a most simple format but for me this program is just a few braces and vertical breaks short of perfection.


You must be a fucking genius then because:

Vec w=nl, u=((fabs(w.x)>.1?Vec(0,1):Vec(1))%w).norm(), v=w%u;

is completely unreadable and that's just one line.


That really just needs some whitespace.

    Vec w=nl, 
        u=((fabs(w.x) > .1 ? Vec(0,1) : Vec(1)) % w).norm(),
        v=w%u;
Simple, right? I can see how it would look like garbage if you miss the three separate variables being initialized, but that should be familiar to most people with C/C++ experience.


% being overloaded as vector cross product is a bit mysterious here (until investigating Vec's definition)

It might be helpful if the instantiations were written fully too, ie. Vec(0,1,0) : Vec(1,0,0)


No its fine and Im certainly no genius. I just dont need whitespace to 'reinforce' code expression - its a visual familiarity thing, quite a general reading skill.

The only confusing thing in this line is the % operator being overloaded on Vecs to mean the cross product. What the calculation is actually for is what takes time to grok, but you cant expect that to be revealed by familiar formatting and expansive variable names.


not that bad.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: