(geometry)Rotating Calipers / Oriented Minimum Bounding Box?

Are there any implementations for, rotating calipers algorithm or any oriented minimum bounding box here in Julia? I could whip one up if not, but preferably one of you wizards has one out there somewhere.

I whipped up the naive versions using the following references:

Code is here: MBR.jl · GitHub

Kinda slow, some of that’s due to the algorithms(not SOTA’s), but also trying to use GeometryBasics.jl made my code a little clunky. I like some of the primitives but sometimes you just need linear algebra :man_shrugging: .

Might be a fun test case for optimization though… Seems to work, but I bet there’s a 1 off error in there somewhere.

here’s a faster version not using GeometryBasics

https://gist.github.com/caseykneale/496bf2ec486fd24ce959ef15fd2edfde

Doubt anyones following along but figured if someone else finds this thread they might appreciate it.

3 Likes

Is this related to your experiments here?

1 Like

It’s related in that both of these are small units of code hobby for projects :). But no these two projects don’t coincide. This is a plop of code that is useful for Computer Vision (other things too). The two things could be made to relate though! Line segment intersections and bounding rectangles are used in video games and other areas.

I have 2-3 pet projects to try and get some attention for job hunts, and I have an invited guest lecture at a large university coming up soon so I have to do some tinkering on a few disparate things.

That sounds good :slight_smile: It seems like you are fit in this stuff; have you considered Grassmann.jl + projective geometric algebra? I’m currently trying to wrap my head around it and trying to implement the PGA cheat sheets - but its a dark path all alone :smiley: and interfacing between Grassmann and the rest of julia is a bit mysterious (to me).