LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Smallest circle around N points

Solved!
Go to solution

Darin.K wrote:

 

 

The true genius on my part was putting in that little bug so you had to sift through the code and really understand what was going on.  This way it isn't just a black box.  That's my story and I am sticking to it. 


Smiley Very HappySmiley Very HappySmiley Very Happy

OK I guess you are entitled to the story!  I won't confuse it with fact though. Smiley Wink


"Should be" isn't "Is" -Jay
Message 31 of 39
(1,931 Views)

That was a really fun task to implement and it shure dust off some math for a lot of us. Congratulation to Darin for his code, it is really clean and effective. Actually I was really curious to see the Elzinga-Hearn algorithm in action so I created this VI (min Circle1) with a delay between the iterations to actually see what's going on. I borrowed from Darin his idea for generating random numbers (thanks to you). The code probably also need some cleanup....eventually.

 

Ben

Message 32 of 39
(1,897 Views)

Great job on the original problem.

 

I have a similar problem.  I have a set of N points, and I want the smallest circle that encloses them, but with a few modifications...

 

I know that all of the points lie inside the unit circle (distance from the origin is less than or equal to 1)

 

The resulting smallest circle must also be completely inside the unit circle.  You would think that this would be automatic, but if you can imagine just three points, two of which ar on the unit circle near the right side and one at the origin.  The smallest circle would hit all three points but part of the solution circle will be outside the unit circle.  The only solution that encompasses all three points but remains in or on the unit circle is the unit circle.

 

I will provide some examples if necessary.

 

Thanks

 

- John

0 Kudos
Message 33 of 39
(1,683 Views)

murphyfields,

 

In the case you described the smallest circle would be the unit circle.  You could just included a test that checks if the smallest circle is outside the unit circle and if it is use the unit circle as the smallest circle.  There may be cases where this doesn't work so please include some more examples (and drawings) if you can.

 

Regards,

 

Sam K

Applications Engineer

National Instruments

0 Kudos
Message 34 of 39
(1,648 Views)
Here is an example which shows the data which is contained in the unit circle, the unit circle, and the minimum enclosing circle which falls out of the allowed bounds.
0 Kudos
Message 35 of 39
(1,625 Views)

OOPS, lets try this again

0 Kudos
Message 36 of 39
(1,623 Views)

Saw this post and it sounded interesting, however the EH algorithm just seemed too inefficient.

A quick search uncovers

http://www.personal.kent.edu/~rmuhamma/Compgeometry/MyCG/CG-Applets/Center/centercli.htm

which discusses that the EH algorithm executes in O(n^2) whereas Megiddo discovered an algorithm which executes in O(n).

 

 

Regards and farewell,

 

 

Leif Kirschenbaum

(soon to be ex-test engineer and new reliability engineer)

LabVIEW user since 2.0
Message 37 of 39
(1,589 Views)

Very helpful algorithm...thanks for posting! Any chance someone has an Inscribed circle algorithm (i.e. the maximum circle within an array of points that doesn't include any points)? I realize this is a much harder problem and I've seen some promising papers on how to do it using Convex Hull and Voronoi Diagrams, but before I try from scratch in LabVIEW, I thought I'd see if someone has already done it.

 

http://web.cs.swarthmore.edu/~adanner/cs97/s08/papers/schuster.pdf

 

I also saw the post here:

http://forums.ni.com/t5/LabVIEW/Roundness-calculations/td-p/917930/page/3

but I was getting error -20071 about "Analysis:  The input matrix is not positive definite." for some data sets, so I wanted to see if there was something more robust out there.

 

Thanks,

Brad

 

 

0 Kudos
Message 38 of 39
(1,136 Views)

Thanks perfect

0 Kudos
Message 39 of 39
(643 Views)