<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,6 +1,8 @@
 &lt;?xml version='1.0'?&gt;
 
 &lt;extension name=&quot;SwankREPL&quot; version=&quot;1.2&quot;&gt;
+  &lt;import name=&quot;Tools&quot; /&gt;
+  
   &lt;plugin class=&quot;org.reprap.artofillusion.SwankPlugin&quot;/&gt; 
   &lt;plugin class=&quot;org.reprap.artofillusion.SwankTool&quot;/&gt; 
 </diff>
      <filename>extensions.xml</filename>
    </modified>
    <modified>
      <diff>@@ -15,7 +15,9 @@
             Vec3)
            (artofillusion.object
             ObjectInfo
-            CSGObject)))
+            CSGObject)
+           (artofillusion.tools
+            ExtrudeTool)))
 
 ;;; Manipulating the scene itself:
 
@@ -246,12 +248,15 @@ parent.&quot;
 ;;; Primitive polygons:
 
 (defn vectors-polygon [vectors closed]
-  (let [smooth-array (make-array Float/TYPE (count vectors))]
-    (new Curve
-         (into-array Vec3 vectors)
-         smooth-array
-         Mesh/NO_SMOOTHING
-         closed)))
+  (let* [smooth-array (make-array Float/TYPE (count vectors))
+         object-3d (new Curve
+                        (into-array Vec3 vectors)
+                        smooth-array
+                        Mesh/NO_SMOOTHING
+                        closed)]
+    (if (.canConvertToTriangleMesh object-3d)
+      (.convertToTriangleMesh object-3d 0.0)
+      object-3d)))
 
 (defn star [&amp; n-inner-outer-and-keys]
   (object-info-ify [[n inner outer] n-inner-outer-and-keys]
@@ -272,6 +277,41 @@ parent.&quot;
                  (concat vectors [inner-vector outer-vector])))
         (vectors-polygon vectors true)))))
 
+;;; Extruding polygons:
+
+(defn vector* [x y z]
+  (new Vec3 x y z))
+
+(defn extrude [&amp; object-segments-twist-direction]
+  (object-info-ify [[object direction segments twist]
+                    object-segments-twist-direction]
+    (let [twist (or twist 0.0)
+          direction (apply vector* direction)
+          object-3d (if (isa? (class (.getObject object)) TriangleMesh)
+                      (.getObject object)
+                      (.convertToTriangleMesh (.getObject object) 0.1))
+          smooth (make-array Float/TYPE segments)]
+      (if object-3d
+        (let [vectors (loop [index 0
+                             vectors []]
+                        (if (&lt; index segments)
+                          (let [vector (new Vec3 direction)]
+                            (aset smooth index (float 1.0))
+                            (.scale vector (/ index segments))
+                            (recur (+ 1 index)
+                                   (conj vectors vector)))
+                          vectors))]
+          (ExtrudeTool/extrudeMesh object-3d
+                                   (new Curve
+                                        (into-array Vec3 vectors)
+                                        smooth Mesh/APPROXIMATING
+                                        false)
+                                   (.getCoords object)
+                                   (make-cs :absolute 0 0 0 0 0 0)
+                                   (* twist (/ Math/PI 180))
+                                   true))))))
+
+
 ;;; A surface syntax for specifying object trees:
 
 (defn make-tree [keys &amp; root-objects]</diff>
      <filename>src/org/reprap/artofillusion/objects.clj</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>f7d52ffeddc106f49b319691bde4005599c57055</id>
    </parent>
  </parents>
  <author>
    <name>Andreas Fuchs</name>
    <email>asf@boinkor.net</email>
  </author>
  <url>http://github.com/antifuchs/aoi-swank-plugin/commit/63f9135bfdeea575a32b874336cba937c9f4630d</url>
  <id>63f9135bfdeea575a32b874336cba937c9f4630d</id>
  <committed-date>2009-03-31T10:51:41-07:00</committed-date>
  <authored-date>2009-03-31T10:51:41-07:00</authored-date>
  <message>Add extrude function: Can now make a twisted 3d object from polygons!</message>
  <tree>2e8813c9903bbb268595662469a0e410f647bf21</tree>
  <committer>
    <name>Andreas Fuchs</name>
    <email>asf@boinkor.net</email>
  </committer>
</commit>
