26 ms·
Rotate the world
- djrobstep 13y agoFirefox you're breaking my heart. This performs terribly in FF, fine in Chrome.
- RyanMcGreal 13y agoSame here. Using FF 25 and Chrome 30 on, um, WinXP.
- Trufa 13y agoAs an experiment, I'm testing FF for a week, and a friend is testing chrome, this definitely goes in the against list.
- zero-error 13y agoUp until a couple of weeks ago I was a loyal Chrome advocate. However after the Mozilla team's recent AMA on reddit I decided to switch and since then I really haven't found Firefox inferior at all (aside from a couple of examples like this). So for anyone else looking to make the switch, go for it! The only thing I'm missing about Chrome are the excellent dev tools.
- Trufa 13y agoI've been quite satisfied, most of the things, it's just a matter of adaptation to a new way of doing stuff. My only big issue is that I'm having some performance issues, and that is something I can't live with.
- zero-error 13y agoJust out of interest, where have you found these performance issues? The only thing I've noticed was that it really struggled to scroll down large pages whilst playing a video in another window/tab. Although that quickly fixed itself when I updated my graphics card drivers (completely forgot to do so after installing Ubuntu).
- Trufa 13y agoSometimes just opening a new tab. Facebook seems to lag my whole pc, that might be facebook's fault, but it doesn't happen in chrome. I browse reddit quite a lot, images just seem to render slower (and the render all distorted until finished). Youtube videos seem to go out of focus constantly. Cold start is quite slow, though not unacceptable times, definitely slower. When I load a big page, it seems to take much longer before I can start scrolling. None of this are actually tested, so some may be perception, but in general terms, it actually feels quite slower, not bad, but not snappy.
- tbob22 13y agoIf you are using Windows you might want to give Pale Moon a try, on my system it is much smoother than the official Firefox/Aurora/Nightly. Pale Moon feels as smooth as the official Firefox does under OS X, for whatever reason the official Firefox for Windows feels terrible on my system (clean profile of course).
- dclowd9901 13y agoIt could be that his logic optimizes for chrome. I'm sure with a bit more time, he could make it work smoothly in FF... Or fuck it, just write it in ASM, which would be insanely faster.
- bzbarsky 13y agoI doubt the issue is the JS logic. Firefox on Mac has nothing like the lag people are talking about on Linux/Windows, which suggests the issue is somewhere in platform-specific drawing code. Hard to say for sure without a profile.
- 1wheel 13y agoThe issue isn't any sort of optimization for chrome, FF just chokes when it tries to render SVGs quickly. See also: http://roadtolarissa.com/twisters/ http://roadtolarissa.com/twisters/
- jasondavies 13y agoI've just reduced the resampling slightly, using precision(.5) instead of precision(.1), not sure if that helps much.
- ErikRogneby 13y agoJust for kicks I tried it out on chrome on my Nexus 4. It renders great, but the movements are jerky. There are some conflicts between zoom on the page and zoom on the globe. I'm impressed it worked at all on mobile.
- SeanDav 13y agoUnless I missed it, where does one get the continent shapes and country outlines?
- d55 13y agoI think https://github.com/mbostock/topojson https://github.com/mbostock/topojson is what you're looking for
- Sprint 13y agoView source. ;) It's jasondavies.com/maps/world-110m.json which is from http://www.naturalearthdata.com/downloads/110m-physical-vectors/ http://www.naturalearthdata.com/downloads/110m-physical-vect...
- iSnow 13y agoOne of the Wikipedia world map SVG's could be used: http://en.wikipedia.org/wiki/Wikipedia:Blank_maps#World http://en.wikipedia.org/wiki/Wikipedia:Blank_maps#World
- jasondavies 13y agoThe files used are from Mike Bostock’s World Atlas TopoJSON project: https://github.com/mbostock/world-atlas https://github.com/mbostock/world-atlas They are in turn derived from Natural Earth data: http://www.naturalearthdata.com/downloads/110m-cultural-vectors/ http://www.naturalearthdata.com/downloads/110m-cultural-vect...
- BitMastro 13y agoThis is just my personal preference, but I believe the naive implementation is miles ahead of the improved ones. The improved version needs at least two movements to go to the other side of the world, doesn't follow the rotation if the cursor is too fast and worse than all, performs a gamma rotation for each non-equatorial point of the sphere. Since we have two degrees of freedom on the screen, I expect to use them to drive the two most used rotations, and maybe have another control for the roll. In addition, we are used to have maps with North pointing up (and sometimes pointing South), so the roll is almost never used.
- cousin_it 13y agoAgreed. You could slightly improve the naive implementation by restricting the north-south rotation so you can't go beyond either pole, so north always stays up. It's not just for the Earth either, I'm now working on a 3D object editor and decided on the naive implementation there as well, because when you're sculpting a chair, it's annoying if up doesn't stay up.
- BitMastro 13y agoPlease do, when I used some 3D editors with that behaviour I was going crazy.. Then I had to remember to restrict the rotation using a modifier or a button. I don't know where I've seen this, but I think dragging an arc drawn outside the object to adjust the roll is the best solution to the problem.
- davedx 13y agoI agree with you. I sometimes accidentally rotate Google Maps on my phone when zooming, and it annoys the hell out of me. I'm sure there might be a use case for orienting the map so north isn't up (for example, if you want to look at a route to a place with the place at the top of the map), but I haven't needed it yet. It's much more likely that if I'm using two fingers to gesture on a map, it's because I want to just zoom in and out, not rotate it.
- delinka 13y ago
- willvarfar 13y agoI have a couple of questions, and I'm unfamiliar with the Javascript frameworks so I struggle a bit to find the answers in the source: Are the globes drawn with perspective? And can it suffer from gimbal lock?
- seabee 13y agoSince it's based around quaternions it shouldn't suffer from gimbal lock. As for perspective, what do you mean by that? Aren't globes always in perspective?
- willvarfar 13y agoYou can draw orthogonally too. I've messed around with globes and had problems spinning them, hence my curiosity. http://www.ludumdare.com/compo/minild-40/?action=preview&uid=10313 http://www.ludumdare.com/compo/minild-40/?action=preview&uid...
- robinhouston 13y agoThe globes are projected orthographically. There is no perspective.
- willvarfar 13y agoCheat! What I thought :(
- edoloughlin 13y agoAnyone else tried this on Linux? On Mint 15 and Ubuntu 13.04 FF25 is has >1 second lag. Chrome 30 is fine.
- Rampoina 13y agoSame thing on Arch linux.
- tgb 13y agoSame on Mint15 with FF25. It's awesome on Chrome, though!
- rtkwe 13y agoIt's pretty laggy on Windows 7 FF24 too.
- Ygg2 13y agoAnd FF 25 as well.
- Trufa 13y agoI think it's firefox not linux.
- bzbarsky 13y agoFirefox on Mac is fine (well, more or less; I just filed https://bugzilla.mozilla.org/show_bug.cgi?id=936472 https://bugzilla.mozilla.org/show_bug.cgi?id=936472 on the slight lag I see there), which suggests the actual issue is cairo's path drawing code, which is not used by Firefox on Mac, but is used on Windows and Linux.
- Touche 13y agoDefinitely laggier on FF on Mac than Chrome.
- 13y ago
- TipiPerka 13y agoVery nice. Makes me think of http://aladin.u-strasbg.fr/AladinLite/app/?survey=P/Mellinger/color&zoom=160&cooFrame=gal&target=sgr+a* http://aladin.u-strasbg.fr/AladinLite/app/?survey=P/Mellinge...
- 0x0 13y agoIsn't this also called "Arcball rotation"? The biggest advantage over the naïve implementation is no un-intuitive "sideways" rotation after a few sequences of rotation.
- po84 13y agoI've heard "trackball rotation" but yep, you're spot on. To give an example, rotate both the unimproved and improved globes so you're facing Antarctica dead on. Then try dragging left and right. The improved is far more intuitive to me at this point.
- cscheid 13y agoThe important thing in this demo is that his code reduces to arcball-like rotation in the globe projection, but works on arbitrary map projections. Notice how the interaction works for Eisenlohr's projection in the same way as the globe, but the behavior must be different, of course, since the projections are so unlike each other.
- Jack000 13y agotrackball is what I've been using. Trackball vs turntable is a bit of a religious battle in certain 3d modelling circles.
- sz4kerto 13y agoWow, that's _exactly_ what I needed yesterday. Thanks a lot. .. however, some more explanation for how the improved rotation works would have been useful.
- Trufa 13y agoSlightly off topic, but I was so surprised how steep the Axial tilt is (http://en.wikipedia.org/wiki/Axial_tilt http://en.wikipedia.org/wiki/Axial_tilt) I had always known that it was 23º but never actually visualized it. Try putting γ=23º in the Euler angles and rotate the earth with λ.
- cLeEOGPw 13y agoAre the scale of continents right? Because Australia looks almost bigger than Europe, and Africa looks many times bigger than Europe.
- edoloughlin 13y agoAfrica is much larger than you expect if you grew up looking at Mercator projections: http://brucemctague.com/tag/illusion-of-mercator-projections http://brucemctague.com/tag/illusion-of-mercator-projections
- jboynyc 13y agoThe true size of Africa: http://flowingdata.com/2010/10/18/true-size-of-africa/ http://flowingdata.com/2010/10/18/true-size-of-africa/ The historian Marshall Hodgson referred to the Mercator projection as the "Jim Crow projection." This is why.
- cLeEOGPw 13y agoI found my mistake. When looking at Europe for some reason I mentally subtracted first the Scandinavia and then Russia, that's why it seemed so tiny. Looking at wiki I can see Africa is only 3 times larger than Europe, which is what I would have expected.
- mxfh 13y agoTry rotating this :) http://mxfh.github.io/d3canvasglobes/#GRL http://mxfh.github.io/d3canvasglobes/#GRL
- bebop 13y agoGreat work! This is a really nice use of d3 and a great visualization tool.
- ananth99 13y agoBrilliant stuff! Would've been better if it had the names of the places. Kinda like a virtual globe. ;)
- valtron 13y agoAnother way of doing this (without versors): Let u and v be the unit vectors of the initial and final click location. We want an R s.t. Ru = v. Create an orthonormal basis ON(u) and ON(v) (you can use the QR decomposition for the vector concatenated with I). R = ON(v) ON(u)^-1 = ON(v) ON(u)^T
- deleted 13y ago[deleted]
- deletes 13y agoRotating maxed out my cpu in both chrome and firefox but only chrome didn't stutter.
- dalyons 13y agoAs an experiment I used this D3 geo stuff to visualize my last year or so across the globe: http://dalyons.github.io/where-is-dave/index.html?use_cached=true&ga=true http://dalyons.github.io/where-is-dave/index.html?use_cached... Works much better on chrome than FF unfortunately. I thought it turned out pretty cool, as a practical example of what you can use this stuff for. It was super fun to build, D3 is pretty awesome. You can also load your own photos from FB if you want to see your own track, its just static html/js, i dont store anything anywhere.
- wingerlang 13y agoCool. This is pretty much exactly what I've been thinking of doing. The path, pictures and map - more or less spot on.
- sddhrthrt 13y agoIndia is distorted - Kashmir and all. You better be careful about the borders that are under dispute. I took into consideration that it's a low-res border, even then it's way off. I dont know if the details of map itself are important or not, because I understand it's an exhibition of the interface itself. Just my opinion.
- fijal 13y agoPlease Please Please include "show the shortest path between points A and B".
- dllthomas 13y agoMan oh man, do I hate Euler angles...
- hcarvalhoalves 13y agoIt's more useful when you keep the north at north.
- kosma 13y agoI've been writing accelerometer coordinate system rotation code for the whole day. Almost melted my brain; trying to imagine 3D rotation is hard, especially when you lack the proper tools and have very little experience with it. Finally got the thing working; decided to have one last look at HN before going to bed. It was then when I saw "Rotate the world" and thought to myself: "well this better not be about Euler angles!" Yup. Thanks pjan, you made my day brighter :)
- Aardwolf 13y agoThis is like 100 times faster in Chromium than in Firefox (on Linux). Any idea why? Is JS in FF really that much slower?