Skip to content

Support adding transformations #15

@anandology

Description

@anandology

Here is a wild idea.

Add support for adding transformations with the following property.

T1(s) + T2(s) == (T1+T2)(s)

This could be used to generate higher-order transformation that combine multiple transformations. With this, users would be able to create their own transformations.

Examples:

def twiceX(width):
    return translate(x=0, y=0) + translate(x=width, y=0)

shape = circle(r=50) | twiceX(width=100)
def grid(shape, w, h):
    t1 = translate(x=-w/2, y=h/2)
    t2 = translate(x=-w/2, y=-h/2)
    t3 = translate(x=w/2, y=h/2)
    t4 = translate(x=w/2, y=-h/2)
    return t1 + t2 + t3 + t4

shape = circle(r=50) | grid(w=100, h=100)
show(shape)

@amitkaps what do you think?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions