<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Smallest Covering Circle in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Smallest-Covering-Circle/m-p/116627#M39981</link>
    <description>&lt;P&gt;Thanks a lot for the insight! I haven't fully implimented this yet but it seems like this might work for me.&lt;/P&gt;</description>
    <pubDate>Wed, 20 Feb 2019 12:22:13 GMT</pubDate>
    <dc:creator>kvnsngr</dc:creator>
    <dc:date>2019-02-20T12:22:13Z</dc:date>
    <item>
      <title>Smallest Covering Circle</title>
      <link>https://community.jmp.com/t5/Discussions/Smallest-Covering-Circle/m-p/113680#M39872</link>
      <description>&lt;P&gt;I have a need to determine the smallest circle covering a group of 10 points (specifically the diameter of said circle). Does anyone have an idea of how I can calculate this in JSL?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Feb 2019 18:38:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Smallest-Covering-Circle/m-p/113680#M39872</guid>
      <dc:creator>kvnsngr</dc:creator>
      <dc:date>2019-02-14T18:38:47Z</dc:date>
    </item>
    <item>
      <title>Re: Smallest Covering Circle</title>
      <link>https://community.jmp.com/t5/Discussions/Smallest-Covering-Circle/m-p/113685#M39875</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/9343"&gt;@kvnsngr&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Are you referring to the smallest enclosing circle problem. If yes, do you have an algorithm in mind that you want to implement in JMP ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Feb 2019 20:09:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Smallest-Covering-Circle/m-p/113685#M39875</guid>
      <dc:creator>uday_guntupalli</dc:creator>
      <dc:date>2019-02-14T20:09:54Z</dc:date>
    </item>
    <item>
      <title>Re: Smallest Covering Circle</title>
      <link>https://community.jmp.com/t5/Discussions/Smallest-Covering-Circle/m-p/113687#M39877</link>
      <description>&lt;P&gt;Forgive me, I'm not very informed on the topic. But I found a paper by&amp;nbsp;&lt;SPAN&gt;Sven Skyum that seemed to have an effcient algorithm.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Feb 2019 20:24:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Smallest-Covering-Circle/m-p/113687#M39877</guid>
      <dc:creator>kvnsngr</dc:creator>
      <dc:date>2019-02-14T20:24:25Z</dc:date>
    </item>
    <item>
      <title>Re: Smallest Covering Circle</title>
      <link>https://community.jmp.com/t5/Discussions/Smallest-Covering-Circle/m-p/113696#M39878</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/9343"&gt;@kvnsngr&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;BR /&gt;&amp;nbsp; &amp;nbsp;Well I really want to help you, however I would recommend and request that you try and at least come up with&amp;nbsp; good pseudo code on what you would like the community to help with. If you could come up with a pseudo code, I or other community members can lead the way on how to achieve the pseudocode in JMP.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Feb 2019 21:09:52 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Smallest-Covering-Circle/m-p/113696#M39878</guid>
      <dc:creator>uday_guntupalli</dc:creator>
      <dc:date>2019-02-14T21:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: Smallest Covering Circle</title>
      <link>https://community.jmp.com/t5/Discussions/Smallest-Covering-Circle/m-p/113701#M39879</link>
      <description>&lt;P&gt;Don't know how to calculate an exact answer, but this seems to iterate to an approximation.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Update, 15feb2019 - this does not work well if there are only two points on the circle, see picture at end.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;&lt;STRIKE&gt;see slightly&amp;nbsp;better&amp;nbsp;JSL&amp;nbsp;below&lt;/STRIKE&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Circle shrunk to fit the points" style="width: 637px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/15649iCE364CBB456F4DCA/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Circle shrunk to fit the points" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Circle shrunk to fit the points&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Here's the two point case that is not going to work well:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="can't find the center very well with only two points" style="width: 604px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/15650i81ABB6B2A808533D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="can't find the center very well with only two points" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;can't find the center very well with only two points&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;You could test for that and take the average of those two points when the third nearest point isn't at the radius, but that is getting clumsy and might have more issues. If you need an exact answer, you should look into the wikipedia answer.&amp;nbsp;&lt;A href="https://en.wikipedia.org/wiki/Smallest-circle_problem" target="_blank" rel="noopener"&gt;https://en.wikipedia.org/wiki/Smallest-circle_problem&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;might be hard...&amp;nbsp;&lt;A href="https://stackoverflow.com/questions/33443006/understanding-algorithm-for-finding-the-smallest-circle-enclosing-points" target="_blank" rel="noopener"&gt;https://stackoverflow.com/questions/33443006/understanding-algorithm-for-finding-the-smallest-circle-enclosing-points&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is a little better, but the &lt;SPAN&gt;Welzl algorithm should give exact answers in less time&lt;/SPAN&gt;:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;points = J( 33, 2, Random normal( 50, 20 ) ); // make 33 random points

