-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathof.circle.pd
39 lines (39 loc) · 1.92 KB
/
of.circle.pd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#N canvas 341 98 842 640 12;
#X obj 31 14 inlet;
#X obj 31 615 outlet;
#X obj 93 14 inlet;
#X obj 163 14 inlet;
#X text 785 536 RI;
#X msg 163 40 res \$1;
#X msg 93 40 size \$1;
#X obj 31 65 ofelia d circle-\$0 \; local c = ofCanvas(this) \; local
args = c:getArgs() \; local node\$0 = ofNode() \; local size \, res
\, drawmode \, strokeweight \, rectmode \, debug = args[1] \, args[2]
\, args[3] \, args[4] \, "center" \; local position \, orientation
\, scale \, lookat = ofVec3f() \, ofVec3f() \, ofVec3f(1 \, 1 \, 1)
\, ofVec3f() \; \; function M.new() \; if args[1] == nil then size
= 50 end \; if args[2] == nil then res = 20 end \; if args[3] == nil
then drawmode = "fill" end \; if args[4] == nil then strokeweight =
1 end \; end \; \; function M.size(f) size=f end \; function M.res(f)
res=f end \; function M.draw(s) drawmode = s end \; function M.stroke(f)
strokeweight = f end \; function M.list(l) size \, res \, drawmode
\, strokeweight = (table.unpack(l)) end \; function M.mode(s) rectmode
= s end \; function M.debug(f) debug = f end \; function M.position(l)
position:set (table.unpack(l)) node\$0:setPosition(position:vec3())
end \; function M.orientation(l) orientation:set (table.unpack(l))
node\$0:setOrientation(orientation:vec3()) end \; function M.scale(l)
scale:set (table.unpack(l)) node\$0:setScale(scale:vec3()) end \; function
M.lookat(l) lookat:set (table.unpack(l)) node\$0:lookAt(lookat:vec3())
end \; \; function M.bang() \; ofSetLineWidth(strokeweight) \; if drawmode
== "line" then ofNoFill() end \; node\$0:transformGL() \; ofSetCircleResolution(math.abs(res))
\; if rectmode == "center" then ofDrawCircle(0 \, 0 \, 0 \, size) else
ofDrawCircle(size \, size \, 0 \, size) end \; \; node\$0:restoreTransformGL()
\; if debug == 1 then node\$0:draw() end \; ofFill() \; return anything
\; end \;;
#X f 111;
#X connect 0 0 7 0;
#X connect 2 0 6 0;
#X connect 3 0 5 0;
#X connect 5 0 7 0;
#X connect 6 0 7 0;
#X connect 7 0 1 0;