Skip to content

Instantly share code, notes, and snippets.

@mildred
Created January 9, 2012 14:28
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 mildred/1583164 to your computer and use it in GitHub Desktop.
Save mildred/1583164 to your computer and use it in GitHub Desktop.
Geometry, escalier
Marches := Object clone do(
face := method(
Polygon clone declarePoints(a, b, c, d)
)
marche1 := method(
face do(
a haveXY(5cm, 2.5cm)
b haveXY(5cm, 0)
c haveXY(80cm, 0)
d haveXY(80cm, 40cm)
) extrude(2.5cm)
)
marche2 := method(
face do(
a haveXY(5cm, 5cm)
b haveXY(5cm, 2.5cm)
c haveXY(80cm, 40cm)
d haveXY(80cm, 80cm)
) extrude(2.5cm)
)
noyau := method(
Square clone haveSideLength(10cm) extrude(2.6m)
)
)
MarchesBis := Object clone do(
noyau := method(
Circle clone haveDiameter(10cm) extrude(2.6m)
)
marche1 := method(
#ClosedContour clone \
# add(Circle clone haveDiameter(20cm) haveClosedAngle(180deg)) \
# add(Line clone haveLength(75cm)) \
# addAngle(90deg) \
# add(Line clone haveLength(40cm)) \
# closeWith(Line) \
# extrude(2.5cm)
c1 := Circle clone haveDiameter(20cm)
c2 := Circle clone haveDiameter(10cm) haveCenter(c1 center)
c1 declarePoints(a, b)
l1 := Line clone haveBeginningIn(a) haveLength(40cm) isTangeantWith(c1, a)
l2 := Line clone haveBeginningIn(b) isTangeantWith(c1, b)
l3 := Line clone haveBeginningIn(l2 ending) haveEndingIn(l1 ending)
# angle 90deg to define
contour := ClosedContour clone haveSegments(c1 getArc(a, b), l2, l3, l1)
Face clone includeFaces(c1, contour) excludeFaces(c2) extrude(2.5cm)
)
marche2 := method(
c1 := Circle clone haveDiameter(20cm)
c2 := Circle clone haveDiameter(10cm) haveCenter(c1 center)
c1 declarePoints(a, b)
l1 := Line clone haveBeginningIn(a) haveLength(40cm) isTangeantWith(c1, a)
l2 := Line clone haveBeginningIn(b) isTangeantWith(c1, b)
l3 := Line clone haveBeginningIn(l2 ending) haveEndingIn(l1 ending)
contour := ClosedContour clone haveSegments(c1 getArc(a, b), l2, l3, l1)
Face clone includeFaces(c1, contour) excludeFaces(c2) extrude(2.5cm)
)
)
MarcheCommon := Group clone do(
face := onceMethod(
F := Face clone
F declarePoints(a, b, c, d)
line(a, b) isVertical isIncludedIn(noyau)
line(c, d) isVertical isIncludedIn(tremille) haveLength(0.40)
F
)
noyau := onceMethod(
face declarePoints(a, b, c, d)
res := poly(a, b, c, d) isAlignedSquare haveSideLength(10)
line(a, c) haveCenter(face getOrigin)
line(b, d) haveCenter(face getOrigin)
res
)
tremille := onceMethod(
face declarePoints(a, b, c, d)
res := poly(a, b, c, d) isAlignedSquare haveSideLength(160)
line(a, c) haveCenter(face getOrigin)
line(b, d) haveCenter(face getOrigin)
res
)
)
Marche1 := MarcheCommon clone do(
marche := onceMethod(
face getPoints(a, b, c, d)
both(b, c) haveX(0)
face extrude(2.5)
)
)
Marche2 := Marche1 clone do(
marche := onceMethod(
face getPoints(a, b, c, d)
noyau getLineHaving(l1, l2, l1 center x > l2 center x)
face extrude(2.5)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment