Skip to content

Instantly share code, notes, and snippets.

@zeffii
Created September 4, 2013 12:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zeffii/6436229 to your computer and use it in GitHub Desktop.
Save zeffii/6436229 to your computer and use it in GitHub Desktop.
coffee_sol_lewitt_rules4

[ Launch: coffee_sol_lewitt_rules3 ] 6436229 by zeffii
[ Launch: coffee_sol_lewitt_rules2 ] 6435259 by zeffii
[ Launch: coffee_sol_lewitt_rules ] 6422996 by zeffii
[ Launch: coffee_template ] 6420246 by zeffii
[ Launch: boomstick_motion_wcolor_coffee ] 6399870 by zeffii
[ Launch: boomstick_motion_wcolor_coffee ] 6382272 by zeffii
[ Launch: boomstick_motion_wcolor_coffee ] 6382237 by zeffii
[ Launch: boomstick_motion_wcolor_coffee ] 6379220 by zeffii
[ Launch: boomstick_motion_wcolor ] 6376715 by zeffii
[ Launch: boomstick_motion2 ] 6365156 by zeffii
[ Launch: boomstick_motion ] 6364686 by zeffii
[ Launch: boomstick ] 6364584 by zeffii
[ Launch: zeffii default ] 6364028 by zeffii
[ Launch: zeffii default ] 5033869 by zeffii

