Better HN
topnewbestaskshowjobs
Log inSign up

mourner

1,755 karma · joined Jul 10, 2011 (15y ago) · 224 submissions

Engineer at Mapbox, creator of Leaflet, open source enthusiast, algorithms geek, speaker, musician (Obiymy Doschu), baker, father of twin girls, Ukrainian. agafonkin.com
Submissions

comment 1mo ago · link · parent

The commenter probably meant https://github.com/iShape-Rust/iTriangle, a sibling library that is indeed quite fast at triangulation, especially on bigger inputs

comment 1mo ago · link · parent

Very high constants and high implementation complexity — I attempted it and gave up before coming up with earcut (Seidel was both slower and less robust on typical map data). Maybe worth another attempt — working on algorithmic libraries is much easier now thanks to LLM-driven validation/optimization loops.

comment 1mo ago · link · parent

For practical data, a faster approach is usually to triangulate without validation, then just measure if triangulation is valid afterwards (which is simply comparing the sum of triangle areas with polygon area)

comment 1mo ago · link · parent

Having triangulation conform to Delaunay is a big advantage though! You should also try out https://github.com/mapbox/earcut.hpp for the benchmark — it got a refine function recently that refines earcut output to Delaunay as well, and earcut+refine is still pretty fast.

comment 1mo ago · link · parent

Hey Evgen, Earcut author here — thanks for the writeup and a really cool library! I need to see if there are any tricks to borrow for Earcut's JS version. :)

One thing to note is that I deliberately had to reject some of the potential optimizations to keep the library small, so that bundle size doesn't blow up — for most practical applications (e.g. Mapbox GL JS), it's already fast enough (and 4.1k min/gz). Curious how big the WASM build of Earstrip is.

On the C++ side, Mapbox now uses a hybrid approach where small polygons are processed with earcut.hpp, while big and complex polygon switch to a different algorithm based on monotone decomposition, because while it has higher constants in algorithmic complexity, it scales much better with input size.

comment 3mo ago · link · parent

Initially (about 15 years ago - it was my first ever open source library!) it was based on Astronomy Answers articles that are thankfully still live at https://www.aa.quae.nl/en/reken/zonpositie.html, but v2.0 specifically was rewritten to use the approach described in Jean Meeus' Astronomical Algorithms book.

comment 3mo ago · link · parent

Author of suncalc (the JS library behind the sun calculations) here — happy to see such a nice application of it! Heads up if the author's reading this — I recently released a major overhaul of the library that makes it a lot more precise: https://github.com/mourner/suncalc

comment 3mo ago · link · parent

Oh, a fellow Ukrainian! Was pleasantly surprised to see that fountain on HN — I was just walking around it a few days ago, very nice and peaceful spot this time of year.

9.

Show HN: SunCalc v2 – a tiny JavaScript library for sun and moon calculations(github.com ↗)

3 points · by mourner · 5mo ago · discuss

comment 5mo ago · link · parent

Nice article! As someone who implemented both clustering and heatmaps in Mapbox / Maplibre GL JS, just wanted to add that clustering isn't just a visualization technique — it's also a performance feature that can support other visualization types. It might not matter for 30k points, but for e.g. 300k, you can implement dot density with stacked opacity via clustering — use a tiny clustering radius, and style the dots so that opacity is a function of point_count. This creates an approximation of an unclustered viz that performs much smoother. Same thing with heatmaps — you can define heatmap-weight as a function of clustered source's point_count, and it will look nearly identical (aside minor shifts) as the unclustered one, but perform much better.

comment 8mo ago · link · parent

Amazing achievement, congratulations! Can't seem to be able to read it though, it greets me with "Sorry, you have been blocked" CloudFlare page — is this a HN overloading the website, or did the host accidentally block IPs from Ukraine perhaps?

comment 10mo ago · link · parent

You can read more about why most web maps are like this and a quest to fix this in this article: https://www.mapbox.com/blog/adaptive-projections

comment 10mo ago · link · parent

> Perhaps you see this conflict from the perspective of a sports fan

I see this from the perspective of a Ukrainian living in Kyiv. Your ignorance is mind-boggling, and after the laughable mention of "NATO biolabs" there's truly no sense in further conversation. These tinfoil-head "I do my own research" people are something else.

comment 10mo ago · link · parent

Russian war industry just burns reserves for nothing — hundreds of billions spent on missiles and long range drones didn't achieve any strategic objectives, all those expensive modern tanks, armored vehicles and artillery systems gets demolished by $500 drones, russian soldiers mass switching from military vehicles to donkeys, horses, bikes & buggies. Russia is no longer able to defend their vast territory against Ukrainian long range attacks so their oil refineries and military factories explode every day. 150k+ verified deaths (with names) already vastly exceed any russian wars since WW2 and we know there are many times more unverified ones.

Sevastopol nuclear base is irrelevant to modern warfare, and the fleet (both ships and subs) is either on the bottom of the sea (like the flagship Moskva) or gone to hiding in Novorossiysk because they can't defend against cheap Ukrainian naval drones.

Capture of cities not on the agenda — of course every time they fail spectacularly at something they'll claim they didn't plan it anyway, lol. They attempted and failed the capture of Kyiv, Kharkiv, Chernihiv, Sumy & Mykolaiv, then had to flee from Kherson & much of the Kharkiv oblast, and they are no longer strategically able to attempt capturing any more — only slow creep over obliterated rubble of small towns by sacrificing a thousand people a day in meat grinders.

I can't believe you can be so delusional, it's just amazing what russian propaganda does to people.

comment 10mo ago · link · parent

Soviet stockpiles nearly depleted, 1.5 million dead or wounded, Black Sea fleet practically destroyed, third of strategic bomber fleet destroyed, economy in downfall, no major cities captured in 4 years of all out war, gas and oil revenues plummeting, and there are STILL people saying “oh they just didn’t even start for real yet, just you wait”, gosh. Just laughable.

comment 1y ago · link · parent

Yeah, I think I last updated that website even before I released the first version of Leaflet. Life is very hectic at the moment, but I do really want to get to it sooner than later and modernize everything.

comment 1y ago · link · parent

Wrote it 14 years ago! https://github.com/mourner/suncalc/ It's a bit neglected but I'll do some upkeep shortly...

comment 1y ago · link · parent

Author of Suncalc here — this is exactly the kind of stuff I love to see my code being used in, thanks for sharing!

comment 1y ago · link · parent

The updated syntax looks brilliant — can't wait to try it out by upgrading some of my older notebooks! I was worried about the future of Observable since the Canvas announcement — it felt like notebooks were being slowly phased out, but I'm glad to be proven wrong.

Any timeline on bringing the new format to the Web editor? For me, the biggest draw of Observable is being able to instantly start exploring and visualizing some data without ANY setup (creating some local files, installing dependencies, launching a dev server etc.) — just click "New notebook" and off you go, frictionless. I hope this remains a priority.

Also worth mentioning the data viz community aspect, which I used to enjoy a ton — it's a bummer that things like being able to follow certain users and see their new notebooks in a feed were phased out, and that trending notebooks are now hidden under the Help menu instead of being featured on the user's homepage. This might be one of the reasons I stopped coming back to the platform as often, although I realize building a community is very difficult and hard to monetize — just thought I'd share.

comment 1y ago · link · parent

Also worth checking out https://github.com/onthegomap/planetiler, which maybe a bit less mature, but is much faster than Tilemaker.

comment 1y ago · link · parent

Wonderful project! One thing I wish the website would have is being able to find the right book to read out of this enormous list — e.g. showing / sorting by Goodreads ratings (which I realize you might not want to do), or at least having some kind of a "Featured" section with the most critically acclaimed / must read books of the project on one page.

comment 1y ago · link · parent

I used it extensively until Microsoft did that absolutely atrocious “redesign” that tried turning it from a messenger into a flashy social app, making it an unusable ugly mess. Telegram was just starting to grow but I had to switch.

23.

When Does the Barbell Tip Over?(observablehq.com ↗)

1 points · by mourner · 2y ago · discuss

comment 2y ago · link · parent

The problem with map projections in the digital age is what works well on world scale doesn't on street scale and vice versa. As explained in detail in this post: https://www.mapbox.com/blog/adaptive-projections

comment 2y ago · link · parent

Love Bunny too, wonderful service and great team. I wish there'd be an easy way to set up auto-deploy to Bunny Edge Storage on GitHub commit (to avoid doing so manually), but I guess it's not to hard to do through GitHub Actions.

comment 2y ago · link · parent

Got a bunch of PRs adding missing terms after the article, nice :) Thanks for the mention!

comment 2y ago · link · parent

A lovely map — thanks for using Leaflet and keeping that little Ukrainian flag in the corner! Probably needs an attribution for the map added too (looks like it's Carto with an OpenStreetMap-derived basemap).

comment 3y ago · link · parent

Not too fancy, but I built a math model & interactive visualization of my parking spot to understand how to efficiently park there without bumping into anything: https://observablehq.com/@mourner/kinematics-of-reverse-angl...

Discussed on HN here: https://news.ycombinator.com/item?id=21891919

comment 3y ago · link · parent

I've been looking for a replacement to WebGL Stats for a long time — thank you so much for making it! This is indispensable.

comment 3y ago · link · parent

To people missing the joke, this is a quote from ChatGPT that was asked to comment on Tauri in "Dev Mode", taken from comments here https://news.ycombinator.com/item?id=34972791
12345
8