Skip to content

Commit

Permalink
Merge branch 'release/0.7.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
mkeeter committed Feb 17, 2015
2 parents 1315f1f + e260c76 commit 7c9068e
Show file tree
Hide file tree
Showing 52 changed files with 598 additions and 272 deletions.
17 changes: 15 additions & 2 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ sudo apt-get install build-essential
sudo apt-get install libpng-dev
sudo apt-get install python3-dev
sudo apt-get install libboost-all-dev
sudo apt-get install mesa-common-dev libgd-dev
git clone https://github.com/mkeeter/antimony
cd antimony
Expand All @@ -45,11 +46,23 @@ make -j8
./antimony
```
(the path to `qmake` may vary depending on how Qt 5.4 was installed)

The path to `qmake` may vary depending on how Qt 5.4 was installed; if the above path doesn't work, try
```
~/Qt/5.4/gcc_64/bin/qmake ../qt/antimony.pro
```
If running `make` gives the `/usr/bin/ld: cannot find -lGL`, create a symlink to the `libGL` file:
```
ln -s /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1.2.0 /usr/lib/libGL.so
```
You can use `make install`, or set up a symlink to run `antimony` from outside the build directory:
```
ln -s ~/antimony/build/antimony /usr/local/bin/antimony
```
If the top menu bar is not appearing in Ubuntu with a non-Unity
desktop environment (e.g. `gnome-session-flashback`), run
```
sudo apt-get remove appmenu-qt5
```
to make it appear.


14 changes: 14 additions & 0 deletions doc/release-notes/0.7.5.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Antimony 0.7.5
--------------

This is a pretty minor release feature-wise, but it's got a few simple
fixes that will speed up performance when designing large models.

**Features:**
- More nodes (thanks, Neil!).
- Limit size of script output window.
- Adding `str` input type for scripting

**Bugfixes:**
- Cache certain types of lookups to make redrawing graph window faster.
- Improve node change detection to make adding new nodes faster.
4 changes: 2 additions & 2 deletions py/nodes/2D/circles/circle_edge.node
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ title('circle edge')

def circle_edge(x0,y0,x1,y1):
from fab.types import Shape, Transform
xmid = (x0+x1)/2
ymid = (y0+y1)/2
xmid = (x0+x1)/2.0
ymid = (y0+y1)/2.0
r = math.sqrt((xmid-x0)*(xmid-x0)+(ymid-y0)*(ymid-y0))
# sqrt((X-xmid)^2+(Y-ymid)^2)-r
return Shape(
Expand Down
34 changes: 34 additions & 0 deletions py/nodes/2D/polygon.node
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Neil Gershenfeld 2/14/15

import fab

title('polygon')

def polygon_radius(x0,y0,N,r):
from fab.types import Shape, Transform
# max_n((X-x0)*xn+(Y-y0)*yn-r)
s = 'f-1'
xmin = 1e10
xmax = -1e10
ymin = 1e10
ymax = -1e10
N = int(N)
for n in range(N):
xn = math.sin((2*math.pi*n)/N)
yn = -math.cos((2*math.pi*n)/N)
s = 'a'+s+'-+*-Xf'+str(x0)+'f'+str(xn)+'*-Yf'+str(y0)+'f'+str(yn)+'f'+str(r)
xv = x0+r*math.sin((2*math.pi*(0.5+n))/N)/math.cos((2*math.pi*0.5)/N)
yv = y0-r*math.cos((2*math.pi*(0.5+n))/N)/math.cos((2*math.pi*0.5)/N)
if (xv < xmin): xmin = xv
if (xv > xmax): xmax = xv
if (yv < ymin): ymin = yv
if (yv > ymax): ymax = yv
return Shape(s,xmin,ymin,xmax,ymax)

input('x0',float,0)
input('y0',float,0)
input('N',float,5)
input('r',float,1)

output('shape',polygon_radius(x0,y0,N,r))

8 changes: 4 additions & 4 deletions py/nodes/2D/rectangles/rectangle_center.node
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ title('rectangle center')
def rectangle_center(x0,y0,width,height):
from fab.types import Shape, Transform
# max(max(x0-width/2-X,X-x0-width/2),max(y0-height/2-Y,Y-y0-height/2))
xmin = x0-width/2
ymin = y0-height/2
xmax = x0+width/2
ymax = y0+height/2
xmin = x0-width/2.0
ymin = y0-height/2.0
xmax = x0+width/2.0
ymax = y0+height/2.0
return Shape(
'aa-f%(xmin)gX-Xf%(xmax)ga-f%(ymin)gY-Yf%(ymax)g' % locals(),
x0-width/2,y0-height/2,x0+width/2,y0+height/2)
Expand Down
20 changes: 10 additions & 10 deletions py/nodes/2D/rectangles/rectangle_center_rounded.node
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ def rectangle_center_rounded(x0,y0,width,height,r):
from fab.types import Shape, Transform
def rectangle_center(x0,y0,width,height):
# max(max(x0-width/2-X,X-x0-width/2),max(y0-height/2-Y,Y-y0-height/2))
xmin = x0-width/2
ymin = y0-height/2
xmax = x0+width/2
ymax = y0+height/2
xmin = x0-width/2.0
ymin = y0-height/2.0
xmax = x0+width/2.0
ymax = y0+height/2.0
return Shape(
'aa-f%(xmin)gX-Xf%(xmax)ga-f%(ymin)gY-Yf%(ymax)g' % locals(),
x0-width/2,y0-height/2,x0+width/2,y0+height/2)
Expand All @@ -21,12 +21,12 @@ def rectangle_center_rounded(x0,y0,width,height,r):
'-r+q-Xf%(x0)gq-Yf%(y0)gf%(r)g' % locals(),
x0-r,y0-r,x0+r,y0+r)
return (
rectangle_center(x0,y0,width,height-2*r) |
rectangle_center(x0,y0,width-2*r,height) |
circle(x0+r-width/2,y0+r-height/2,r) |
circle(x0+r-width/2,y0+height/2-r,r) |
circle(x0+width/2-r,y0+r-height/2,r) |
circle(x0+width/2-r,y0+height/2-r,r)
rectangle_center(x0,y0,width,height-2.0*r) |
rectangle_center(x0,y0,width-2.0*r,height) |
circle(x0+r-width/2.0,y0+r-height/2.0,r) |
circle(x0+r-width/2.0,y0+height/2.0-r,r) |
circle(x0+width/2.0-r,y0+r-height/2.0,r) |
circle(x0+width/2.0-r,y0+height/2.0-r,r)
)

input('x0',float,0)
Expand Down
20 changes: 13 additions & 7 deletions py/nodes/3D/cones/cone_edge.node
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,19 @@ title('cone edge')
def cone_edge(x0,x1,y0,y1,z0,z1):
from fab.types import Shape, Transform
h = z1-z0
r = math.sqrt((x1-x0)*(x1-x0)+(y1-y0)*(y1-y0))/2
x0 = (x0+x1)/2
y0 = (y0+y1)/2
# max(sqrt((X-x0)^2+(Y-y0)^2)-r*(z0+h-Z)/h,z0-Z)
return Shape(
'a-r+q-Xf%(x0)gq-Yf%(y0)g/*f%(r)g-+f%(z0)gf%(h)gZf%(h)g-f%(z0)gZ' % locals(),
x0-r,y0-r,z0,x0+r,y0+r,z0+h)
r = math.sqrt((x1-x0)*(x1-x0)+(y1-y0)*(y1-y0))/2.0
x0 = (x0+x1)/2.0
y0 = (y0+y1)/2.0
if (h >= 0):
# max(sqrt((X-x0)^2+(Y-y0)^2)-r*(z0+h-Z)/h,z0-Z)
return Shape(
'a-r+q-Xf%(x0)gq-Yf%(y0)g/*f%(r)g-+f%(z0)gf%(h)gZf%(h)g-f%(z0)gZ' % locals(),
x0-r,y0-r,z0,x0+r,y0+r,z0+h)
else:
# max(sqrt((X-x0)^2+(Y-y0)^2)-r*(z0+h-Z)/h,Z-z0)
return Shape(
'a-r+q-Xf%(x0)gq-Yf%(y0)g/*f%(r)g-+f%(z0)gf%(h)gZf%(h)g-Zf%(z0)g' % locals(),
x0-r,y0-r,z0+h,x0+r,y0+r,z0)

input('x0',float,-1)
input('x1',float,1)
Expand Down
14 changes: 10 additions & 4 deletions py/nodes/3D/cones/cone_height.node
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@ title('cone height')

def cone_height(x0,y0,z0,r,h):
from fab.types import Shape, Transform
# max(sqrt((X-x0)^2+(Y-y0)^2)-r*(z0+h-Z)/h,z0-Z)
return Shape(
'a-r+q-Xf%(x0)gq-Yf%(y0)g/*f%(r)g-+f%(z0)gf%(h)gZf%(h)g-f%(z0)gZ' % locals(),
x0-r,y0-r,z0,x0+r,y0+r,z0+h)
if (h >= 0):
# max(sqrt((X-x0)^2+(Y-y0)^2)-r*(z0+h-Z)/h,z0-Z)
return Shape(
'a-r+q-Xf%(x0)gq-Yf%(y0)g/*f%(r)g-+f%(z0)gf%(h)gZf%(h)g-f%(z0)gZ' % locals(),
x0-r,y0-r,z0,x0+r,y0+r,z0+h)
else:
# max(sqrt((X-x0)^2+(Y-y0)^2)-r*(z0+h-Z)/h,Z-z0)
return Shape(
'a-r+q-Xf%(x0)gq-Yf%(y0)g/*f%(r)g-+f%(z0)gf%(h)gZf%(h)g-Zf%(z0)g' % locals(),
x0-r,y0-r,z0+h,x0+r,y0+r,z0)

input('x0',float,0)
input('y0',float,0)
Expand Down
12 changes: 6 additions & 6 deletions py/nodes/3D/cubes/cube_center.node
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ def cube_center(x0,y0,z0,width,height,depth):
from fab.types import Shape, Transform
# max(max(max(x0-width/2-X,X-x0-width/2),max(y0-height/2-Y,Y-y0-height/2)),
# max(z0-depth/2-Z,Z-z0-depth/2))
xmin = x0-width/2
ymin = y0-height/2
zmin = z0-depth/2
xmax = x0+width/2
ymax = y0+height/2
zmax = z0+depth/2
xmin = x0-width/2.0
ymin = y0-height/2.0
zmin = z0-depth/2.0
xmax = x0+width/2.0
ymax = y0+height/2.0
zmax = z0+depth/2.0
return Shape(
'aaa-f%(xmin)gX-Xf%(xmax)ga-f%(ymin)gY-Yf%(ymax)ga-f%(zmin)gZ-Zf%(zmax)g' % locals(),
xmin,ymin,zmin,xmax,ymax,zmax)
Expand Down
52 changes: 26 additions & 26 deletions py/nodes/3D/cubes/cube_center_rounded.node
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ def cube_center_rounded(x0,y0,z0,width,height,depth,r):
def cube_center(x0,y0,z0,width,height,depth):
# max(max(max(x0-width/2-X,X-x0-width/2),max(y0-height/2-Y,Y-y0-height/2)),
# max(z0-depth/2-Z,Z-z0-depth/2))
xmin = x0-width/2
ymin = y0-height/2
zmin = z0-depth/2
xmax = x0+width/2
ymax = y0+height/2
zmax = z0+depth/2
xmin = x0-width/2.0
ymin = y0-height/2.0
zmin = z0-depth/2.0
xmax = x0+width/2.0
ymax = y0+height/2.0
zmax = z0+depth/2.0
return Shape(
'aaa-f%(xmin)gX-Xf%(xmax)ga-f%(ymin)gY-Yf%(ymax)ga-f%(zmin)gZ-Zf%(zmax)g' % locals(),
xmin,ymin,zmin,xmax,ymax,zmax)
Expand Down Expand Up @@ -46,26 +46,26 @@ def cube_center_rounded(x0,y0,z0,width,height,depth,r):
cube_center(x0,y0,z0,width-2*r,height-2*r,depth) |
cube_center(x0,y0,z0,width-2*r,height,depth-2*r) |
cube_center(x0,y0,z0,width,height-2*r,depth-2*r) |
sphere_center(x0+r-width/2,y0+r-height/2,z0+r-depth/2,r) |
sphere_center(x0-r+width/2,y0+r-height/2,z0+r-depth/2,r) |
sphere_center(x0+r-width/2,y0-r+height/2,z0+r-depth/2,r) |
sphere_center(x0+r-width/2,y0+r-height/2,z0-r+depth/2,r) |
sphere_center(x0-r+width/2,y0-r+height/2,z0+r-depth/2,r) |
sphere_center(x0-r+width/2,y0+r-height/2,z0-r+depth/2,r) |
sphere_center(x0+r-width/2,y0-r+height/2,z0-r+depth/2,r) |
sphere_center(x0-r+width/2,y0-r+height/2,z0-r+depth/2,r) |
cylinder_x(x0+r-width/2,x0-r+width/2,y0+r-height/2,z0+r-depth/2,r) |
cylinder_x(x0+r-width/2,x0-r+width/2,y0-r+height/2,z0+r-depth/2,r) |
cylinder_x(x0+r-width/2,x0-r+width/2,y0+r-height/2,z0-r+depth/2,r) |
cylinder_x(x0+r-width/2,x0-r+width/2,y0-r+height/2,z0-r+depth/2,r) |
cylinder_y(x0+r-width/2,y0+r-height/2,y0-r+height/2,z0+r-depth/2,r) |
cylinder_y(x0-r+width/2,y0+r-height/2,y0-r+height/2,z0+r-depth/2,r) |
cylinder_y(x0+r-width/2,y0+r-height/2,y0-r+height/2,z0-r+depth/2,r) |
cylinder_y(x0-r+width/2,y0+r-height/2,y0-r+height/2,z0-r+depth/2,r) |
cylinder_z(x0+r-width/2,y0+r-height/2,z0+r-depth/2,z0-r+depth/2,r) |
cylinder_z(x0-r+width/2,y0+r-height/2,z0+r-depth/2,z0-r+depth/2,r) |
cylinder_z(x0+r-width/2,y0-r+height/2,z0+r-depth/2,z0-r+depth/2,r) |
cylinder_z(x0-r+width/2,y0-r+height/2,z0+r-depth/2,z0-r+depth/2,r)
sphere_center(x0+r-width/2.0,y0+r-height/2.0,z0+r-depth/2.0,r) |
sphere_center(x0-r+width/2.0,y0+r-height/2.0,z0+r-depth/2.0,r) |
sphere_center(x0+r-width/2.0,y0-r+height/2.0,z0+r-depth/2.0,r) |
sphere_center(x0+r-width/2.0,y0+r-height/2.0,z0-r+depth/2.0,r) |
sphere_center(x0-r+width/2.0,y0-r+height/2.0,z0+r-depth/2.0,r) |
sphere_center(x0-r+width/2.0,y0+r-height/2.0,z0-r+depth/2.0,r) |
sphere_center(x0+r-width/2.0,y0-r+height/2.0,z0-r+depth/2.0,r) |
sphere_center(x0-r+width/2.0,y0-r+height/2.0,z0-r+depth/2.0,r) |
cylinder_x(x0+r-width/2.0,x0-r+width/2.0,y0+r-height/2.0,z0+r-depth/2.0,r) |
cylinder_x(x0+r-width/2.0,x0-r+width/2.0,y0-r+height/2.0,z0+r-depth/2.0,r) |
cylinder_x(x0+r-width/2.0,x0-r+width/2.0,y0+r-height/2.0,z0-r+depth/2.0,r) |
cylinder_x(x0+r-width/2.0,x0-r+width/2.0,y0-r+height/2.0,z0-r+depth/2.0,r) |
cylinder_y(x0+r-width/2.0,y0+r-height/2.0,y0-r+height/2.0,z0+r-depth/2.0,r) |
cylinder_y(x0-r+width/2.0,y0+r-height/2.0,y0-r+height/2.0,z0+r-depth/2.0,r) |
cylinder_y(x0+r-width/2.0,y0+r-height/2.0,y0-r+height/2.0,z0-r+depth/2.0,r) |
cylinder_y(x0-r+width/2.0,y0+r-height/2.0,y0-r+height/2.0,z0-r+depth/2.0,r) |
cylinder_z(x0+r-width/2.0,y0+r-height/2.0,z0+r-depth/2.0,z0-r+depth/2.0,r) |
cylinder_z(x0-r+width/2.0,y0+r-height/2.0,z0+r-depth/2.0,z0-r+depth/2.0,r) |
cylinder_z(x0+r-width/2.0,y0-r+height/2.0,z0+r-depth/2.0,z0-r+depth/2.0,r) |
cylinder_z(x0-r+width/2.0,y0-r+height/2.0,z0+r-depth/2.0,z0-r+depth/2.0,r)
)

input('x0',float,0)
Expand Down
52 changes: 26 additions & 26 deletions py/nodes/3D/cubes/cube_corner_rounded.node
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ def cube_corner_rounded(x0,y0,z0,x1,y1,z1,r):
def cube_center(x0,y0,z0,width,height,depth):
# max(max(max(x0-width/2-X,X-x0-width/2),max(y0-height/2-Y,Y-y0-height/2)),
# max(z0-depth/2-Z,Z-z0-depth/2))
xmin = x0-width/2
ymin = y0-height/2
zmin = z0-depth/2
xmax = x0+width/2
ymax = y0+height/2
zmax = z0+depth/2
xmin = x0-width/2.0
ymin = y0-height/2.0
zmin = z0-depth/2.0
xmax = x0+width/2.0
ymax = y0+height/2.0
zmax = z0+depth/2.0
return Shape(
'aaa-f%(xmin)gX-Xf%(xmax)ga-f%(ymin)gY-Yf%(ymax)ga-f%(zmin)gZ-Zf%(zmax)g' % locals(),
xmin,ymin,zmin,xmax,ymax,zmax)
Expand Down Expand Up @@ -52,26 +52,26 @@ def cube_corner_rounded(x0,y0,z0,x1,y1,z1,r):
cube_center(x0,y0,z0,width-2*r,height-2*r,depth) |
cube_center(x0,y0,z0,width-2*r,height,depth-2*r) |
cube_center(x0,y0,z0,width,height-2*r,depth-2*r) |
sphere_center(x0+r-width/2,y0+r-height/2,z0+r-depth/2,r) |
sphere_center(x0-r+width/2,y0+r-height/2,z0+r-depth/2,r) |
sphere_center(x0+r-width/2,y0-r+height/2,z0+r-depth/2,r) |
sphere_center(x0+r-width/2,y0+r-height/2,z0-r+depth/2,r) |
sphere_center(x0-r+width/2,y0-r+height/2,z0+r-depth/2,r) |
sphere_center(x0-r+width/2,y0+r-height/2,z0-r+depth/2,r) |
sphere_center(x0+r-width/2,y0-r+height/2,z0-r+depth/2,r) |
sphere_center(x0-r+width/2,y0-r+height/2,z0-r+depth/2,r) |
cylinder_x(x0+r-width/2,x0-r+width/2,y0+r-height/2,z0+r-depth/2,r) |
cylinder_x(x0+r-width/2,x0-r+width/2,y0-r+height/2,z0+r-depth/2,r) |
cylinder_x(x0+r-width/2,x0-r+width/2,y0+r-height/2,z0-r+depth/2,r) |
cylinder_x(x0+r-width/2,x0-r+width/2,y0-r+height/2,z0-r+depth/2,r) |
cylinder_y(x0+r-width/2,y0+r-height/2,y0-r+height/2,z0+r-depth/2,r) |
cylinder_y(x0-r+width/2,y0+r-height/2,y0-r+height/2,z0+r-depth/2,r) |
cylinder_y(x0+r-width/2,y0+r-height/2,y0-r+height/2,z0-r+depth/2,r) |
cylinder_y(x0-r+width/2,y0+r-height/2,y0-r+height/2,z0-r+depth/2,r) |
cylinder_z(x0+r-width/2,y0+r-height/2,z0+r-depth/2,z0-r+depth/2,r) |
cylinder_z(x0-r+width/2,y0+r-height/2,z0+r-depth/2,z0-r+depth/2,r) |
cylinder_z(x0+r-width/2,y0-r+height/2,z0+r-depth/2,z0-r+depth/2,r) |
cylinder_z(x0-r+width/2,y0-r+height/2,z0+r-depth/2,z0-r+depth/2,r)
sphere_center(x0+r-width/2.0,y0+r-height/2.0,z0+r-depth/2.0,r) |
sphere_center(x0-r+width/2.0,y0+r-height/2.0,z0+r-depth/2.0,r) |
sphere_center(x0+r-width/2.0,y0-r+height/2.0,z0+r-depth/2.0,r) |
sphere_center(x0+r-width/2.0,y0+r-height/2.0,z0-r+depth/2.0,r) |
sphere_center(x0-r+width/2.0,y0-r+height/2.0,z0+r-depth/2.0,r) |
sphere_center(x0-r+width/2.0,y0+r-height/2.0,z0-r+depth/2.0,r) |
sphere_center(x0+r-width/2.0,y0-r+height/2.0,z0-r+depth/2.0,r) |
sphere_center(x0-r+width/2.0,y0-r+height/2.0,z0-r+depth/2.0,r) |
cylinder_x(x0+r-width/2.0,x0-r+width/2.0,y0+r-height/2.0,z0+r-depth/2.0,r) |
cylinder_x(x0+r-width/2.0,x0-r+width/2.0,y0-r+height/2.0,z0+r-depth/2.0,r) |
cylinder_x(x0+r-width/2.0,x0-r+width/2.0,y0+r-height/2.0,z0-r+depth/2.0,r) |
cylinder_x(x0+r-width/2.0,x0-r+width/2.0,y0-r+height/2.0,z0-r+depth/2.0,r) |
cylinder_y(x0+r-width/2.0,y0+r-height/2.0,y0-r+height/2.0,z0+r-depth/2.0,r) |
cylinder_y(x0-r+width/2.0,y0+r-height/2.0,y0-r+height/2.0,z0+r-depth/2.0,r) |
cylinder_y(x0+r-width/2.0,y0+r-height/2.0,y0-r+height/2.0,z0-r+depth/2.0,r) |
cylinder_y(x0-r+width/2.0,y0+r-height/2.0,y0-r+height/2.0,z0-r+depth/2.0,r) |
cylinder_z(x0+r-width/2.0,y0+r-height/2.0,z0+r-depth/2.0,z0-r+depth/2.0,r) |
cylinder_z(x0-r+width/2.0,y0+r-height/2.0,z0+r-depth/2.0,z0-r+depth/2.0,r) |
cylinder_z(x0+r-width/2.0,y0-r+height/2.0,z0+r-depth/2.0,z0-r+depth/2.0,r) |
cylinder_z(x0-r+width/2.0,y0-r+height/2.0,z0+r-depth/2.0,z0-r+depth/2.0,r)
)

input('x0',float,-2)
Expand Down
27 changes: 18 additions & 9 deletions py/nodes/3D/pyramids/pyramid_edge.node
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,24 @@ def pyramid_edge(x0,x1,y0,y1,z0,z1):
w = x1-x0
d = y1-y0
h = z1-z0
x0 = (x0+x1)/2
y0 = (y0+y1)/2
# max(Y-y0+(d/2)*(z0+h-Z)/h,
# max(y0-(d/2)*(z0+h-Z)/h-Y,
# max(X-x0+(w/2)*(z0+h-Z)/h,
# max(x0-(w/2)*(z0+h-Z)/h-X,z0-Z))
return Shape(
'a-Y+f%(y0)g*/f%(d)gf2/-+f%(z0)gf%(h)gZf%(h)ga--f%(y0)g*/f%(d)gf2/-+f%(z0)gf%(h)gZf%(h)gYa-X+f%(x0)g*/f%(w)gf2/-+f%(z0)gf%(h)gZf%(h)ga--f%(x0)g*/f%(w)gf2/-+f%(z0)gf%(h)gZf%(h)gX-f%(z0)gZ' % locals(),
x0-w/2,y0-d/2,z0,x0+w/2,y0+d/2,z0+h)
x0 = (x0+x1)/2.0
y0 = (y0+y1)/2.0
if (h >= 0):
# max(Y-y0+(w/2)*(z0+h-Z)/h,
# max(y0-(w/2)*(z0+h-Z)/h-Y,
# max(X-x0+(w/2)*(z0+h-Z)/h,
# max(x0-(w/2)*(z0+h-Z)/h-X,z0-Z))
return Shape(
'a-Y+f%(y0)g*/f%(w)gf2/-+f%(z0)gf%(h)gZf%(h)ga--f%(y0)g*/f%(w)gf2/-+f%(z0)gf%(h)gZf%(h)gYa-X+f%(x0)g*/f%(w)gf2/-+f%(z0)gf%(h)gZf%(h)ga--f%(x0)g*/f%(w)gf2/-+f%(z0)gf%(h)gZf%(h)gX-f%(z0)gZ' % locals(),
x0-w/2,y0-w/2,z0,x0+w/2,y0+w/2,z0+h)
else:
# max(Y-y0+(w/2)*(z0+h-Z)/h,
# max(y0-(w/2)*(z0+h-Z)/h-Y,
# max(X-x0+(w/2)*(z0+h-Z)/h,
# max(x0-(w/2)*(z0+h-Z)/h-X,Z-z0))
return Shape(
'a-Y+f%(y0)g*/f%(w)gf2/-+f%(z0)gf%(h)gZf%(h)ga--f%(y0)g*/f%(w)gf2/-+f%(z0)gf%(h)gZf%(h)gYa-X+f%(x0)g*/f%(w)gf2/-+f%(z0)gf%(h)gZf%(h)ga--f%(x0)g*/f%(w)gf2/-+f%(z0)gf%(h)gZf%(h)gX-Zf%(z0)g' % locals(),
x0-w/2,y0-w/2,z0+h,x0+w/2,y0+w/2,z0)

input('x0',float,-1)
input('x1',float,1)
Expand Down
Loading

0 comments on commit 7c9068e

Please sign in to comment.