# A grammar for 3d design using beams. The output of the grammar is a # string which can be eval'd in blender-python. It evals to a list of # shapes which are drawn in render.py. # # We use two methods of creating lists of shapes. We can use map(), or # we can use a method which returns multiple (somehow connected) # shapes. A possible third method -- creating a single shape in square # brackets (indicating a list) is not used yet. # These two lines provide a test mechanism -- if you have some code you # want to test, just paste it in as and see if it runs. To use the # real grammar, comment these two lines out. # ::= | " " # ::= "map_mapply([lambda x: connect3(x,0),lambda x: [dropPerpendicular(x,2)],lambda x: connect3(x,2)],map(lambda t:geometry.pt_plus_pt((lambda t:interpolate(t,((14,10,8),(9,15,12))))(t),(lambda t:(0.0,0.0,11*(1.0-cos(1*4*pi*t))))(t)),make_scalar_list(10)))" ::= ::= # Given a list of functions and a list of points, return a list of shapes ::= map_mapply(, ) # Only one method of creating a list of points. Consider other methods? ::= map(, make_scalar_list()) # Functions which return a point, given a scalar. ::= | | | | | | # Given a scalar t, return a point on the spiral around a bezier carrier curve. # The radius, initial phase, and number of revolutions can be specified. ::= "lambda t": spiral(t, , , , ) # Given a scalar t, return a point on a diagonal between two points. ::= "lambda t": interpolate(t, (, )) # Given a scalar t, return a point on a circle with given radius and centre # in the plane indicated by . # FIXME the circle shouldn't have to be aligned to one of the three axes -- could # instead pass in three points to define the plane in which the circle lies. ::= "lambda t": circlePath(t, , , ) ::= "lambda t": ellipsePath(t, , , , ) ::= "lambda t": geometry.pt_plus_pt(()(t), ()(t)) # use 4pi * t so that we get 2 full revolutions, for t in [0, 1] ::= "lambda t": (0.0, 0.0, ) | "lambda t": (0.0, , 0.0) | "lambda t": (, 0.0, 0.0) # use 1.0 + cos() to keep it positive, avoid negative z values ::= * (1.0 + cos( * 4 * pi * t)) # Given a scalar t, return a point on a cubic bezier curve. ::= "lambda t": bezier_form(t, (, , , )) # Functions which return a shape (really a LIST of shapes), given a point. ::= "lambda x": [connect(, x)] | "lambda x": [dropPerpendicular(x, 2)] | "lambda x": connect3(x, ) #| "lambda x": [connectToOrigin(x)] ::= [] ::= | , ::= 1 | 2 | 3 | 4 # points are represented as tuples ::= (, , ) # is used for point coordinates ::= # is used for (eg) point counts, in lists of points ::= # a small, floating point value ::= # indicates x, y or z ::= 0 | 1 | 2 ::= ::= ::=