Skip to content

Instantly share code, notes, and snippets.

@zeffii
Created September 3, 2013 06:17
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/6420246 to your computer and use it in GitHub Desktop.
Save zeffii/6420246 to your computer and use it in GitHub Desktop.
coffee_sol_lewitt_rules

[ 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

{"description":"coffee_sol_lewitt_rules","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}},"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"}
###
----> digitized
A quadrangle which is formed and enclosed by four lines,
the first of which is drawn from a point halfway between
a point halfway between the center of the wall
and the upper left corner and the midpoint of the left side
and the upper left corner to a point halfway between the midpoint of top
side and the upper right corner,
the second line from a point halfway between the start of the first line and
a point halfway between the midpoint on the top side and the upper left
corner to point halfway between a point halfway between the center of the wall and the
to the lower left corner and the mid point of the bottom side,
the third line from a point halfway between a point halfway between the start of the
first line and end end of the second line and a point halway between the midpoint of
the left side and lower left corner to point which is on an axis between the lower
left corner to a point halfway between the midpoint of the right side and the upper
right corner where a line drawn from the center of the wall to a point halfway between
the midpoint of the right side and the lower right corner would cros that axis,
the fourth line from a point equidistant from the end of the thirdline, the end of
the second line and a point halfway between the center of the wall and midpoint of the
bottom side and a point halfway between the midpoint of the bottom side and lower
right corner to point halway between the start of the econd line and a point where
a line would cross the first line if it were drawn from the midpoint of the right
side to a point halfway between the midpoint of the top side and the upper left
corner
SL 1974.
----> abbreviate, legend
A = topleft
B = topright
C = bottomright
D = bottomleft
X = center
AB = midtop
BC = midright
CD = midbottom
AD = midleft
A quadrangle which is formed and enclosed by four lines,
the first = L1
from a point halfway between
a point halfway between (X) and (A) and (AD) and (A) to a point halfway between
(AB) and (B)
second line = L2
from a point halfway between the start of (L1) and a point halfway between (AB) and (A)
to point halfway between a point halfway between (X) and (D) and (CD),
third line = L3
from a point halfway between a point halfway between the start of (L1) and the end of (L2)
and a point halfway between (AD) and (D) to point which is on an axis between
(D) to a point halfway between (BC) and (B) where a line drawn from the (X) to
a point halfway between the (BC) and (C) would cros that axis,
fourth line = L4
from a point equidistant from the end of (L3), the end of (l2) and a point halfway
between (X) and (CD) and a point halfway between (CD) and (C) to point halway between
the start of (L2) and a point where a line would cross (L1) if it were drawn from
(BC) to a point halfway between (AB) and (A)
----> second abbreviation
PHWB = a point halfway between
A quadrangle which is formed and enclosed by four lines,
L1 =
from -> PHWB PHWB (X) and (A) and (AD) and (A)
to PHWB (AB) and (B)
L2 =
from PHWB the start of (L1) and PHWB (AB) and (A)
to PHWB PHWB (X) and (D) and (CD),
L3 =
from PHWB PHWB the start of (L1) and the end of (L2)
and PHWB (AD) and (D) to point which is on an axis between
(D) to PHWB (BC) and (B) where a line drawn from the (X) to
PHWB the (BC) and (C) would cros that axis,
L4 =
from a point equidistant from the end of (L3), the end of (l2) and PHWB (X) and (CD)
and PHWB (CD) and (C) to PHWB the start of (L2) and a point where a line would cross (L1) if it were drawn from
(BC) to PHWB (AB) and (A)
----> 3rd abbrevation
PHWB = a point halfway between (takes two arguments)
A quadrangle which is formed and enclosed by four lines,
L1 =
from -> PHWB PHWB (X) and (A) and (AD) and (A)
to -> PHWB(AB, B)
L2 =
from -> PHWB the start of (L1) and PHWB (AB) and (A)
to -> PHWB PHWB (X) and (D) and (CD),
L3 =
from -> PHWB PHWB the start of (L1) and the end of (L2) and PHWB (AD) and (D)
to point which is on an axis between (D)
to PHWB(BC, B) where a line drawn from the (X) to PHWB(BC, C) would cros that axis,
L4 =
from -> point equidistant from the end of (L3), the end of (L2) and PHWB(X, CD) and PHWB(CD, C)
to PHWB the start of (L2) and a point where a line would cross (L1) if it were drawn from
(BC) to PHWB(AB, A)
----> 3rd abbrevation
PHWB = a point halfway between (takes two arguments)
A quadrangle which is formed and enclosed by four lines,
L1 =
( from: a point halfway between a point halfway between the center of the wall and
the upper left corner and the midpoint of the left side and the upper left corner )
( from: a point halfway between
- a point halfway between
- the center of the wall
- and the upper left corner
- and the midpoint of the left side
- and the upper left corner )
from -> PHWB PHWB(X, A) and (AD) and (A)
to -> PHWB(AB, B)
L2 =
from -> PHWB the start of (L1) and PHWB (AB) and (A)
to -> PHWB PHWB (X) and (D) and (CD),
L3 =
from -> PHWB PHWB the start of (L1) and the end of (L2) and PHWB (AD) and (D)
to point which is on an axis between (D)
to PHWB(BC, B) where a line drawn from the (X) to PHWB(BC, C) would cros that axis,
L4 =
from -> point equidistant from the end of (L3), the end of (L2) and PHWB(X, CD) and PHWB(CD, C)
to PHWB the start of (L2) and a point where a line would cross (L1) if it were drawn from
(BC) to PHWB(AB, A)
----> 4th abbrevation
###
get_points = (angle, amp) ->
x: Math.cos(angle) * amp
y: Math.sin(angle) * amp
between = (p1, p2) ->
x: (p1.x + p2.x) * 0.5
y: (p1.y + p2.y) * 0.5
equid = (points) ->
{x:0.3, y:4.3}
intersect = (line1, line2) ->
[x1,y1,x2,y2] = [line1.x1, line1.y1, line1.x2, line1.y2]
[x3,y3,x4,y4] = [line2.x1, line2.y1, line2.x2, line2.y2]
[bx, by_] = [x2 - x1, y2 - y1]
[dx, dy] = [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_
d3.select("body").style "background-color", d3.rgb(25, 25, 25)
svg = d3.select("svg")
defs = svg.append("defs")
group1 = svg.append("g").classed("group1", true)
group1
.attr("transform", "translate(" + [37, 150] + ")")
.style
fill: "none"
stroke: "#aeaeae"
thin = 0.3
thick = 1.2
X = width = 700
Y = height = 440
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
# PHWB = between
# A quadrangle which is formed and enclosed by four lines,
# L1 =
# from -> PHWB PHWB(MID, A) and (AD) and (A), to -> PHWB(AB, B)
L1 =
p1: between( between( between(MID, A), AD), A)
p2: between(AB, B)
#L2 =
#from -> PHWB (L1.p1) and PHWB (AB) and (A)
#to -> PHWB PHWB (MID) and (D) and (CD),
L2 =
p1: between(L1.p1, between(AB, A))
p2: between( between(MID, D), CD)
#L_support_1 =
#from -> (X), to -> PHWB(BC, C)
L_support_1 = {p1: X, p2: between(BC, C)}
#L3 =
#from -> PHWB PHWB (L1.p1) and (L2.p2) and PHWB (AD) and (D)
#to point which is on an axis between (D)
#to PHWB(BC, B) where L_support_1 would cross that axis,
L3 =
p1: between( between(L1.p1, L2.p2), between(AD, D)),
p2: between( between(BC, B), D)
#L_support_2 =
#from -> (BC), to PHWB(AB, A)
L_support_2 = {p1: BC, p2: between(AB, A)}
#L4 =
#from -> point equidistant from (L3.p2), (L2.p2) and PHWB(MID, CD) and PHWB(CD, C)
#to -> PHWB (L2.p1) and a point where a L_support_2 crosses (L1)
L4 =
p1: equid([L3.p2, L2.p2, between(MID, CD), between(CD, C)])
p2: between(L2.p1, intersect(L_support_2, L1))
# 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_2, line_thickness: thin},
{line: L3, line_thickness: thin},
{line: L4, line_thickness: thick},
]
lines = group1.selectAll('line').data(line_data)
lines.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)
verts.enter()
.append('circle')
.attr
r: 3
cx: (d) -> d.x
cy: (d) -> d.y
.style
stroke: "none"
fill: "#789BA2"
# equidistance only
points = [L3.p2, L2.p2, between(MID, CD), between(CD, C)]
.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;}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment