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

So, I actually built this exact thing, a long long time ago, for Adobe when they were building their browser plugin. Mine was a 3D molecule viewer.

I had almost the exact same math in there and it performed about the same until I showed it to an old-school guy I worked with who used to do game programming at sega. He goes "try this" and proceeds to replace a couple screens of trig with:

    d = 0.001;
    x = x + d * y;
    y = y - d * x;
This rotates an object around the z axis with enough fidelity to spin on the screen for days. Making d smaller makes it turn less, but is more accurate. You can repeat this with x and z to rotate around y, or y and z to go around x.

It took me a lot longer than I'd care to admit to understand why that works, but it does. Maybe this will help you. I also tried doing solid models, but the layering was difficult enough that I lost interest and focused on wireframes. If you'd like I can try to find my old source for this.



Consider applying for YC's Summer 2026 batch! Applications are open till May 4

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

Search: