Commit 9bbfaf2d authored by Neil Gershenfeld's avatar Neil Gershenfeld
Browse files

fixed with roundoff tolerance?

parent 29bf37e5
...@@ -74,7 +74,6 @@ f""" ...@@ -74,7 +74,6 @@ f"""
#include <png.h> #include <png.h>
using namespace std; using namespace std;
int fn(float X,float Y,float Z) {{ int fn(float X,float Y,float Z) {{
cout << Z << ' ' << (Z-(-0.06)) << endl;
return ({fn}); return ({fn});
}} }}
int main(int argc, char** argv) {{ int main(int argc, char** argv) {{
......
...@@ -172,7 +172,8 @@ def line(x0,y0,x1,y1,z,width): ...@@ -172,7 +172,8 @@ def line(x0,y0,x1,y1,z,width):
ny = dy/l ny = dy/l
rx = -ny rx = -ny
ry = nx ry = nx
part = "((((X-(x0))*(nx)+(Y-(y0))*(ny)) >= 0) & (((X-(x0))*(nx)+(Y-(y0))*(ny)) <= l) & (((X-(x0))*(rx)+(Y-(y0))*(ry)) >= (-width/2)) & (((X-(x0))*(rx)+(Y-(y0))*(ry)) <= (width/2)) & (Z == z))" roundoff = 1e-6
part = "((((X-(x0))*(nx)+(Y-(y0))*(ny)) >= 0) & (((X-(x0))*(nx)+(Y-(y0))*(ny)) <= l) & (((X-(x0))*(rx)+(Y-(y0))*(ry)) >= (-width/2)) & (((X-(x0))*(rx)+(Y-(y0))*(ry)) <= (width/2)) & (Z > (z-roundoff)) & (Z < (z+roundoff)))"
part = part.replace('x0',str(x0)) part = part.replace('x0',str(x0))
part = part.replace('x1',str(x1)) part = part.replace('x1',str(x1))
part = part.replace('y0',str(y0)) part = part.replace('y0',str(y0))
...@@ -183,6 +184,7 @@ def line(x0,y0,x1,y1,z,width): ...@@ -183,6 +184,7 @@ def line(x0,y0,x1,y1,z,width):
part = part.replace('ry',str(ry)) part = part.replace('ry',str(ry))
part = part.replace('l',str(l)) part = part.replace('l',str(l))
part = part.replace('z',str(z)) part = part.replace('z',str(z))
part = part.replace('roundoff',str(roundoff))
part = part.replace('width',str(width)) part = part.replace('width',str(width))
return part return part
......
{"function": "(16777215*(((((((3.02-X)-(1))*(0.0)+(Y-(1))*(1.0)) >= 0) & ((((3.02-X)-(1))*(0.0)+(Y-(1))*(1.0)) <= 0.8700000000000001) & ((((3.02-X)-(1))*(-1.0)+(Y-(1))*(0.0)) >= (-0.015/2)) & ((((3.02-X)-(1))*(-1.0)+(Y-(1))*(0.0)) <= (0.015/2)) & (Z == (-0.06))))))", "layers": [-0.06], "xmin": 0.95, "xmax": 2.07, "ymin": 0.95, "ymax": 1.9200000000000002, "mm_per_unit": 25.4, "type": "RGB"}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment