Better HN
topnewbestaskshowjobs
Log inSign up

piotrjaw

45 karma · joined Aug 17, 2020 (6y ago) · 22 submissions

Submissions

comment 3y ago · link · parent

Sure! It's pretty straightforward actually.

The first approach (which is a simplification) uses the usual way to calculate a distance between two points on a FLAT plane, which using is the Pythagorean Theorem. So d = √((y1 - y2)^2 + (x1 - x2)^2).

The second approach uses the haversine formula: https://en.wikipedia.org/wiki/Haversine_formula which takes the curvature of the Earth into account, and also the fact that one degree in longitude is a different distance depending on the latitude.

comment 3y ago · link · parent

Same here, we use GeoJSON for floor plans and it works great. Yeah, too bad that Turf is geographical only, but it still has some nice helpers that are agnostic to the shape of the plane.

comment 3y ago · link · parent

Hey, that was the idea for the next article...

comment 3y ago · link · parent

Indeed, I added a couple of paragraphs in the end explaining the difference and the actual results. As a side note, I actually got slightly different numbers, but maybe that's because of the lower quality of data that I used.

comment 3y ago · link · parent

I've actually added this to the article, thank you again!

comment 3y ago · link · parent

You're correct, this is just a synthetic value used to rank the distances.

comment 3y ago · link · parent

Damn, this is a great point, thank you!

comment 3y ago · link · parent

That is correct, but - as pointed in the article - we work on floor plans, which are flat, so I wanted to simplify this a bit to not create too much issues to solve in one article. That said, it was probably an oversimplification, since actual geographic data (and a map view) was used, point taken.

comment 3y ago · link · parent

Impressive, thank you for sharing!

comment 3y ago · link · parent

Indeed, but the convex hull approach also works for multiple sets of points, in any order.

As for [2], in the article the data is separated into 16 polygons, so the interior lines are actually shared between polygons. It's still possible to union the polygons, but it takes more time than calculating the convex hull.

11.

Calculating the maximum diagonal distance in a given set of points(piotrjaworski.medium.com ↗)

58 points · by piotrjaw · 3y ago · 42 comments

comment 4y ago · link · parent

I wrote a new blog post about Computer Vision in JavaScript - if you want to learn how to create a simple operation pipeline and a custom operation using GammaCV (a JavaScript Computer Vision library), check it out!

13.

GammaCV: A simple custom operation example(piotrjaworski.medium.com ↗)

9 points · by piotrjaw · 4y ago · 1 comment

14.

Implementing a sane back end in Node.js using NestJS, Part II: Project setup(medium.com ↗)

1 points · by piotrjaw · 5y ago · discuss

15.

Implementing a sane back end in Node.js using NestJS, Part I: Architecture(medium.com ↗)

1 points · by piotrjaw · 5y ago · discuss

16.

Microfront ends – should I care?(medium.com ↗)

2 points · by piotrjaw · 5y ago · discuss

17.

How to create a musical instrument using Computer Vision in JavaScript(medium.com ↗)

2 points · by piotrjaw · 6y ago · discuss

18.

How to create a musical instrument with no notes using JavaScript(medium.com ↗)

1 points · by piotrjaw · 6y ago · discuss

19.

Microfront ends – should I care?(medium.com ↗)

2 points · by piotrjaw · 6y ago · discuss