german version found, but I highly recommend not looking at the drawing until
after you have spent time trying to figure out how to interpret the instructions.
at:
" the placing of a quad "
full page (german)
http://www.walkerart.org/collections/artworks/die-plazierung-eines-vierecks-the-location-of-a-quadrangle
just text (german)
image: http://i.imgur.com/ZpOWUi2.png
© The LeWitt Estate / Artists Rights Society (ARS), New York
Translation is my own: (it was bugging me, but it is no improvement)
The first line starts **from** a point halfway between a point halfway between
the centre of the page (wall) and the bottom right corner and the middle of
the left edge and the top right corner **to** a point halfway between
the middle of the bottom edge and top right corner.
The second line starts **from** a point halfway between the starting-point of
the 1st line and a point halfway between the middle of the bottom edge and
the top left corner **to** a point halfway between a point halfway between
the center of the page (wall) and the bottom left corner and the middle of
the bottom edge.
The third line starts **from** a point halfway between a point halfway between
the starting-point of the 1st line and the end-point of the 2nd line and
a point halfway between the middle of the left edge and the bottom left corner
**to** a point 'auf einer Achse von der' bottom left corner to a point
halfway between the middle of the right edge and the top right corner,
where a line from the center of the page to a point halfway between
the middle of the right edge and the bottom right corner would intersect the axis.
The fourth line starts **from** a point the same distance between the end of
the 3rd line, the endpoint of the 2nd line, and from a point halfway between
a point halfway between the center of the page and the middle of
the bottom edge and a point halfway between the middle of the bottom edge and
the bottom right corner **to** a point halfway between the starting point of
the 2nd line and a point, where a line would intersect the 1st line, if it ran
from the middle of the right edge to a point halfway between the middle of
the top edge and the top left corner.
SL 1974.
My thoughts:
Though Written in a procedural way, these instructions are at times somewhat
obfuscated and definitely inefficient without symbols.
- The 1st line turns out to be unparsable without adding an extra 'halfway between'
statement.
- The 3rd line doesn't make sense to me introducing the term axis
- image to test against: http://i.imgur.com/akyto53.png
{"description":"coffee_sol_lewitt_rules4","endpoint":"","display":"svg","public":true,"require":[],"fileconfigs":{"inlet.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"style.css":{"default":true,"vim":false,"emacs":false,"fontSize":12},"_.md":{"default":true,"vim":false,"emacs":false,"fontSize":12},"config.json":{"default":true,"vim":false,"emacs":false,"fontSize":12},"data2.csv":{"default":true,"vim":false,"emacs":false,"fontSize":12},"util.js":{"default":true,"vim":false,"emacs":false,"fontSize":12},"injet.coffee":{"default":true,"vim":false,"emacs":false,"fontSize":12},"inlet.coffee":{"default":true,"vim":false,"emacs":false,"fontSize":12},"readme.txt":{"default":true,"vim":false,"emacs":false,"fontSize":12},"util.coffee":{"default":true,"vim":false,"emacs":false,"fontSize":12}},"fullscreen":false,"play":false,"loop":false,"restart":false,"autoinit":true,"pause":true,"loop_type":"period","bv":false,"nclones":15,"clone_opacity":0.4,"duration":3000,"ease":"linear","dt":0.01,"thumbnail":"http://i.imgur.com/OqFYJQH.png"}
###
Info in the readme.txt tab (links to original german text)
latest version
http://tributary.io/inlet/6440274
(with overlay)
###
# utils, importing from util.coffee in the tab above.
between = tributary.between
equid = tributary.equid
intersect = tributary.intersect
# constants and setup
d3.select("body").style "background-color", d3.rgb(225, 225, 225)
svg = d3.select("svg")
group1 = svg.append("g").classed("group1", true)
.attr("transform", "translate(" + [200, 100] + ")")
.style
fill: "none"
stroke: "#aeaeae"
# background
scalar = 0.6
X = width = 966 * scalar
Y = height = 979 * scalar
img_url = "http://i.imgur.com/akyto53.png";
group1.insert("image")
.attr
"xlink:href": img_url
"width": width
"height": height
#"transform": 'translate(' + [-1, -27] + ')'
thin = 0.3
thick = 1.2
A = {x: 0, y: 0} # top left
B = {x: X, y: 0} # top right
C = {x: X, y: Y} # bottom right
D = {x: 0, y: Y} # bottom left
MID = between(A, C) # center
AB = between(A, B) # mid top
BC = between(B, C) # mid right
CD = between(C, D) # mid bottom
AD = between(A, D) # mid left
### drawing instructions decomposed ###
L1 =
p1: between( between( between(MID, A), AD), A)
p2: between(AB, B)
L2 =
p1: between(L1.p1, between(AB, A))
p2: between( between(MID, D), CD)
L_support_1 = {p1: D, p2: between(BC, B)}
L_support_1b = {p1: MID, p2: between(BC, C)}
L3 =
p1: between( between(L1.p1, L2.p2), between(AD, D)),
p2: intersect(L_support_1, L_support_1b)
###
**from** a point the same distance between the end of
the 3rd line, the endpoint of the 2nd line, and from a point halfway between
a point halfway between the center of the page and the middle of
the bottom edge and a point halfway between the middle of the bottom edge and
the bottom right corner
eq< L3.p2, L2.p2, phwb(phwb(MID, CD), phwb(CD,C)) >
###
eq =
p1: L3.p2
p2: L2.p2
p3: between(between(MID, CD), between(CD, C))
L_support_2 = {p1: BC, p2: between(AB, A)}
L4 =
p1: equid([eq.p1, eq.p2, eq.p3])
p2: between(L2.p1, intersect(L_support_2, L1))
### populate svg ###
# lines only
line_data = [
{line: {p1: A, p2: B}, line_thickness: thin},
{line: {p1: B, p2: C}, line_thickness: thin},
{line: {p1: C, p2: D}, line_thickness: thin},
{line: {p1: A, p2: D}, line_thickness: thin},
{line: L1, line_thickness: thick},
{line: L2, line_thickness: thick},
{line: L_support_1, line_thickness: thin},
{line: L_support_1b, line_thickness: thin},
{line: L_support_2, line_thickness: thin},
{line: L3, line_thickness: thick},
{line: L4, line_thickness: thick},
]
lines = group1.selectAll('line').data(line_data).enter()
.append('line')
.attr
x1: (d) -> d.line.p1.x
y1: (d) -> d.line.p1.y
x2: (d) -> d.line.p2.x
y2: (d) -> d.line.p2.y
.style
'stroke-width': (d) -> d.line_thickness
# verts only
vert_data = [A, B, C, D, MID, AB, BC, CD, AD]
verts = group1.selectAll('circle').data(vert_data).enter()
.append('circle')
.attr
r: 2.3
cx: (d) -> d.x
cy: (d) -> d.y
.style
stroke: "none"
fill: "#789BA2"
# labels_only
pu = 20
label_data = [
{n: 'A', pos: A, tr: [-pu,-pu]},
{n: 'B', pos: B, tr: [pu,-pu]},
{n: 'C', pos: C, tr: [pu,pu]},
{n: 'D', pos: D, tr: [-pu,pu]},
{n: 'MID', pos: MID, tr: [0,-0.5*pu]},
{n: 'AB', pos: AB, tr: [0,-pu]},
{n: 'BC', pos: BC, tr: [1.5*pu,0]},
{n: 'CD', pos: CD, tr: [0,1.5*pu]},
{n: 'AD', pos: AD, tr: [-1.5*pu,0]}]
labels = group1.append('g').classed('labels', true)
.style
stroke: "none"
fill: "#615B5B"
label = labels.selectAll('text').data(label_data).enter()
.append('text')
.attr
x: (d) -> d.pos.x
y: (d) -> d.pos.y
"text-anchor": "middle"
.text( (d) -> d.n)
.attr
'transform': (d) -> 'translate('+ d.tr + ')'
.style
"font-size": 14
# quad only
quad = group1.append("path")
.style
fill: '#DDFFDD'
'fill-opacity': 0.2
stroke: '#D690AF'
'stroke-width': 2.16
.attr
d: (d) ->
p1 = intersect(L1, L2)
p2 = intersect(L2, L3)
p3 = intersect(L3, L4)
p4 = intersect(L4, L1)
'M' + [p1.x, p1.y, p2.x, p2.y, p3.x, p3.y, p4.x, p4.y] + 'z'
# tri only
quad = group1.append("path")
.style
fill: '#DDFFDD'
'fill-opacity': 0.01
stroke: '#D690AF'
'stroke-width': 1.16
'stroke-dasharray': "5,5"
.attr
d: (d) ->
'M' + [eq.p1.x, eq.p1.y, eq.p2.x, eq.p2.y, eq.p3.x, eq.p3.y] + 'z'
.cm-s-elegant.CodeMirror { background: #1e2426; color: #696969; }
.cm-s-elegant div.CodeMirror-selected {background: #064968 !important;} /* 33322B*/
.cm-s-elegant span.cm-variable { color:#22EFFF; }
.cm-s-elegant span.cm-variable-2 { color: #FFCCB4; }
.cm-s-elegant span.cm-variable-3 { color: white; }
.cm-s-elegant span.cm-string { color: Chartreuse; }
.cm-s-elegant span.cm-string-2 {color: Chartreuse;}
.cm-s-elegant span.cm-def {color: #FFCCB4; opacity: 1.0}
.cm-s-elegant span.cm-bracket { color: #EBEFE7; }
.cm-s-elegant pre { color:#FFF; }
.cm-s-elegant span.cm-qualifier { color:#C0C0C0; }
.cm-s-elegant span.cm-comment { color: #AFB4B4;}
.cm-s-elegant span.cm-property {color: #FDA676;}
.cm-s-elegant span.cm-number { color: #FF92EE;}
.cm-s-elegant span.cm-keyword { color: #FFFF18; }
.cm-s-elegant .CodeMirror-cursor { border-left: 1px solid white !important; }
.cm-s-elegant .CodeMirror-gutters {background: #505050;}
.cm-s-elegant .CodeMirror-linenumber {color: #D3D3D3;}
tributary.between = (p1, p2) ->
x: (p1.x + p2.x) * 0.5
y: (p1.y + p2.y) * 0.5
# this calculates average, and is not the same as equidistant
# this is wrong.
tributary.equid = (points) ->
num = points.length
[ret_x, ret_y] = [0, 0]
for p in points
ret_x += p.x
ret_y += p.y
x: ret_x / num
y: ret_y / num
tributary.intersect = (line1, line2) ->
[x1,y1,x2,y2] = [line1.p1.x, line1.p1.y, line1.p2.x, line1.p2.y]
[x3,y3,x4,y4] = [line2.p1.x, line2.p1.y, line2.p2.x, line2.p2.y]
[bx, by_, dx, dy] = [x2 - x1, y2 - y1, x4 - x3, y4 - y3]
b_dot_d_perp = (bx * dy) - (by_ * dx)
return None if b_dot_d_perp is 0
[cx, cy] = [x3 - x1, y3 - y1]
t = (cx * dy - cy * dx) / b_dot_d_perp
x: x1 + t * bx
y: y1 + t * by_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment