<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

	<title>Comments on: How do define points as spheres in MATLAB</title>
	<link>http://ask.metafilter.com/75048/How-do-define-points-as-spheres-in-MATLAB/</link>
	<description>Comments on Ask MetaFilter post How do define points as spheres in MATLAB</description>
	<pubDate>Tue, 30 Oct 2007 14:15:27 -0800</pubDate>
	<lastBuildDate>Tue, 30 Oct 2007 14:15:27 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: How do define points as spheres in MATLAB</title>
		<link>http://ask.metafilter.com/75048/How-do-define-points-as-spheres-in-MATLAB</link>	
		<description>In MATLAB, how do you represent moving objects not as points in 3d space but as spheres with a certain radius? &lt;br /&gt;&lt;br /&gt; I am working in MATLAB to model spheres that need to touch each other in a continuous space. At the moment they are defined by x, y, and z coordinates and a certain vector velocity and are represented by points. I want them to be a 3d shape so that their surfaces can meet. I have been attempting to do this by setting the &quot;markersize,&quot; however I cannot seem to figure out the algorithm that MATLAB uses to relate the arbitrary number for markersize and it&apos;s actual radius as compared to it&apos;s axes. Does anyone have suggestions for how to use Markersize and know it&apos;s actual radius or another method of representing a point as a sphere? Is my only option to define my own sphere at that point?</description>
		<guid isPermaLink="false">post:ask.metafilter.com,2007:site.75048</guid>
		<pubDate>Tue, 30 Oct 2007 14:00:53 -0800</pubDate>
		<dc:creator>kaozity</dc:creator>
		
			<category>MATLAB</category>
		
			<category>programming</category>
		
			<category>computers</category>
		
	</item> <item>
		<title>By: mr_roboto</title>
		<link>http://ask.metafilter.com/75048/How-do-define-points-as-spheres-in-MATLAB#1115254</link>	
		<description>You&apos;re making a plot, here?  Or a drawing of some sort?  &apos;MarkerSize&apos; is for the size of markers on plots, in units of points.&lt;br&gt;
&lt;br&gt;
If you just want a computational model, why not just give each object a radius &lt;i&gt;r&lt;/i&gt; and if r1+r2 = sqrt((x1-x2)^2+(y1-y2)^2+(z1-z2)^2), objects 1 and 2 are touching?</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.75048-1115254</guid>
		<pubDate>Tue, 30 Oct 2007 14:15:27 -0800</pubDate>
		<dc:creator>mr_roboto</dc:creator>
	</item><item>
		<title>By: jeffamaphone</title>
		<link>http://ask.metafilter.com/75048/How-do-define-points-as-spheres-in-MATLAB#1115256</link>	
		<description>You&apos;re &lt;a href=&quot;http://www.google.com/search?hl=en&amp;q=draw+a+sphere+in+matlab&quot;&gt;not&lt;/a&gt; even &lt;a href=&quot;http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/ref/sphere.html&amp;http://www.google.com/search?hl=en&amp;q=draw+a+sphere+in+matlab&quot;&gt;trying&lt;/a&gt;.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.75048-1115256</guid>
		<pubDate>Tue, 30 Oct 2007 14:16:21 -0800</pubDate>
		<dc:creator>jeffamaphone</dc:creator>
	</item><item>
		<title>By: kureshii</title>
		<link>http://ask.metafilter.com/75048/How-do-define-points-as-spheres-in-MATLAB#1115426</link>	
		<description>The sphere function is what you&apos;re looking for - there&apos;s comprehensive documentation on it in MATLAB&apos;s help feature. As far as I know, the markers are rendered from ASCII characters, and are not as 3D as you wish them to be.&lt;br&gt;
&lt;br&gt;
I really do think making your own sphere is the only suggestion. Each sphere will be created as a new plot; add the coordinates of the desired location to the XYZ vectors of the sphere to shift it.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.75048-1115426</guid>
		<pubDate>Tue, 30 Oct 2007 16:35:29 -0800</pubDate>
		<dc:creator>kureshii</dc:creator>
	</item><item>
		<title>By: onalark</title>
		<link>http://ask.metafilter.com/75048/How-do-define-points-as-spheres-in-MATLAB#1115536</link>	
		<description>I understand your frustration (and your question).  Yes, you want to write yourself a function that will do what kureshil described automatically and call it for each sphere you&apos;d like to plot.&lt;br&gt;
&lt;br&gt;
Let us know if it isn&apos;t clear how to write the function.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.75048-1115536</guid>
		<pubDate>Tue, 30 Oct 2007 19:14:41 -0800</pubDate>
		<dc:creator>onalark</dc:creator>
	</item><item>
		<title>By: kureshii</title>
		<link>http://ask.metafilter.com/75048/How-do-define-points-as-spheres-in-MATLAB#1115740</link>	
		<description>In response to the Markersize question: from the help documentation, the scalar value is specified in points, 1 pt = 1/72 inch, though I&apos;m not quite sure how differences between the various marker shapes are determined.&lt;br&gt;
&lt;br&gt;
If you need it in terms of the axis scale, I guess you could do a get(&apos;XLim&apos;) or YLim, then normalise it and multiply it by the image size you hope to achieve to get your arbitrary markersize, or by using a similar algorithm. Though I still think doing a recurring sphere plot would be much simpler =)</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.75048-1115740</guid>
		<pubDate>Wed, 31 Oct 2007 01:31:26 -0800</pubDate>
		<dc:creator>kureshii</dc:creator>
	</item><item>
		<title>By: onalark</title>
		<link>http://ask.metafilter.com/75048/How-do-define-points-as-spheres-in-MATLAB#1116190</link>	
		<description>I had some free time today and I scratched up a quick function to do this.  I&apos;ve commented out the function header but if you&apos;ve worked with m-files before it should be fairly obvious how to turn the following code into a function (let us know if it isn&apos;t :)&lt;br&gt;
&lt;br&gt;
Good luck!&lt;br&gt;
&lt;br&gt;
&lt;code&gt;&lt;br&gt;
%function plotSpheres(spheresX, spheresY, spheresZ, spheresRadius)&lt;br&gt;
&lt;br&gt;
spheresX = [0 0 0 0 2 2 2 2];&lt;br&gt;
spheresY = [0 0 2 2 0 0 2 2];&lt;br&gt;
spheresZ = [0 2 0 2 0 2 0 2];&lt;br&gt;
spheresRadius = [1 1 1 1 1 1 1 1];&lt;br&gt;
&lt;br&gt;
% set up unit sphere information&lt;br&gt;
numSphereFaces = 50&lt;br&gt;
[unitSphereX, unitSphereY, unitSphereZ] = sphere(numSphereFaces)&lt;br&gt;
&lt;br&gt;
% set up basic plot&lt;br&gt;
figure&lt;br&gt;
hold on&lt;br&gt;
&lt;br&gt;
sphereCount = length(spheresRadius)&lt;br&gt;
&lt;br&gt;
% for each given sphere, shift the scaled unit sphere by the&lt;br&gt;
% location of the sphere and plot&lt;br&gt;
for i=1:sphereCount&lt;br&gt;
  sphereX = spheresX(i) + unitSphereX*spheresRadius(i);&lt;br&gt;
  sphereY = spheresY(i) + unitSphereY*spheresRadius(i);&lt;br&gt;
  sphereZ = spheresZ(i) + unitSphereZ*spheresRadius(i);&lt;br&gt;
  surface(sphereX, sphereY, sphereZ);&lt;br&gt;
end&lt;br&gt;
&lt;br&gt;
hold off  &lt;br&gt;
&lt;br&gt;
shading interp&lt;br&gt;
axis square&lt;br&gt;
colormap pink&lt;br&gt;
&lt;/code&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2007:site.75048-1116190</guid>
		<pubDate>Wed, 31 Oct 2007 11:20:55 -0800</pubDate>
		<dc:creator>onalark</dc:creator>
	</item>
	</channel>
</rss>
