Commits

bworkman  committed acf11b4

change file name to match new project name

  • Participants
  • Parent commits d94ffb2

Comments (0)

Files changed (2)

+from gimpfu import *
+import gtk
+import os
+import collections
+from math import *
+from pprint import pprint, pformat
+
+def transform(item, matrix):
+        pdb.gimp_message([coeff for row in matrix for coeff in row])
+        return pdb.gimp_item_transform_matrix(item, *[coeff for row in matrix for coeff in row])
+
+def multiply(n=[[1,0,0],[0,1,0],[0,0,1]],o=[[1,0,0],[0,1,0],[0,0,1]]):
+
+        m=[[0,0,0],[0,0,0],[0,0,1]]
+
+        m[0][0] = n[0][0]*o[0][0] + n[0][1]*o[1][0] + n[0][2]*o[2][0]
+        m[0][1] = n[0][0]*o[0][1] + n[0][1]*o[1][1] + n[0][2]*o[2][1]
+        m[0][2] = n[0][0]*o[0][2] + n[0][1]*o[1][2] + n[0][2]*o[2][2]
+
+        m[1][0] = n[1][0]*o[0][0] + n[1][1]*o[1][0] + n[1][2]*o[2][0]
+        m[1][1] = n[1][0]*o[0][1] + n[1][1]*o[1][1] + n[1][2]*o[2][1]
+        m[1][2] = n[1][0]*o[0][2] + n[1][1]*o[1][2] + n[1][2]*o[2][2]
+
+        return m
+
+def orthogonal_projection(img, drawable, a, b, c, o=[[1,0,0],[0,1,0],[0,0,1]]):
+
+        p_xz = sqrt(a**2 + c**2)
+        p = sqrt(a**2 + b**2 + c**2)
+        n = [[c/p_xz,0,a/p_xz],
+                [(a*b)/(p_xz*p),p_xz/p,(-1*b*c)/(p_xz*p)],\
+                [0,0,1]]
+
+        transform(img.active_layer, multiply(n,o))
+
+        return None
+
+def iso_tile(img, drawable,a,b,c):
+        T = [[1,0,0],[0,0,1],[0,-1,0]]
+
+        orthogonal_projection(img, drawable,a,b,c,T)
+
+        return None
+
+register(
+        #name
+        "iso-tile",
+        #blurb
+        "<blurb>",
+        #help
+        "<help text>",
+        #author
+        "<author>",
+        #copyright
+        "<copyright>",
+        #date
+        "<date>",
+        #menu path
+        "<Image>/Layer/isographic/iso-tile",
+        #image types
+        "*",
+        #params
+        [
+            (PF_FLOAT, "x", "x:", 1.0),
+            (PF_FLOAT, "y", "y:", 1.0),
+            (PF_FLOAT, "z", "z:", 1.0),
+        ],
+        #results
+        [],
+        #function
+        iso_tile
+)
+
+register(
+        #name
+        "orthogonal-projection",
+        #blurb
+        "<blurb>",
+        #help
+        "<help text>",
+        #author
+        "<author>",
+        #copyright
+        "<copyright>",
+        #date
+        "<date>",
+        #menu path
+        "<Image>/Layer/Orthogonal Projection",
+        #image types
+        "*",
+        #params
+        [
+            (PF_FLOAT, "x", "x:", 1.0),
+            (PF_FLOAT, "y", "y:", 1.0),
+            (PF_FLOAT, "z", "z:", 1.0),
+        ],
+        #results
+        [],
+        #function
+        orthogonal_projection
+)
+
+main()

File projection.py

-from gimpfu import *
-import gtk
-import os
-import collections
-from math import *
-from pprint import pprint, pformat
-
-def transform(item, matrix):
-        pdb.gimp_message([coeff for row in matrix for coeff in row])
-        return pdb.gimp_item_transform_matrix(item, *[coeff for row in matrix for coeff in row])
-
-def multiply(n=[[1,0,0],[0,1,0],[0,0,1]],o=[[1,0,0],[0,1,0],[0,0,1]]):
-
-        m=[[0,0,0],[0,0,0],[0,0,1]]
-
-        m[0][0] = n[0][0]*o[0][0] + n[0][1]*o[1][0] + n[0][2]*o[2][0]
-        m[0][1] = n[0][0]*o[0][1] + n[0][1]*o[1][1] + n[0][2]*o[2][1]
-        m[0][2] = n[0][0]*o[0][2] + n[0][1]*o[1][2] + n[0][2]*o[2][2]
-
-        m[1][0] = n[1][0]*o[0][0] + n[1][1]*o[1][0] + n[1][2]*o[2][0]
-        m[1][1] = n[1][0]*o[0][1] + n[1][1]*o[1][1] + n[1][2]*o[2][1]
-        m[1][2] = n[1][0]*o[0][2] + n[1][1]*o[1][2] + n[1][2]*o[2][2]
-
-        return m
-
-def orthogonal_projection(img, drawable, a, b, c, o=[[1,0,0],[0,1,0],[0,0,1]]):
-
-        p_xz = sqrt(a**2 + c**2)
-        p = sqrt(a**2 + b**2 + c**2)
-        n = [[c/p_xz,0,a/p_xz],
-                [(a*b)/(p_xz*p),p_xz/p,(-1*b*c)/(p_xz*p)],\
-                [0,0,1]]
-
-        transform(img.active_layer, multiply(n,o))
-
-        return None
-
-def iso_tile(img, drawable,a,b,c):
-        T = [[1,0,0],[0,0,1],[0,-1,0]]
-
-        orthogonal_projection(img, drawable,a,b,c,T)
-
-        return None
-
-register(
-        #name
-        "iso-tile",
-        #blurb
-        "<blurb>",
-        #help
-        "<help text>",
-        #author
-        "<author>",
-        #copyright
-        "<copyright>",
-        #date
-        "<date>",
-        #menu path
-        "<Image>/Layer/isographic/iso-tile",
-        #image types
-        "*",
-        #params
-        [
-            (PF_FLOAT, "x", "x:", 1.0),
-            (PF_FLOAT, "y", "y:", 1.0),
-            (PF_FLOAT, "z", "z:", 1.0),
-        ],
-        #results
-        [],
-        #function
-        iso_tile
-)
-
-register(
-        #name
-        "orthogonal-projection",
-        #blurb
-        "<blurb>",
-        #help
-        "<help text>",
-        #author
-        "<author>",
-        #copyright
-        "<copyright>",
-        #date
-        "<date>",
-        #menu path
-        "<Image>/Layer/Orthogonal Projection",
-        #image types
-        "*",
-        #params
-        [
-            (PF_FLOAT, "x", "x:", 1.0),
-            (PF_FLOAT, "y", "y:", 1.0),
-            (PF_FLOAT, "z", "z:", 1.0),
-        ],
-        #results
-        [],
-        #function
-        orthogonal_projection
-)
-
-main()