chiark / gitweb /
Improve performance of rotating 3D objects a bit.
authordaid <daid303@gmail.com>
Fri, 27 Jul 2012 11:48:24 +0000 (13:48 +0200)
committerdaid <daid303@gmail.com>
Fri, 27 Jul 2012 11:48:24 +0000 (13:48 +0200)
Cura/gui/opengl.py
Cura/gui/projectPlanner.py
Cura/util/mesh.py
Cura/util/profile.py

index 1c385e5965d05703a29eb25c3e6cdc060c7141a0..7b2b676c22d1318951740d052c5692001904bea4 100644 (file)
@@ -216,8 +216,8 @@ def DrawSTL(mesh):
                glVertex3f(v3[0], v3[1], v3[2])\r
                glNormal3f(-mesh.normal[i/3][0], -mesh.normal[i/3][1], -mesh.normal[i/3][2])\r
                glVertex3f(v1[0], v1[1], v1[2])\r
-               glVertex3f(v2[0], v2[1], v2[2])\r
                glVertex3f(v3[0], v3[1], v3[2])\r
+               glVertex3f(v2[0], v2[1], v2[2])\r
                glEnd()\r
 \r
 def DrawGCodeLayer(layer):\r
index 5872956ae3645719ebfea0e6575b9ae01dca1c53..35bed71fc8fdcf9f13b81e30fc6b31c1ecb38c41 100644 (file)
@@ -1081,6 +1081,8 @@ class preferencesDialog(configBase.configWindowBase):
                validators.validFloat(c, 0.1)\r
                c = configBase.SettingRow(left, 'Head size - Y towards end (mm)', 'extruder_head_size_max_y', '0', 'Size of your printer head in the Y direction.', type = 'preference')\r
                validators.validFloat(c, 0.1)\r
+               c = configBase.SettingRow(left, 'Head gantry height (mm)', 'extruder_head_size_height', '0', 'The tallest object height that will always fit under your printers gantry system when the printer head is at the lowest Z position.', type = 'preference')\r
+               validators.validFloat(c)\r
                \r
                self.okButton = wx.Button(left, -1, 'Ok')\r
                left.GetSizer().Add(self.okButton, (left.GetSizer().GetRows(), 1))\r
index 4cb1d1899c743374f637a86cc1169663a39b8daf..128d362e3f9ff51a7aa61070bbf7ba5d8afeead6 100644 (file)
@@ -56,17 +56,12 @@ class mesh(object):
                mat10 = math.sin(rotate) * scaleX
                mat11 = math.cos(rotate) * scaleY
                
-               for i in xrange(0, len(self.origonalVertexes)):
-                       x = self.origonalVertexes[i][0]
-                       y = self.origonalVertexes[i][1]
-                       z = self.origonalVertexes[i][2]
-                       if swapXZ:
-                               x, z = z, x
-                       if swapYZ:
-                               y, z = z, y
-                       self.vertexes[i][0] = x * mat00 + y * mat01
-                       self.vertexes[i][1] = x * mat10 + y * mat11
-                       self.vertexes[i][2] = z * scaleZ
+               mat = numpy.array([[mat00,mat10,0],[mat01,mat11,0],[0,0,scaleZ]])
+               if swapXZ:
+                       mat = numpy.array([mat[2],mat[1],mat[0]])
+               if swapYZ:
+                       mat = numpy.array([mat[0],mat[2],mat[1]])
+               self.vertexes = (numpy.matrix(self.origonalVertexes, copy = False) * numpy.matrix(mat)).getA()
 
                for i in xrange(0, len(self.origonalVertexes), 3):
                        v1 = self.vertexes[i]
index e3ef0717d9b978f95a98ba3114672d0989700b16..c90bdf52867f6a07df995cdf0932c83325e9990e 100644 (file)
@@ -177,6 +177,7 @@ preferencesDefaultSettings = {
        'extruder_head_size_min_y': '18.0',\r
        'extruder_head_size_max_x': '18.0',\r
        'extruder_head_size_max_y': '35.0',\r
+       'extruder_head_size_height': '80.0',\r
 }\r
 \r
 #########################################################\r