]> git.quilime.com - plog.git/commitdiff
added content
authorGabriel Dunne <gdunne@quilime.com>
Fri, 9 Jul 2010 07:11:16 +0000 (00:11 -0700)
committerGabriel Dunne <gdunne@quilime.com>
Fri, 9 Jul 2010 07:11:16 +0000 (00:11 -0700)
13 files changed:
content/code/date_for_filename [new file with mode: 0644]
content/code/imageslice [new file with mode: 0644]
content/code/mel_UV-luminosity/config [new file with mode: 0644]
content/code/mel_UV-luminosity/content.html [new file with mode: 0644]
content/code/mel_notepad [new file with mode: 0644]
content/code/mel_sphere-intersect/config [new file with mode: 0644]
content/code/mel_sphere-intersect/content.html [new file with mode: 0644]
content/code/mel_sphere_intersect [new file with mode: 0644]
content/log/2008-11-17_buttons [new file with mode: 0644]
content/log/2009-12-13_mandala [new file with mode: 0644]
content/log/2009-12-18_taper [new file with mode: 0644]
content/log/2010-01-13_relative_time [new file with mode: 0644]
content/log/2010-01-22_cone [new file with mode: 0644]

diff --git a/content/code/date_for_filename b/content/code/date_for_filename
new file mode 100644 (file)
index 0000000..7057f69
--- /dev/null
@@ -0,0 +1,10 @@
+title = date for new filename
+lang = bash
+date = 2010-02-07
+--
+<pre class="prettyprint lang-bash">#!/bin/bash
+# Shell script to create file named after the current date
+# YYYY-MM-DD format
+
+DATE=$(date +%Y"-"%m"-"%d)
+echo -e "new file" > $DATE</pre>
\ No newline at end of file
diff --git a/content/code/imageslice b/content/code/imageslice
new file mode 100644 (file)
index 0000000..a14f955
--- /dev/null
@@ -0,0 +1,57 @@
+title = Image Slice
+date = 2009-04-23
+tags = bash, script, slice, image, imagemagick
+lang = bash
+--
+
+<p>
+    Shell script that slices a single image into any number of vertical and horizontal sections.
+</p>
+
+<pre class="prettyprint lang-bash">#!/bin/bash
+#copyright: 2009
+#author: gabriel dunne
+#url: quilime.com
+
+IMAGE=$1
+IMAGE_W=$2
+IMAGE_H=$3
+ROWS=$4
+COLS=$5
+
+if [ $# -eq 0 ]
+then
+       echo "usage: image width height rows cols"
+       echo "example: ./slice.sh Sunset.jpg 800 600 16 16"
+       exit
+else
+
+       for (( x = 1; x <= COLS; x++ ))
+       do
+           for (( y = 1 ; y <= ROWS; y++ ))
+           do
+               let CROP_X = `expr $IMAGE_W-IMAGE_W/$x`
+               let CROP_Y = `expr $IMAGE_H-IMAGE_H/$y`
+               let CROP_W = `expr $IMAGE_W/$ROWS`
+               let CROP_H = `expr $IMAGE_H/$COLS`
+               echo -n "crop ${CROP_W}x${CROP_H}+${CROP_X}+${CROP_Y} result: [${x},${y}]_$IMAGE"
+               echo ""
+                       convert $IMAGE -crop ${CROP_W}x${CROP_H}+${CROP_X}+${CROP_Y} [${x},${y}]_$IMAGE
+           done
+       done
+       
+fi
+</pre>
+
+<h2>To Use</h2>
+<p>
+    <ol>
+        <li>navigate to slice.sh in your terminal and do 
+            <br />
+            <pre class="prettyprint lang-bash">$  chmod 775 slice.sh
+$  ./slice.sh Sunset.jpg 800 600 16 16</pre>
+        </li>
+        <li>replace <strong>Sunset.jpg</strong> with your image name.</li>
+        <li>vars: <strong>Image Height, Image Width, Vertical Divisions, Horizontal Divisions</strong></li>        
+    </ol>
+</p>
\ No newline at end of file
diff --git a/content/code/mel_UV-luminosity/config b/content/code/mel_UV-luminosity/config
new file mode 100644 (file)
index 0000000..db3cd05
--- /dev/null
@@ -0,0 +1,3 @@
+title = Luminosity at UV coord
+date = 2009/02/15
+medium = maya/mel
diff --git a/content/code/mel_UV-luminosity/content.html b/content/code/mel_UV-luminosity/content.html
new file mode 100644 (file)
index 0000000..74dc3cd
--- /dev/null
@@ -0,0 +1,30 @@
+<p>
+Get luminosity of texture at UV coord in Maya with custom rgbToHsv node.
+</p>
+
+<pre class="prettyprint lang-mel">
+global proc float getLuminosityAtUVCoord(string $texture, float $U, float $V)
+{
+       $id = "lum"; // unique identifier in case there are duplicate nodes
+       $rgbToHsv = "rgbToHsv_" + $id ; // create rgbToHSV node if necesarry
+       if(!`objExists $rgbToHsv`) {
+               createNode rgbToHsv -n $rgbToHsv;
+       }
+
+       vector $color = `colorAtPoint -o RGB -u $U -v $V  $texture`;
+
+       setAttr ($rgbToHsv+".ir") ($color.x);
+       setAttr ($rgbToHsv+".ig") ($color.y);
+       setAttr ($rgbToHsv+".ib") ($color.z);
+
+       return `getAttr ($rgbToHsv+".ov")`;
+}
+</pre>
+
+<h3>to use</h3>
+<pre class="prettyprint lang-mel">
+// returns luminosity value of 0.5 U 0.5 V on texture file_seq
+$value = getLuminosityAtUVCoord("file_seq", 0.5, 0.5);
+</pre>
+
+</pre>
\ No newline at end of file
diff --git a/content/code/mel_notepad b/content/code/mel_notepad
new file mode 100644 (file)
index 0000000..98b802d
--- /dev/null
@@ -0,0 +1,122 @@
+date = 2007-12-12
+title = "MEL Notepad"
+tags = mel, maya
+lang = mel
+--
+
+process selection list
+<pre class="prettyprint lang-mel">string $select[] = `ls -sl`;
+for ( $node in $select ) // process each
+{
+   /* ... */
+}
+</pre>
+
+<br />
+
+if node exists
+<pre class="prettyprint lang-mel">
+string $node = "object";
+if ( `objExists $node` )
+{
+   // The node exists
+}
+</pre>
+
+<h2>regexp</h2>
+
+Strip component
+<pre class="prettyprint lang-mel">
+string $node = "pCube1.f[2]";
+string $no_component = `match "^[^\.]*" $node`;
+// Result: "pCube1" //
+</pre>
+
+<br />
+Extract component or attribute, with '.'
+<pre class="prettyprint lang-mel">
+string $node = "pCube1.f[2]";
+string $component = `match "\\..*" $node`;
+// Result: ".f[2]" //
+
+string $nodeAttr = "blinn1.color";
+string $attrName = `match "\\..*" $nodeAttr`;
+// Result: ".color" //
+</pre>
+
+<br />
+Extract attribute name, without '.'
+
+<pre class="prettyprint lang-mel">
+string $node = "pCube1.f[2]";
+string $component = `substitute "^[^.]*\\." $node ""`;
+// Result: "f[2]" //
+
+string $nodeAttr = "blinn1.color";
+string $attrName = `substitute "^[^.]*\\." $nodeAttr ""`;
+// Result: "color" //
+</pre>
+
+<br />
+Extract parent UI control from full path
+<pre class="prettyprint lang-mel">
+string $uiControl = "OptionBoxWindow|formLayout52|formLayout55|button6";
+string $uiParent = `substitute "|[^|]*$" $uiControl ""`;
+// Result: OptionBoxWindow|formLayout52|formLayout55 //
+</pre>
+
+<br />
+Strip trailing Line Break (\n), if any. <br /><br />This is useful when processing text input read from a file using `fgetline`.
+<pre class="prettyprint lang-mel">
+string $input = "line\n";
+$string $line = `match "^[^(\r\n)]*" $input`;
+// Result: "line" //
+</pre>
+
+<br />
+Extract directory from path.
+<br /><br />
+Keep the trailing slash for ease of use.
+<pre class="prettyprint lang-mel">
+string $path = "C:/AW/Maya5.0/bin/maya.exe";
+string $dir = `match "^.*/" $path`;
+// Result: "C:/AW/Maya5.0/bin/"
+</pre>
+
+<br />
+Extract file from path
+<pre class="prettyprint lang-mel">
+string $path = "C:/AW/Maya5.0/bin/maya.exe";
+string $filepart = `match "[^/\\]*$" $path`;
+// Result: "maya.exe"
+</pre>
+
+<br />
+Strip numeric suffix
+<pre class="prettyprint lang-mel">
+
+string $node = "pCube1|pCubeShape223";
+string $noSuffix = `match ".*[^0-9]" $node`;
+// Result: "pCube1|pCubeShape"
+</pre>
+
+<br />
+Extract numeric suffix
+<pre class="prettyprint lang-mel">
+string $node = "pCube1|pCubeShape223";
+string $suffix = `match "[0-9]+$" $node`;
+// Result: "223" //
+</pre>
+
+<br />
+Extract short name of DAG or control path
+<pre class="prettyprint lang-mel">
+string $dagPath = "pCube1|pCubeShape223";
+string $shortName = `match "[^|]*$" $dagPath`;
+// Result: pCubeShape223 //
+</pre>
+
+<h2>other reference</h2>
+<ul class="bullet">
+<li><a href="http://xyz2.net/mel/">http://xyz2.net/mel/</a></li>
+</ul>
diff --git a/content/code/mel_sphere-intersect/config b/content/code/mel_sphere-intersect/config
new file mode 100644 (file)
index 0000000..b45fefc
--- /dev/null
@@ -0,0 +1,3 @@
+title = Sphere Intersect
+date = 2009-06-12
+medium = maya/mel
\ No newline at end of file
diff --git a/content/code/mel_sphere-intersect/content.html b/content/code/mel_sphere-intersect/content.html
new file mode 100644 (file)
index 0000000..8007317
--- /dev/null
@@ -0,0 +1,65 @@
+<p>
+Function to return location of intersect with poly mesh and spherical object moving in the positive direction on the Y axis.
+<br/>
+</p>
+
+<h2>
+mel source
+</h2>
+<pre class="prettyprint lang-mel">
+
+global proc intersectSphereY()
+{
+       print(". . . . . go go go\n");
+
+       int $iter = 50;
+       float $start[3] = {0, -0.5, 0};
+       float $limit[3] = {0, 5.0, 0};
+       $mesh = "test_mesh";    
+       $tmpCN = "cpom";
+
+    
+       $obj = "rod1";
+       float $radius = 0.5;
+       float $curPos[3] = {0, 0, 0};
+
+       for ($i = 0; $i <= $iter; $i++)
+       {    
+               $mesh = "test_mesh";
+               $shape = `listRelatives -shapes $mesh`;
+
+               createNode -n $tmpCN closestPointOnMesh;
+               connectAttr -f ($shape[0] + ".outMesh") ($tmpCN + ".inMesh");
+               setAttr ($tmpCN + ".inPosition") $curPos[0] $curPos[1] $curPos[2];
+               
+               $cpom = `getAttr ($tmpCN + ".position")`;
+               
+               if ( pointDist($curPos, $cpom) <= $radius ) {
+                       return ". . bonk\n";
+               }
+
+               $curPos[1] = ($limit.y) / $iter * $i;
+               setAttr ($obj + ".translateY") $curPos[1];
+
+               delete $tmpCN;
+       }
+       return ". nope\n";
+}
+
+global proc float pointDist(float $p1[], float $p2[])
+{
+    return sqrt( 
+       (($p1[0] - $p2[0]) * ($p1[0] - $p2[0])) + 
+       (($p1[1] - $p2[1]) * ($p1[1] - $p2[1])) + 
+       (($p1[2] - $p2[2]) * ($p1[2] - $p2[2])));
+}
+
+intersectSphereY;
+
+</pre>
+
+
+
+
+
+<img src="http://media.quilime.com/files/img/sphere_intersect.png">
\ No newline at end of file
diff --git a/content/code/mel_sphere_intersect b/content/code/mel_sphere_intersect
new file mode 100644 (file)
index 0000000..33f62ec
--- /dev/null
@@ -0,0 +1,66 @@
+date = 2009-06-12
+title = "MEL Sphere Intersect"
+tags = "maya, mel, sphere, intersection"
+lang = mel
+--
+<p>
+Function to return location of intersect with poly mesh and spherical object moving in the positive direction on the Y axis.
+<br/>
+</p>
+
+<h2>
+mel source
+</h2>
+<pre class="prettyprint lang-mel">global proc intersectSphereY()
+{
+       print(". . . . . go go go\n");
+
+       int $iter = 50;
+       float $start[3] = {0, -0.5, 0};
+       float $limit[3] = {0, 5.0, 0};
+       $mesh = "test_mesh";    
+       $tmpCN = "cpom";
+
+    
+       $obj = "rod1";
+       float $radius = 0.5;
+       float $curPos[3] = {0, 0, 0};
+
+       for ($i = 0; $i <= $iter; $i++)
+       {    
+               $mesh = "test_mesh";
+               $shape = `listRelatives -shapes $mesh`;
+
+               createNode -n $tmpCN closestPointOnMesh;
+               connectAttr -f ($shape[0] + ".outMesh") ($tmpCN + ".inMesh");
+               setAttr ($tmpCN + ".inPosition") $curPos[0] $curPos[1] $curPos[2];
+               
+               $cpom = `getAttr ($tmpCN + ".position")`;
+               
+               if ( pointDist($curPos, $cpom) <= $radius ) {
+                       return ". . bonk\n";
+               }
+
+               $curPos[1] = ($limit.y) / $iter * $i;
+               setAttr ($obj + ".translateY") $curPos[1];
+
+               delete $tmpCN;
+       }
+       return ". nope\n";
+}
+
+global proc float pointDist(float $p1[], float $p2[])
+{
+    return sqrt( 
+       (($p1[0] - $p2[0]) * ($p1[0] - $p2[0])) + 
+       (($p1[1] - $p2[1]) * ($p1[1] - $p2[1])) + 
+       (($p1[2] - $p2[2]) * ($p1[2] - $p2[2])));
+}
+
+intersectSphereY;</pre>
+
+
+
+
+
+<img src="http://media.quilime.com/files/img/sphere_intersect.png">
\ No newline at end of file
diff --git a/content/log/2008-11-17_buttons b/content/log/2008-11-17_buttons
new file mode 100644 (file)
index 0000000..162ae2f
--- /dev/null
@@ -0,0 +1,7 @@
+title = button invasion
+date = 2009-11-17
+tags = monome, fabrication, electronics
+--
+
+![monome, sparkfun](http://farm3.static.flickr.com/2649/4111923978_5746f85d8a.jpg)  
+monome, sparkfun
diff --git a/content/log/2009-12-13_mandala b/content/log/2009-12-13_mandala
new file mode 100644 (file)
index 0000000..93967b8
--- /dev/null
@@ -0,0 +1,11 @@
+title = mandala
+date = 2009-12-13
+tags = art, graphic design
+--
+
+
+<img src="http://media.quilime.com/files/projects/mandala/mandala2.png" />
+
+<p>
+<a href="http://en.wikipedia.org/wiki/Endless_knot">endless knot</a>, <a href="http://en.wikipedia.org/wiki/Mandala">mandala</a>
+</p>
\ No newline at end of file
diff --git a/content/log/2009-12-18_taper b/content/log/2009-12-18_taper
new file mode 100644 (file)
index 0000000..a92860c
--- /dev/null
@@ -0,0 +1,5 @@
+title = taper
+date = 2009-12-18
+tags = tessellated
+--
+<img src="http://media.quilime.com/files/img/side.png" />
\ No newline at end of file
diff --git a/content/log/2010-01-13_relative_time b/content/log/2010-01-13_relative_time
new file mode 100644 (file)
index 0000000..05fb805
--- /dev/null
@@ -0,0 +1,7 @@
+title = relative_time
+date = 2010-01-13
+tags = time, inspiration
+--
+<img src="http://media.quilime.com/aggregate/agg/relativity_visualized__relative_time.jpg"/>
+
+
diff --git a/content/log/2010-01-22_cone b/content/log/2010-01-22_cone
new file mode 100644 (file)
index 0000000..a937eb3
--- /dev/null
@@ -0,0 +1,11 @@
+title = cone
+date = 2010-01-22
+tags = installation, projection
+--
+<a href="http://www.flickr.com/photos/quilime/4272182477/">
+<img src="http://farm3.static.flickr.com/2735/4272182477_19e3b10d8d.jpg">
+</a>
+
+<p>
+test pattern
+</p>
\ No newline at end of file