aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2009-04-08 04:09:44 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2009-04-08 04:09:44 +0000
commit60245e1c3a374c18f6d2c015221a47434558de91 (patch)
tree90c5fbc7eb550801d2a22abaddabdb7fe1a112c6
parentdafe6778ac1b050ad7ee8f2f4088d96b97487331 (diff)
flush out the coordinate conversions
svn path=/trunk/externals/mapping/; revision=10979
-rw-r--r--cartesian2spherical.pd58
-rw-r--r--help/cartesian2spherical-help.pd45
2 files changed, 103 insertions, 0 deletions
diff --git a/cartesian2spherical.pd b/cartesian2spherical.pd
new file mode 100644
index 0000000..c43ca3a
--- /dev/null
+++ b/cartesian2spherical.pd
@@ -0,0 +1,58 @@
+#N canvas 540 97 597 422 10;
+#X obj 107 89 purepd/float_argument \$1;
+#X obj 267 89 purepd/float_argument \$2;
+#X obj 427 89 purepd/float_argument \$3;
+#X obj 300 44 loadbang;
+#X obj 107 169 pack float float float;
+#X obj 107 190 trigger anything anything anything;
+#X obj 47 12 inlet x;
+#X obj 267 12 inlet y;
+#X obj 427 12 inlet z;
+#X obj 397 355 outlet theta;
+#X obj 207 355 outlet phi;
+#X text 275 167 $f1 = x;
+#X text 334 168 $f2 = y;
+#X text 392 169 $f3 = z;
+#X obj 397 278 expr atan($f2/$f1);
+#X obj 207 254 expr atan(sqrt(($f1*$f1) + ($f2*$f2))/$f3);
+#X obj 14 228 expr sqrt(($f1*$f1) + ($f2*$f2) + ($f3*$f3));
+#X obj 397 329 mapping/radians2mapping;
+#X obj 207 329 mapping/radians2mapping;
+#X obj 14 355 outlet;
+#X text 142 375 output range on all outlets: 0 to 1;
+#X obj 171 148 - 1;
+#X obj 171 128 * 2;
+#X text 265 139 convert range to -1 to 1;
+#X obj 236 148 - 1;
+#X obj 236 128 * 2;
+#X obj 107 148 - 1;
+#X obj 107 128 * 2;
+#X obj 14 324 / 1.73205;
+#X text 390 397 released under the GNU GPL;
+#X text 43 397 (C) Copyright 2008 Hans-Christoph Steiner <hans@at.or.at>
+;
+#X connect 0 0 27 0;
+#X connect 1 0 22 0;
+#X connect 2 0 25 0;
+#X connect 3 0 1 0;
+#X connect 3 0 2 0;
+#X connect 3 0 0 0;
+#X connect 4 0 5 0;
+#X connect 5 0 16 0;
+#X connect 5 1 15 0;
+#X connect 5 2 14 0;
+#X connect 6 0 27 0;
+#X connect 7 0 22 0;
+#X connect 8 0 25 0;
+#X connect 14 0 17 0;
+#X connect 15 0 18 0;
+#X connect 16 0 28 0;
+#X connect 17 0 9 0;
+#X connect 18 0 10 0;
+#X connect 21 0 4 1;
+#X connect 22 0 21 0;
+#X connect 24 0 4 2;
+#X connect 25 0 24 0;
+#X connect 26 0 4 0;
+#X connect 27 0 26 0;
+#X connect 28 0 19 0;
diff --git a/help/cartesian2spherical-help.pd b/help/cartesian2spherical-help.pd
new file mode 100644
index 0000000..bf7122e
--- /dev/null
+++ b/help/cartesian2spherical-help.pd
@@ -0,0 +1,45 @@
+#N canvas 118 83 504 451 10;
+#X text 75 37 convert spherical to cartesian coordinates;
+#X text 61 203 (r \, phi \, theta);
+#X text 61 144 (x \, y \, z);
+#X obj 277 122 hsl 128 15 0 1 0 0 empty empty empty -2 -8 0 10 -262144
+-1 -1 12700 0;
+#X obj 218 102 hsl 128 15 0 1 0 0 empty empty empty -2 -8 0 10 -262144
+-1 -1 12700 0;
+#X obj 160 72 hsl 128 15 0 1 0 0 empty empty empty -2 -8 0 10 -262144
+-1 -1 12700 0;
+#X floatatom 164 93 5 0 0 0 - - -;
+#X floatatom 221 122 5 0 0 0 - - -;
+#X floatatom 282 141 5 0 0 0 - - -;
+#X obj 277 249 hsl 128 15 0 127 0 0 empty empty empty -2 -8 0 10 -262144
+-1 -1 12 1;
+#X floatatom 225 204 5 0 0 0 - - -;
+#X floatatom 168 204 5 0 0 0 - - -;
+#X floatatom 285 204 5 0 0 0 - - -;
+#X obj 69 357 pddp/pddplink http://en.wikipedia.org/wiki/Spherical_coordinate_system
+;
+#X obj 157 181 cartesian2spherical;
+#X obj 69 337 pddp/pddplink http://en.wikipedia.org/wiki/Cartesian_coordinate_system
+;
+#X msg 134 124 bang;
+#X obj 249 159 t b f;
+#X obj 199 149 t b f;
+#X obj 5 2 cnv 15 450 20 empty empty cartesian2spherical 2 11 1 18
+-233017 -66577 0;
+#X text 23 337 input:;
+#X text 17 357 output:;
+#X connect 3 0 8 0;
+#X connect 3 0 17 0;
+#X connect 4 0 7 0;
+#X connect 4 0 18 0;
+#X connect 5 0 6 0;
+#X connect 5 0 14 0;
+#X connect 14 0 11 0;
+#X connect 14 1 10 0;
+#X connect 14 2 12 0;
+#X connect 14 2 9 0;
+#X connect 16 0 14 0;
+#X connect 17 0 14 0;
+#X connect 17 1 14 2;
+#X connect 18 0 14 0;
+#X connect 18 1 14 1;