Improve performance of rotating 3D objects a bit.

master
daid 2012-07-27 13:48:24 +02:00
parent fd5751f0fb
commit fd98542ce9
4 changed files with 10 additions and 12 deletions

View File

@ -216,8 +216,8 @@ def DrawSTL(mesh):
glVertex3f(v3[0], v3[1], v3[2])
glNormal3f(-mesh.normal[i/3][0], -mesh.normal[i/3][1], -mesh.normal[i/3][2])
glVertex3f(v1[0], v1[1], v1[2])
glVertex3f(v2[0], v2[1], v2[2])
glVertex3f(v3[0], v3[1], v3[2])
glVertex3f(v2[0], v2[1], v2[2])
glEnd()
def DrawGCodeLayer(layer):

View File

@ -1081,6 +1081,8 @@ class preferencesDialog(configBase.configWindowBase):
validators.validFloat(c, 0.1)
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')
validators.validFloat(c, 0.1)
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')
validators.validFloat(c)
self.okButton = wx.Button(left, -1, 'Ok')
left.GetSizer().Add(self.okButton, (left.GetSizer().GetRows(), 1))

View 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]

View File

@ -177,6 +177,7 @@ preferencesDefaultSettings = {
'extruder_head_size_min_y': '18.0',
'extruder_head_size_max_x': '18.0',
'extruder_head_size_max_y': '35.0',
'extruder_head_size_height': '80.0',
}
#########################################################