This commit is contained in:
Dooho Yi 2021-03-14 11:34:51 +09:00
parent 09d9e3b507
commit 7db692918a
16 changed files with 2534 additions and 439 deletions

View file

@ -21,7 +21,7 @@
//============<identities>============
//
#define MY_GROUP_ID (3000)
#define MY_ID (MY_GROUP_ID + 205)
#define MY_ID (MY_GROUP_ID + 202)
#define MY_SIGN ("CRICKET")
//
//============</identities>============

View file

@ -35,5 +35,5 @@
- unused
== gonggong x 1 ~ 4001
- (new)
== cricket x 1 ~ 3087
- bird
== cricket x 1 ~ 3100

42
puredata/arr2q.pd Normal file
View file

@ -0,0 +1,42 @@
#N canvas 1 89 358 397 12;
#X floatatom 57 234 5 0 0 0 - - -;
#X floatatom 57 123 5 0 0 0 - - -;
#X obj 57 211 tabread;
#X obj 57 98 array size;
#X msg 142 98 set \$1;
#X obj 57 20 inlet;
#X obj 57 145 hooop;
#X obj 57 282 pack f f s;
#X msg 57 313 add \$2 \$3 \$1;
#X text 107 19 1-array-name;
#X text 105 345 1#qlist;
#X obj 57 342 outlet;
#X obj 57 53 t b a a;
#X obj 222 237 loadbang;
#X obj 222 262 symbol \$2;
#X obj 133 190 sel 0;
#X msg 133 215 0;
#X obj 165 240 f \$1;
#X msg 165 215 bang;
#X obj 57 170 t a a;
#X connect 0 0 7 0;
#X connect 1 0 6 0;
#X connect 2 0 0 0;
#X connect 3 0 1 0;
#X connect 4 0 2 0;
#X connect 5 0 12 0;
#X connect 6 0 19 0;
#X connect 7 0 8 0;
#X connect 8 0 11 0;
#X connect 12 0 3 0;
#X connect 12 1 3 1;
#X connect 12 2 4 0;
#X connect 13 0 14 0;
#X connect 14 0 7 2;
#X connect 15 0 16 0;
#X connect 15 1 18 0;
#X connect 16 0 7 1;
#X connect 17 0 7 1;
#X connect 18 0 17 0;
#X connect 19 0 2 0;
#X connect 19 1 15 0;

50
puredata/asum.pd Normal file
View file

@ -0,0 +1,50 @@
#N canvas 483 306 379 517 12;
#X obj 217 160 symbol \$1;
#X obj 217 210 makefilename %s%%d;
#X obj 217 135 loadbang;
#X obj 217 270 makefilename;
#X msg 217 235 set \$1;
#X obj 52 310 array get;
#X msg 247 81 \; \$1 const 0;
#X obj 72 227 f;
#X obj 108 227 + 1;
#X obj 52 335 list-math *;
#X obj 173 375 array get;
#X obj 92 466 array set;
#X obj 92 400 list-emath +;
#X obj 227 185 s \$0-out-an;
#X obj 233 350 r \$0-out-an;
#X obj 152 441 r \$0-out-an;
#X obj 52 149 t b b a b;
#X obj 52 78 inlet;
#X obj 167 78 inlet;
#X text 153 15 argument 1: array name;
#X text 21 48 1-ratios \, comma separated;
#X msg 167 128 0;
#X msg 167 103 bang;
#X obj 247 56 symbol \$1;
#X connect 0 0 1 0;
#X connect 0 0 13 0;
#X connect 1 0 4 0;
#X connect 2 0 0 0;
#X connect 3 0 5 2;
#X connect 4 0 3 0;
#X connect 5 0 9 0;
#X connect 7 0 8 0;
#X connect 8 0 7 1;
#X connect 8 0 3 0;
#X connect 9 0 12 0;
#X connect 10 0 12 1;
#X connect 12 0 11 0;
#X connect 14 0 10 2;
#X connect 15 0 11 2;
#X connect 16 0 5 0;
#X connect 16 1 7 0;
#X connect 16 2 9 1;
#X connect 16 3 10 0;
#X connect 17 0 16 0;
#X connect 18 0 22 0;
#X connect 21 0 7 1;
#X connect 22 0 21 0;
#X connect 22 0 23 0;
#X connect 23 0 6 0;

View file

@ -40,8 +40,8 @@ function bin.new()
-- font:drawString(string.format("(%5.1f %5.1f %2.1f)", spd, jerk, l.mass), 12, 0)
-- font:drawString(string.format("%06x", l.color), 12, 0)
-- font:drawString(string.format("%.0f", l.mass), 12, 0)
local ang = l.pos.angle(l.pos, ofVec2f(1, 0))
font:drawString(string.format("%.0f", ang), 12, 0)
-- local ang = l.pos.angle(l.pos, ofVec2f(1, 0))
-- font:drawString(string.format("%.0f", ang), 12, 0)
ofPopMatrix()
end
@ -193,11 +193,11 @@ function bin.new()
for i = 1, #o.planets do;
o.planets[i].display();
end;
ofSetHexColor(0x000000)
ofDrawLine(o.planets[1].pos.x, o.planets[1].pos.y, o.planets[2].pos.x, o.planets[2].pos.y)
ofNoFill()
ofDrawRectangle(o.planets[1].pos.x - 5, o.planets[1].pos.y - 5, 10, 10)
ofDrawCircle(o.planets[2].pos.x, o.planets[2].pos.y, 5)
-- ofSetHexColor(0x000000)
-- ofDrawLine(o.planets[1].pos.x, o.planets[1].pos.y, o.planets[2].pos.x, o.planets[2].pos.y)
-- ofNoFill()
-- ofDrawRectangle(o.planets[1].pos.x - 5, o.planets[1].pos.y - 5, 10, 10)
-- ofDrawCircle(o.planets[2].pos.x, o.planets[2].pos.y, 5)
ofPopMatrix();
end

22
puredata/hooop.pd Normal file
View file

@ -0,0 +1,22 @@
#N canvas 510 530 450 300 12;
#X obj 22 143 until;
#X obj 22 99 f;
#X obj 104 163 f;
#X obj 134 163 + 1;
#X obj 104 188 mod;
#X msg 122 99 0;
#X obj 22 23 inlet;
#X obj 104 226 outlet;
#X obj 22 58 t b b a a;
#X connect 0 0 2 0;
#X connect 1 0 0 0;
#X connect 2 0 3 0;
#X connect 2 0 4 0;
#X connect 3 0 2 1;
#X connect 4 0 7 0;
#X connect 5 0 2 1;
#X connect 6 0 8 0;
#X connect 8 0 1 0;
#X connect 8 1 5 0;
#X connect 8 2 1 1;
#X connect 8 3 4 1;

File diff suppressed because it is too large Load diff

239
puredata/pingpong.pd Normal file
View file

@ -0,0 +1,239 @@
#N canvas 1 89 450 300 12;
#N canvas 0 23 450 278 (subpatch) 0;
#X array riff14 10 float 3;
#A 0 20.1904 0 -0.238235 0.238026 0 0 14.5238 28.0955 23.0955 3.57126
;
#X coords 0 25 10 0 150 105 1 0 0;
#X restore 191 37 graph;
#X obj 51 201 tgl 20 0 empty empty empty 17 7 0 10 -262130 -1 -1 0
1;
#X obj 194 230 tgl 20 0 empty empty empty 17 7 0 10 -257985 -1 -1 0
1;
#X obj 995 70 until;
#X msg 931 69 100;
#X obj 995 93 f;
#X obj 1028 93 + 1;
#X floatatom 995 140 5 0 0 0 - - -;
#X obj 941 237 tabwrite riff14;
#X obj 995 209 t b a;
#X floatatom 995 185 5 0 0 0 - - -;
#X obj 931 92 t a b;
#X msg 958 121 0;
#X obj 995 162 + 1;
#X msg 941 196 0;
#X obj 51 433 s NOTE;
#X obj 232 730 dac~ 1;
#X obj 214 586 mx~;
#X obj 292 465 >~ 0.01;
#X obj 293 407 phasor~ 2;
#X text 935 41 fill array with a number;
#X text 924 175 with '0';
#X text 1023 163 from 1 \, 100 times;
#X obj 292 552 scope~ 136 120 256 3 128 -1 1 0 0 1 0.2 0 0 0 223 223
223 255 255 255 0 empty;
#X obj 51 328 riff 1 3001;
#X msg 160 181 300 5000;
#X floatatom 316 379 5 0 0 0 - - -;
#X obj 307 299 * -1;
#X floatatom 307 322 5 0 0 0 - - -;
#X obj 51 226 retro 5000 15000;
#X obj 307 276 - 15000;
#X obj 316 356 * 0.0005;
#X obj 547 209 tgl 20 0 empty empty empty 17 7 0 10 -262130 -1 -1 0
1;
#X obj 677 237 tgl 20 0 empty empty empty 17 7 0 10 -257985 -1 -1 0
1;
#X obj 547 368 s NOTE;
#X obj 547 268 riff 800 20200;
#N canvas 1 89 450 278 (subpatch) 0;
#X array tissue 50 float 3;
#A 0 -1.19209e-07 -0.00952399 -0.0952388 -0.114287 -0.104763 -0.0952388
-0.0571433 0.0190476 0.0761908 0.0857147 0.0761908 0.0571431 0.0190476
-0.0571433 -0.0952388 -0.0952388 -0.0761911 -0.00952399 0.0476192 0.0952386
0.114286 0.114286 0.0952386 0.066667 -0.0857149 -0.0952388 -0.0857149
-0.0666672 -0.0190479 0.0857147 0.0857147 0.066667 0.0285715 -0.0476195
-0.0666672 -0.0666672 -0.0380956 0.0190476 0.0571431 0.0857147 0.0952386
0.0761908 0.0190476 -0.0380956 -0.0761911 -0.0857149 -0.0761911 -0.0761911
-0.0571433 -0.0476195;
#X coords 0 1 50 0 150 105 1 0 0;
#X restore 534 37 graph;
#X msg 594 200 symbol tissue;
#X obj 739 336 unpack f f;
#X obj 739 359 s X1;
#X obj 796 359 s X2;
#X obj 547 234 metro 1000;
#X msg 739 314 \$1 1000;
#X msg 98 295 symbol ppong;
#N canvas 0 23 450 278 (subpatch) 0;
#X array ppong 50 float 3;
#A 0 0.942858 0.914287 0.8381 0.78096 0.733343 0.704773 0.685726 0.685726
0.685726 0.685726 0.695249 0.75239 0.790483 0.800007 0.800007 0.80953
0.80953 0.819053 0.800007 0.771437 0.72382 0.685726 0.657156 0.638109
0.628586 0.619062 0.619062 0.619062 0.647632 0.666679 0.676203 0.666679
0.647632 0.628586 0.619062 0.590492 0.561922 0.552399 0.533352 0.533352
0.523828 0.523828 0.523828 0.571445 0.628586 0.628586 0.638109 0.638109
0.638109 0.647632;
#X coords 0 1 50 0 150 105 1 0 0;
#X restore 943 368 graph;
#X obj 849 500 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 1077 615 del;
#X obj 1077 636 spigot;
#X obj 849 430 tgl 15 0 empty empty empty 17 7 0 10 -4034 -1 -1 0 1
;
#X obj 849 470 t b f b;
#X msg 981 488 symbol ppong;
#X obj 769 577 f;
#X obj 769 600 == 0;
#X floatatom 709 613 5 0 0 0 - - -;
#X obj 709 675 sig~;
#X obj 594 733 dac~ 1;
#X obj 934 515 riff 5000 1031;
#X obj 849 528 t b b;
#X obj 846 587 del 30;
#N canvas 0 23 450 278 (subpatch) 0;
#X array ppong3 50 float 3;
#A 0 0.257143 0.247619 0.238096 0.228573 0.219049 0.209526 0.200002
0.200002 0.190479 0.180956 0.171432 0.161909 0.152386 0.142862 0.142862
0.133339 0.123815 0.114292 0.114292 0.104769 0.104769 0.104769 0.104769
0.104769 0.104769 0.0952452 0.0952452 0.0952452 0.0857218 0.0761984
0.0761984 0.066675 0.066675 0.066675 0.0571516 0.0571516 0.0571516
0.0571516 0.0571516 0.0571516 0.0571516 0.0571516 0.0571516 0.0571516
0.0571516 0.0571516 0.0571516 0.0571516 0.0571516 0.0571516;
#X coords 0 1 50 0 150 105 1 0 0;
#X restore 1243 368 graph;
#X obj 1149 430 tgl 15 0 empty empty empty 17 7 0 10 -4034 -1 -1 0
1;
#X msg 1281 487 symbol ppong;
#X obj 846 616 del 130;
#X obj 846 645 del 230;
#X obj 614 589 mx~;
#X obj 709 635 * 0.1;
#N canvas 0 23 450 278 (subpatch) 0;
#X array ppong2 50 float 3;
#A 0 0.942858 0.6 0.590476 0.580952 0.561904 0.552381 0.533333 0.533333
0.514285 0.514285 0.504761 0.495237 0.495237 0.47619 0.47619 0.47619
0.47619 0.47619 0.485713 0.485713 0.504761 0.533333 0.552381 0.580952
0.6 0.638095 0.666667 0.685715 0.714286 0.733334 0.752382 0.761906
0.77143 0.780953 0.780953 0.790477 0.790477 0.790477 0.790477 0.790477
0.790477 0.790477 0.790477 0.780953 0.780953 0.780953 0.77143 0.77143
0.761906 0.733334;
#X coords 0 1 50 0 150 105 1 0 0;
#X restore 1093 248 graph;
#X msg 1001 468 symbol ppong2;
#X obj 906 646 del 100;
#X obj 906 675 del 20;
#X obj 906 617 del 160;
#X obj 906 706 del 200;
#X obj 906 736 del 70;
#X obj 966 746 del 70;
#X obj 718 493 random 3;
#X obj 718 516 sel 0 1 2;
#X obj 675 551 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 705 563 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 734 569 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 966 627 del 78;
#X obj 966 656 del 56;
#X obj 966 685 del 190;
#X obj 966 716 del 20;
#X obj 1149 450 metro 1000;
#X obj 1234 515 riff 3 1031;
#X floatatom 1266 705 5 0 0 0 - - -;
#X obj 1314 655 * 0.1;
#X connect 1 0 29 0;
#X connect 2 0 24 3;
#X connect 3 0 5 0;
#X connect 4 0 11 0;
#X connect 5 0 6 0;
#X connect 5 0 7 0;
#X connect 6 0 5 1;
#X connect 7 0 13 0;
#X connect 9 0 14 0;
#X connect 9 1 8 1;
#X connect 10 0 9 0;
#X connect 11 0 3 0;
#X connect 11 1 12 0;
#X connect 12 0 5 0;
#X connect 13 0 10 0;
#X connect 14 0 8 0;
#X connect 17 0 16 0;
#X connect 18 0 23 0;
#X connect 19 0 18 0;
#X connect 24 0 15 0;
#X connect 25 0 29 1;
#X connect 26 0 19 0;
#X connect 27 0 28 0;
#X connect 28 0 31 0;
#X connect 29 0 24 0;
#X connect 29 1 30 0;
#X connect 30 0 27 0;
#X connect 31 0 26 0;
#X connect 32 0 41 0;
#X connect 33 0 35 3;
#X connect 35 0 34 0;
#X connect 35 1 42 0;
#X connect 37 0 35 1;
#X connect 38 0 39 0;
#X connect 38 1 40 0;
#X connect 41 0 35 0;
#X connect 42 0 38 0;
#X connect 43 0 24 1;
#X connect 45 0 56 0;
#X connect 45 0 57 0;
#X connect 46 0 47 0;
#X connect 47 0 45 0;
#X connect 48 0 49 0;
#X connect 49 0 45 0;
#X connect 49 1 47 1;
#X connect 49 2 50 0;
#X connect 50 0 56 1;
#X connect 51 0 52 0;
#X connect 51 0 53 0;
#X connect 52 0 51 1;
#X connect 53 0 65 0;
#X connect 54 0 64 0;
#X connect 56 1 46 0;
#X connect 57 0 51 0;
#X connect 57 1 74 0;
#X connect 58 0 51 0;
#X connect 58 0 62 0;
#X connect 60 0 83 0;
#X connect 61 0 84 1;
#X connect 62 0 63 0;
#X connect 62 0 51 0;
#X connect 63 0 51 0;
#X connect 64 0 55 0;
#X connect 65 0 54 0;
#X connect 67 0 56 1;
#X connect 68 0 51 0;
#X connect 68 0 69 0;
#X connect 69 0 51 0;
#X connect 69 0 71 0;
#X connect 70 0 51 0;
#X connect 70 0 68 0;
#X connect 71 0 51 0;
#X connect 71 0 72 0;
#X connect 72 0 51 0;
#X connect 73 0 51 0;
#X connect 74 0 75 0;
#X connect 75 0 58 0;
#X connect 75 0 76 0;
#X connect 75 1 70 0;
#X connect 75 1 77 0;
#X connect 75 2 78 0;
#X connect 75 2 79 0;
#X connect 79 0 51 0;
#X connect 79 0 80 0;
#X connect 80 0 51 0;
#X connect 80 0 81 0;
#X connect 81 0 51 0;
#X connect 81 0 82 0;
#X connect 82 0 73 0;
#X connect 82 0 51 0;
#X connect 83 0 84 0;
#X connect 84 1 86 0;
#X connect 85 0 64 1;
#X connect 86 0 85 0;

25
puredata/poly.pd Normal file
View file

@ -0,0 +1,25 @@
#N canvas 803 89 525 569 10;
#X declare -path ofelia/abs;
#X obj 18 64 ofWindow;
#X obj 18 18 loadbang;
#X obj 358 18 declare -path ofelia/abs;
#X msg 18 41 setPosition 0 0 \, setSize 800 800 \, create;
#X obj 18 98 ofDraw;
#X floatatom 18 121 5 0 0 0 - - -;
#X obj 18 143 max 3;
#X obj 18 166 min 10;
#X obj 18 220 ofelia f \; ofNoFill() \; local n = a \; local angleChangePerPt
= OF_TWO_PI / n \; local radius = ofGetWidth()/2 - 10 \; local origx
= ofGetWidth()/2 \; local origy = ofGetHeight()/2 \; local angle =
-OF_TWO_PI / 4 \; ofSetHexColor(0xa16bca) \; ofBeginShape() \; for
i = 0 \, n do \; local x = origx + radius * math.cos(angle) \; local
y = origy + radius * math.sin(angle) \; ofVertex(x \, y) \; angle =
angle + angleChangePerPt \; end \; ofEndShape() \;;
#X floatatom 18 189 5 0 0 0 - - -;
#X connect 1 0 3 0;
#X connect 3 0 0 0;
#X connect 4 0 5 0;
#X connect 5 0 6 0;
#X connect 6 0 7 0;
#X connect 7 0 9 0;
#X connect 9 0 8 0;

344
puredata/polygonexample.lua Normal file
View file

@ -0,0 +1,344 @@
if type(window) ~= "userdata" then
window = ofWindow()
end
local clock = ofClock(this, "setup")
local DV = class()
function DV:__init(x, y)
self.x = x
self.y = y
self.bBeingDragged = false
self.bOver = false
self.radius = 4
end
local nCurveVertexes = 0
local curveVertices = {}
function M.new()
ofWindow.addListener("setup", this)
ofWindow.addListener("draw", this)
ofWindow.addListener("mouseMoved", this)
ofWindow.addListener("mouseDragged", this)
ofWindow.addListener("mousePressed", this)
ofWindow.addListener("mouseReleased", this)
window:setPosition(30, 100)
window:setSize(1024, 768)
if ofWindow.exists then
clock:delay(0)
else
window:create()
end
end
function M.free()
window:destroy()
ofWindow.removeListener("setup", this)
ofWindow.removeListener("draw", this)
ofWindow.removeListener("mouseMoved", this)
ofWindow.removeListener("mouseDragged", this)
ofWindow.removeListener("mousePressed", this)
ofWindow.removeListener("mouseReleased", this)
end
function M.setup()
ofSetWindowTitle("polygon example")
ofBackground(255, 255, 255, 255)
nCurveVertexes = 7
curveVertices = {DV(326, 209), DV(306, 279), DV(265, 331), DV(304, 383), DV(374, 383), DV(418, 209), DV(345, 279)}
end
function M.draw()
ofFill()
--[[---------------------------------------------------------------
draw a star
use poly winding odd, the default rule
--]]---------------------------------------------------------------
ofSetHexColor(0xe0be21)
ofSetPolyMode(OF_POLY_WINDING_ODD)
ofBeginShape()
ofVertex(200, 135)
ofVertex(15, 135)
ofVertex(165, 25)
ofVertex(105, 200)
ofVertex(50, 25)
ofEndShape()
--[[---------------------------------------------------------------
draw a star
use poly winding nonzero
--]]---------------------------------------------------------------
ofSetHexColor(0xb5de10)
ofSetPolyMode(OF_POLY_WINDING_NONZERO)
ofBeginShape()
ofVertex(400, 135)
ofVertex(215, 135)
ofVertex(365, 25)
ofVertex(305, 200)
ofVertex(250, 25)
ofEndShape()
--[[---------------------------------------------------------------
draw a star dynamically
use the mouse position as a pct
to calc nPoints and internal point radius
--]]---------------------------------------------------------------
local xPct = ofGetMouseX() / ofGetWidth()
local yPct = ofGetMouseY() / ofGetHeight()
local nTips = 5 + xPct * 60
local nStarPts = math.min(nTips * 2, 100)
local angleChangePerPt = OF_TWO_PI / nStarPts
local innerRadius = 0 + yPct * 80
local outerRadius = 80
local origx = 525
local origy = 100
local angle = 0
ofSetHexColor(0xa16bca)
ofBeginShape()
for i = 0, nStarPts do
if i % 2 == 0 then
local x = origx + innerRadius * math.cos(angle)
local y = origy + innerRadius * math.sin(angle)
ofVertex(x, y)
else
local x = origx + outerRadius * math.cos(angle)
local y = origy + outerRadius * math.sin(angle)
ofVertex(x, y)
end
angle = angle + angleChangePerPt
end
ofEndShape()
--[[---------------------------------------------------------------
poylgon of random points
lots of self intersection, 500 pts is a good stress test
--]]---------------------------------------------------------------
ofSetHexColor(0x0cb0b6)
ofSetPolyMode(OF_POLY_WINDING_ODD)
ofBeginShape()
for i = 1, 10 do
ofVertex(ofRandom(650, 850), ofRandom(20, 200))
end
ofEndShape()
--[[---------------------------------------------------------------
use sin cos and time to make some spirally shape
--]]---------------------------------------------------------------
ofPushMatrix()
ofTranslate(100, 300, 0)
ofSetHexColor(0xff2220)
ofFill()
ofSetPolyMode(OF_POLY_WINDING_ODD)
ofBeginShape()
local angleStep = OF_TWO_PI / (100 + math.sin(ofGetElapsedTimef() / 5) * 60)
local radiusAdder = 0.5
local radius = 0
for i = 1, 200 do
local anglef = (i) * angleStep
local x = radius * math.cos(anglef)
local y = radius * math.sin(anglef)
ofVertex(x, y)
radius = radius + radiusAdder
end
ofEndShape(OF_CLOSE)
ofPopMatrix()
--[[---------------------------------------------------------------
ofCurveVertex
because it uses catmul rom splines, we need to repeat the first and last
items so the curve actually goes through those points
--]]---------------------------------------------------------------
ofSetHexColor(0x2bdbe6)
ofBeginShape()
for i = 1, nCurveVertexes do
if i == 1 then
ofCurveVertex(curveVertices[1].x, curveVertices[1].y)
ofCurveVertex(curveVertices[1].x, curveVertices[1].y)
elseif i == nCurveVertexes then
ofCurveVertex(curveVertices[i].x, curveVertices[i].y)
ofCurveVertex(curveVertices[1].x, curveVertices[1].y)
ofCurveVertex(curveVertices[1].x, curveVertices[1].y)
else
ofCurveVertex(curveVertices[i].x, curveVertices[i].y)
end
end
ofEndShape()
ofEnableAlphaBlending()
ofNoFill()
ofSetColor(0, 0, 0, 40)
ofBeginShape()
for i = 1, nCurveVertexes do
ofVertex(curveVertices[i].x, curveVertices[i].y)
end
ofEndShape(true)
ofSetColor(0, 0, 0, 80)
for i = 1, nCurveVertexes do
if curveVertices[i].bOver == true then
ofFill()
else
ofNoFill()
end
ofDrawCircle(curveVertices[i].x, curveVertices[i].y, 4)
end
ofDisableAlphaBlending()
--[[---------------------------------------------------------------
ofBezierVertex
with ofBezierVertex we can draw a curve from the current vertex
through the the next three vertexes we pass in.
(two control points and the final bezier point)
--]]---------------------------------------------------------------
local x0 = 500
local y0 = 300
local x1 = 550 + 50 * math.cos(ofGetElapsedTimef() * 1.0)
local y1 = 300 + 100 * math.sin(ofGetElapsedTimef() / 3.5)
local x2 = 600 + 30 * math.cos(ofGetElapsedTimef() * 2.0)
local y2 = 300 + 100 * math.sin(ofGetElapsedTimef())
local x3 = 650
local y3 = 300
ofFill()
ofSetHexColor(0xFF9933)
ofBeginShape()
ofVertex(x0, y0)
ofBezierVertex(x1, y1, x2, y2, x3, y3)
ofEndShape()
ofEnableAlphaBlending()
ofFill()
ofSetColor(0, 0, 0, 40)
ofDrawCircle(x0, y0, 4)
ofDrawCircle(x1, y1, 4)
ofDrawCircle(x2, y2, 4)
ofDrawCircle(x3, y3, 4)
ofDisableAlphaBlending()
--[[---------------------------------------------------------------
holes / ofNextContour
with ofNextContour we can create multi-contour shapes
this allows us to draw holes, for example...
--]]---------------------------------------------------------------
ofFill()
ofSetHexColor(0xd3ffd3)
ofDrawRectangle(80, 480, 140, 70)
ofSetHexColor(0xff00ff)
ofBeginShape()
ofVertex(100, 500)
ofVertex(180, 550)
ofVertex(100, 600)
ofNextContour(true)
ofVertex(120, 520)
ofVertex(160, 550)
ofVertex(120, 580)
ofEndShape(true)
--[[---------------------------------------------------------------
CSG / ofNextContour
with different winding rules, you can even use ofNextContour to
perform constructive solid geometry
--]]---------------------------------------------------------------
ofNoFill()
ofPushMatrix()
ofSetPolyMode(OF_POLY_WINDING_ODD)
ofBeginShape()
ofVertex(300, 500)
ofVertex(380, 550)
ofVertex(300, 600)
ofNextContour(true)
for i = 1, 20 do
local anglef = (i / 19.0) * OF_TWO_PI
local x = 340 + 30 * math.cos(anglef)
local y = 550 + 30 * math.sin(anglef)
ofVertex(x, y)
radius = radius + radiusAdder
end
ofEndShape(true)
ofTranslate(100, 0, 0)
ofSetPolyMode(OF_POLY_WINDING_NONZERO)
ofBeginShape()
ofVertex(300, 500)
ofVertex(380, 550)
ofVertex(300, 600)
ofNextContour(true)
for i = 1, 20 do
local anglef = (i / 19.0) * OF_TWO_PI
local x = 340 + 30 * math.cos(anglef)
local y = 550 + 30 * math.sin(anglef)
ofVertex(x, y)
radius = radius + radiusAdder
end
ofEndShape(true)
ofTranslate(100, 0, 0)
ofSetPolyMode(OF_POLY_WINDING_ABS_GEQ_TWO)
ofBeginShape()
ofVertex(300, 500)
ofVertex(380, 550)
ofVertex(300, 600)
ofNextContour(true)
for i = 1, 20 do
local anglef = (i / 19.0) * OF_TWO_PI
local x = 340 + 30 * math.cos(anglef)
local y = 550 + 30 * math.sin(anglef)
ofVertex(x, y)
radius = radius + radiusAdder
end
ofEndShape(true)
ofPopMatrix()
ofSetHexColor(0x000000)
ofDrawBitmapString("(a) star"..string.char(10).."winding rule odd", 20, 210)
ofSetHexColor(0x000000)
ofDrawBitmapString("(b) star"..string.char(10).."winding rule nonzero", 220, 210)
ofSetHexColor(0x000000)
ofDrawBitmapString("(c) dynamically"..string.char(10).."created shape", 420, 210)
ofSetHexColor(0x000000)
ofDrawBitmapString("(d) random points"..string.char(10).."poly", 670, 210)
ofSetHexColor(0x000000)
ofDrawBitmapString("(e) fun with sin/cos", 20, 410)
ofSetHexColor(0x000000)
ofDrawBitmapString("(f) ofCurveVertex"..string.char(10).."uses catmull rom"..string.char(10).."to make curved shapes", 220, 410)
ofSetHexColor(0x000000)
ofDrawBitmapString("(g) ofBezierVertex"..string.char(10).."uses bezier to draw curves", 460, 410)
ofSetHexColor(0x000000)
ofDrawBitmapString("(h) ofNextContour"..string.char(10).."allows for holes", 20, 610)
ofSetHexColor(0x000000)
ofDrawBitmapString("(i) ofNextContour"..string.char(10).."can even be used for CSG operations"..string.char(10).."such as union and intersection", 260, 620)
end
function M.mouseMoved(e)
for i = 1, nCurveVertexes do
local diffx = e.x - curveVertices[i].x
local diffy = e.y - curveVertices[i].y
local dist = math.sqrt(diffx * diffx + diffy * diffy)
if dist < curveVertices[i].radius then
curveVertices[i].bOver = true
else
curveVertices[i].bOver = false
end
end
end
function M.mouseDragged(e)
for i = 1, nCurveVertexes do
if curveVertices[i].bBeingDragged == true then
curveVertices[i].x = e.x
curveVertices[i].y = e.y
end
end
end
function M.mousePressed(e)
for i = 1, nCurveVertexes do
local diffx = e.x - curveVertices[i].x
local diffy = e.y - curveVertices[i].y
local dist = math.sqrt(diffx * diffx + diffy * diffy)
if dist < curveVertices[i].radius then
curveVertices[i].bBeingDragged = true
else
curveVertices[i].bBeingDragged = false
end
end
end
function M.mouseReleased(e)
for i = 1, nCurveVertexes do
curveVertices[i].bBeingDragged = false
end
end

View file

@ -1,14 +1,14 @@
#N canvas 255 324 509 358 12;
#X obj 193 94 f;
#X obj 229 94 + 1;
#X floatatom 193 144 5 0 0 0 - - -;
#X floatatom 193 193 5 0 0 0 - - -;
#X floatatom 193 242 5 0 0 0 - - -;
#X obj 28 66 hsl 110 20 0 1600 0 0 empty \$0-val empty -2 -8 0 10 -262130
#N canvas 255 324 509 414 12;
#X obj 193 118 f;
#X obj 229 118 + 1;
#X floatatom 193 168 5 0 0 0 - - -;
#X floatatom 193 217 5 0 0 0 - - -;
#X floatatom 193 266 5 0 0 0 - - -;
#X obj 28 66 hsl 110 20 0 300 0 0 empty \$0-val empty -2 -8 0 10 -262130
-1 -1 0 1;
#X obj 193 18 inlet;
#X obj 399 98 inlet;
#X obj 193 71 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
#X obj 399 122 inlet;
#X obj 193 95 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X obj 54 148 loadbang;
#X msg 54 198 range 0 \$1;
@ -16,52 +16,56 @@
-1;
#X floatatom 142 41 3 0 0 0 i #0-i -;
#X floatatom 50 91 7 0 0 0 val #0-val -;
#X obj 417 130 loadbang;
#X floatatom 298 100 5 0 0 0 - - -;
#X obj 193 119 mod;
#X obj 412 282 outlet;
#X obj 315 179 pack f f f f;
#X obj 417 154 loadbang;
#X floatatom 298 124 5 0 0 0 - - -;
#X obj 193 143 mod;
#X obj 412 306 outlet;
#X obj 315 203 pack f f f f;
#X floatatom 129 91 5 0 0 0 key #0-key -;
#X obj 315 282 outlet;
#X obj 315 306 outlet;
#X obj 275 18 inlet;
#X obj 193 168 tabread;
#X obj 417 159 f \$2;
#X obj 193 217 * \$1;
#X obj 298 75 array size;
#X msg 275 130 set \$1;
#X obj 193 192 tabread;
#X obj 417 183 f \$2;
#X obj 193 241 * \$1;
#X obj 298 99 array size;
#X msg 275 154 set \$1;
#X obj 54 173 f \$1;
#X obj 342 148 inlet;
#X obj 275 44 t a b a;
#X obj 225 291 s \$0-val;
#X obj 412 251 r \$0-val;
#X obj 342 172 inlet;
#X obj 275 68 t a b a;
#X obj 225 315 s \$0-val;
#X obj 412 275 r \$0-val;
#X text 201 38 1-bng;
#X text 321 18 2-array name;
#X text 341 125 3-key;
#X text 400 74 4-onoff;
#X text 314 305 1#msg;
#X text 414 305 2#val;
#X text 341 149 3-key;
#X text 400 98 4-onoff;
#X text 314 329 1#msg;
#X obj 145 66 tgl 20 0 empty \$0-onoff empty 17 7 0 8 -257985 -1 -1
0 1;
#X obj 249 168 s \$0-key;
#X obj 415 44 s \$0-onoff;
#X obj 249 192 s \$0-key;
#X obj 415 68 s \$0-onoff;
#X symbolatom 42 41 12 0 0 0 - - -;
#X msg 18 254 symbol no-array;
#X obj 18 229 loadbang;
#X obj 345 38 s \$0-an;
#X obj 426 43 s \$0-an;
#X obj 119 288 r \$0-an;
#X msg 315 220 \$4 \$2 \$1 \$3;
#X obj 136 144 s \$0-i;
#X obj 193 266 t a a;
#X msg 315 244 \$4 \$2 \$1 \$3;
#X obj 136 168 s \$0-i;
#X obj 193 290 t a a;
#X obj 364 342 outlet;
#X obj 364 275 r \$0-i;
#X text 414 329 3#val;
#X text 358 360 2#idx;
#X obj 275 43 list split 1;
#X connect 0 0 1 0;
#X connect 0 0 16 0;
#X connect 1 0 0 1;
#X connect 2 0 22 0;
#X connect 2 0 47 0;
#X connect 2 0 46 0;
#X connect 3 0 24 0;
#X connect 4 0 48 0;
#X connect 4 0 47 0;
#X connect 6 0 8 0;
#X connect 7 0 18 2;
#X connect 7 0 40 0;
#X connect 7 0 39 0;
#X connect 8 0 0 0;
#X connect 8 0 11 0;
#X connect 9 0 27 0;
@ -69,9 +73,8 @@
#X connect 14 0 23 0;
#X connect 15 0 16 1;
#X connect 16 0 2 0;
#X connect 18 0 46 0;
#X connect 21 0 29 0;
#X connect 21 0 44 0;
#X connect 18 0 45 0;
#X connect 21 0 52 0;
#X connect 22 0 3 0;
#X connect 23 0 18 3;
#X connect 24 0 4 0;
@ -79,15 +82,18 @@
#X connect 26 0 22 0;
#X connect 27 0 10 0;
#X connect 28 0 18 1;
#X connect 28 0 39 0;
#X connect 28 0 38 0;
#X connect 29 0 26 0;
#X connect 29 1 25 0;
#X connect 29 2 25 1;
#X connect 31 0 17 0;
#X connect 41 0 40 0;
#X connect 42 0 41 0;
#X connect 43 0 42 0;
#X connect 45 0 41 0;
#X connect 46 0 20 0;
#X connect 48 0 18 0;
#X connect 48 1 30 0;
#X connect 44 0 40 0;
#X connect 45 0 20 0;
#X connect 47 0 18 0;
#X connect 47 1 30 0;
#X connect 49 0 48 0;
#X connect 52 0 43 0;
#X connect 52 0 29 0;
#X coords 0 -1 1 1 150 95 1 20 20;

117
puredata/riff1.pd Normal file
View file

@ -0,0 +1,117 @@
#N canvas 355 364 551 449 12;
#X floatatom 193 170 5 0 0 0 - - -;
#X floatatom 193 239 5 0 0 0 - - -;
#X floatatom 193 288 5 0 0 0 - - -;
#X obj 28 66 hsl 110 20 0 800 0 0 empty \$0-val empty -2 -8 0 10 -262130
-1 -1 4049 1;
#X obj 193 18 inlet;
#X obj 157 144 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X obj 54 148 loadbang;
#X msg 54 198 range 0 \$1;
#X obj 25 41 bng 14 250 50 0 empty empty empty 17 7 0 10 -4034 -261234
-1;
#X floatatom 142 41 3 0 0 0 i #0-i -;
#X floatatom 50 91 7 0 0 0 val #0-val -;
#X obj 426 192 loadbang;
#X floatatom 369 124 5 0 0 0 - - -;
#X obj 421 344 outlet;
#X obj 324 241 pack f f f f;
#X floatatom 129 91 5 0 0 0 key #0-key -;
#X obj 324 344 outlet;
#X obj 346 18 inlet;
#X obj 193 214 tabread;
#X obj 426 221 f \$2;
#X obj 193 263 * \$1;
#X obj 369 99 array size;
#X msg 346 154 set \$1;
#X obj 54 173 f \$1;
#X obj 351 210 inlet;
#X obj 346 68 t a b a;
#X obj 225 337 s \$0-val;
#X obj 421 313 r \$0-val;
#X text 392 18 2-array name;
#X text 350 187 3-key;
#X text 323 367 1#msg;
#X obj 145 66 tgl 20 0 empty \$0-onoff empty 17 7 0 8 -257985 -1 -1
1 1;
#X obj 249 214 s \$0-key;
#X obj 453 112 s \$0-onoff;
#X symbolatom 42 41 12 0 0 0 - - -;
#X msg 18 254 symbol no-array;
#X obj 18 229 loadbang;
#X obj 451 63 s \$0-an;
#X obj 119 288 r \$0-an;
#X msg 324 282 \$4 \$2 \$1 \$3;
#X obj 136 170 s \$0-i;
#X obj 193 312 t a a;
#X obj 373 380 outlet;
#X obj 373 313 r \$0-i;
#X text 423 367 3#val;
#X text 367 398 2#idx;
#X obj 346 43 list split 1;
#X obj 193 120 f;
#X text 201 38 1-cmd for scan;
#X obj 193 65 route bang;
#X obj 260 90 route 0;
#X msg 260 115 0;
#X obj 193 145 scan \$3;
#X obj 193 92 t b b;
#X msg 426 167 1;
#X obj 257 145 t b b;
#X msg 426 142 0;
#X obj 257 170 del \$3;
#X obj 483 313 outlet;
#X text 483 335 4#done;
#X connect 0 0 18 0;
#X connect 0 0 40 0;
#X connect 0 0 5 0;
#X connect 1 0 20 0;
#X connect 2 0 41 0;
#X connect 4 0 49 0;
#X connect 5 0 8 0;
#X connect 6 0 23 0;
#X connect 7 0 3 0;
#X connect 11 0 19 0;
#X connect 12 0 47 1;
#X connect 14 0 39 0;
#X connect 17 0 46 0;
#X connect 18 0 1 0;
#X connect 19 0 14 3;
#X connect 20 0 2 0;
#X connect 21 0 12 0;
#X connect 22 0 18 0;
#X connect 23 0 7 0;
#X connect 24 0 14 1;
#X connect 24 0 32 0;
#X connect 25 0 22 0;
#X connect 25 1 21 0;
#X connect 25 2 21 1;
#X connect 27 0 13 0;
#X connect 35 0 34 0;
#X connect 36 0 35 0;
#X connect 38 0 34 0;
#X connect 39 0 16 0;
#X connect 41 0 14 0;
#X connect 41 1 26 0;
#X connect 43 0 42 0;
#X connect 46 0 37 0;
#X connect 46 0 25 0;
#X connect 47 0 52 0;
#X connect 49 0 53 0;
#X connect 49 1 50 0;
#X connect 50 0 51 0;
#X connect 51 0 52 0;
#X connect 52 0 0 0;
#X connect 52 1 55 0;
#X connect 53 0 47 0;
#X connect 53 1 54 0;
#X connect 54 0 14 2;
#X connect 54 0 33 0;
#X connect 55 0 57 0;
#X connect 55 1 56 0;
#X connect 56 0 14 2;
#X connect 56 0 33 0;
#X connect 57 0 14 0;
#X connect 57 0 58 0;
#X coords 0 -1 1 1 150 95 1 20 20;