nrows = N Rows( points );

kdt = KDTable( points ); // make a nearest row look up table

center = Mean( points[0, 1] ) || Mean( points[0, 2] ); // pick a starting point
radius = 1e99; // make it big enough 
fraction = .2; // fractional distance to move the center towards farthest point
For( i = 1, i &amp;lt; 1000, i++, // usually stops around 700
	{indexes, distances} = kdt &amp;lt;&amp;lt; knearestrows( nrows, center ); // just need farthest point, but get them all

	farthest = indexes[nrows]; // last one is far away
	howfar = distances[nrows];
	If( howfar &amp;gt; radius, // if oscillating, make the fraction smaller
		fraction = fraction * .9; // .5 stops the iterations too soon and gives really poor answers for 2-points on circle case
		Show( i, fraction );
		If( fraction &amp;lt; 1e-15, // good enough
			Break()
		);
	);
	radius = howfar; 
	// move slightly toward the farthest point
	center = center + fraction * (points[farthest, 0] - center);

);


New Window( "Example",
	Graph Box(
		Frame Size( 500, 500 ),
		X Scale( -30, 130 ),
		Y Scale( -30, 130 ),
		Marker( Marker State( 3 ), points[0, 2], points[0, 1] );
		Pen Color( "Blue" );
		Circle( {center[2], center[1]}, radius );
		fill Color( "red" );
		Pen Color( "red" );
		Circle( {center[2], center[1]}, 2.0,"FILL" );
		for(i=nrows,i&amp;gt;nrows-3,i--,
			for(j=i,j&amp;gt;nrows-3,j--,
				line({points[indexes[i],2],points[indexes[i],1]},{points[indexes[j],2],points[indexes[j],1]})
			)
			
		);
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="center is closer" style="width: 425px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/15652i654B0C9F9768D205/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture1.PNG" alt="center is closer" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;center is closer&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Feb 2019 12:19:30 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Smallest-Covering-Circle/m-p/113701#M39879</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2019-02-15T12:19:30Z</dc:date>
    </item>
    <item>
      <title>Re: Smallest Covering Circle</title>
      <link>https://community.jmp.com/t5/Discussions/Smallest-Covering-Circle/m-p/113947#M39925</link>
      <description>&lt;P&gt;Best description I found:&amp;nbsp;&lt;A href="https://www.nayuki.io/page/smallest-enclosing-circle" target="_blank" rel="noopener"&gt;https://www.nayuki.io/page/smallest-enclosing-circle&lt;/A&gt;&amp;nbsp;with implementations in several languages and a live demo on the page.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Feb 2019 23:05:06 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Smallest-Covering-Circle/m-p/113947#M39925</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2019-02-17T23:05:06Z</dc:date>
    </item>
    <item>
      <title>Re: Smallest Covering Circle</title>
      <link>https://community.jmp.com/t5/Discussions/Smallest-Covering-Circle/m-p/116627#M39981</link>
      <description>&lt;P&gt;Thanks a lot for the insight! I haven't fully implimented this yet but it seems like this might work for me.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Feb 2019 12:22:13 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Smallest-Covering-Circle/m-p/116627#M39981</guid>
      <dc:creator>kvnsngr</dc:creator>
      <dc:date>2019-02-20T12:22:13Z</dc:date>
    </item>
  </channel>
</rss>