20
puredata/scan-help.pd Normal file
View file

@ -0,0 +1,20 @@
#N canvas 630 384 450 300 12;
#X floatatom 120 194 5 0 0 0 - - -;
#X obj 120 224 print;
#X floatatom 120 73 5 0 0 1 scan_target - -;
#X msg 120 48 100;
#X floatatom 193 144 5 0 0 1 delay_amount_(ms) - -;
#X obj 120 163 scan 100;
#X msg 140 109 0;
#X text 174 109 if <= 0 \, stop immediately;
#X obj 173 198 bng 15 250 50 0 empty empty done! 17 7 0 10 -262144
-1 -1;
#X obj 173 224 print done;
#X connect 0 0 1 0;
#X connect 2 0 5 0;
#X connect 3 0 2 0;
#X connect 4 0 5 1;
#X connect 5 0 0 0;
#X connect 5 1 8 0;
#X connect 6 0 5 0;
#X connect 8 0 9 0;

58
puredata/scan.pd Normal file
View file

@ -0,0 +1,58 @@
#N canvas 136 328 385 426 12;
#X obj 120 295 f;
#X obj 84 295 + 1;
#X obj 218 270 sel 1;
#X msg 138 270 0;
#X obj 218 245 ==;
#X obj 236 195 - 1;
#X obj 39 71 inlet;
#X msg 179 215 0;
#X msg 106 214 1;
#X obj 106 245 metro \$1;
#X obj 106 155 t b b a;
#X msg 39 215 0;
#X obj 236 220 max 0;
#X text 5 4 <<<;
#X text 345 4 >>>;
#X text 5 394 <<<;
#X text 345 394 >>>;
#X text 39 22 generate numbers from 0 to given (inlet-1);
#X text 39 38 argument: delay amount (ms) between counts;
#X text 84 72 1-command:;
#X text 124 88 - number-> target value;
#X obj 169 134 inlet;
#X text 211 134 2-delay amount (ms);
#X text 124 102 - if <= 0 \, stop immediately;
#X obj 39 125 moses 1;
#X obj 278 315 outlet;
#X text 278 294 2#end bng;
#X msg 39 240 bang;
#X obj 120 320 t a a;
#X floatatom 152 345 5 0 0 0 - - -;
#X obj 152 369 outlet;
#X text 202 369 1#values;
#X connect 0 0 1 0;
#X connect 0 0 28 0;
#X connect 1 0 0 1;
#X connect 2 0 7 0;
#X connect 2 0 25 0;
#X connect 3 0 0 1;
#X connect 4 0 2 0;
#X connect 5 0 12 0;
#X connect 6 0 24 0;
#X connect 7 0 9 0;
#X connect 8 0 9 0;
#X connect 9 0 0 0;
#X connect 10 0 8 0;
#X connect 10 1 3 0;
#X connect 10 2 5 0;
#X connect 11 0 9 0;
#X connect 11 0 27 0;
#X connect 12 0 4 1;
#X connect 21 0 9 1;
#X connect 24 0 11 0;
#X connect 24 1 10 0;
#X connect 27 0 25 0;
#X connect 28 0 4 0;
#X connect 28 1 29 0;
#X connect 29 0 30 0;

72
puredata/star.lua Normal file
View file

@ -0,0 +1,72 @@
if type(window) ~= "userdata" then
window = ofWindow()
end
local clock = ofClock(this, "setup")
local DV = class()
function DV:__init(x, y)
self.x = x
self.y = y
self.bBeingDragged = false
self.bOver = false
self.radius = 4
end
local nCurveVertexes = 0
local curveVertices = {}
function M.new()
ofWindow.addListener("setup", this)
ofWindow.addListener("draw", this)
ofWindow.addListener("mouseMoved", this)
ofWindow.addListener("mouseDragged", this)
ofWindow.addListener("mousePressed", this)
ofWindow.addListener("mouseReleased", this)
window:setPosition(30, 100)
window:setSize(1024, 768)
if ofWindow.exists then
clock:delay(0)
else
window:create()
end
end
function M.free()
window:destroy()
ofWindow.removeListener("setup", this)
ofWindow.removeListener("draw", this)
ofWindow.removeListener("mouseMoved", this)
ofWindow.removeListener("mouseDragged", this)
ofWindow.removeListener("mousePressed", this)
ofWindow.removeListener("mouseReleased", this)
end
function M.setup()
ofSetWindowTitle("polygon example")
ofBackground(255, 255, 255, 255)
nCurveVertexes = 7
curveVertices = {DV(326, 209), DV(306, 279), DV(265, 331), DV(304, 383), DV(374, 383), DV(418, 209), DV(345, 279)}
end
function M.draw()
ofFill()
--[[---------------------------------------------------------------
draw a star dynamically
use the mouse position as a pct
to calc nPoints and internal point radius
--]]---------------------------------------------------------------
local angleChangePerPt = OF_TWO_PI / 3
local radius = 80
local origx = 525
local origy = 100
local angle = 0
ofSetHexColor(0xa16bca)
ofBeginShape()
for i = 0, 3 do
local x = origx + radius * math.cos(angle)
local y = origy + radius * math.sin(angle)
ofVertex(x, y)
angle = angle + angleChangePerPt
end
ofEndShape()
end

View file

@ -21,7 +21,7 @@
//============<identities>============
//
#define MY_GROUP_ID (4000)
#define MY_ID (MY_GROUP_ID + 1)
#define MY_ID (MY_GROUP_ID + 702)
#define MY_SIGN ("ROLLER")
//
//============</identities>============