Trygon
2015-11-16 15:11:33 UTC
OpenSCAD currently supports a whole range of specific linear transformations
such as translate(), rotate() and scale(), in addition to the generic linear
transformation multmatrix().
OpenSCAD does not provide support for non-linear transformations. I think
support for non-linear transformations would be very useful and this could
be accomplished with a new transformation command:
transform(x_expression, y_expression, z_expression)
reserved names within transform() expressions: x, y & z, these represent the
vertex being processed
The examples below use this syntax.
Equivalent Linear Transformations:
1) pass data through, no change to vertices
transform(x, y, z) { ... }
2) scale([xf,yf,zf]) { ... } <-> transform(xf*x, yf*y, zf*z) { ... }
3) translate([x1,y1,z1]) { ... } <-> transform(x+x1, y+y1, z+z1) { ... }
4) multmatrix([[xx, xy, xz, xc], [yx, yy, yz, yc], [zx, zy, zz, zc], [0, 0,
0, 1]) { ... } <->
transform(xx*x+xy*y+xz*z+xc, yx*x+yy*y+yz*z+yc, zx*x+zy*y+zz*z+zc) { ...
}
Non-Linear Transformations:
1) exponential x scaling
transform(x*x, y, z) { ... }
2) "conic" expansion in x-y plane, scale factor=1 for z=20
transform(x*z/20 ,y*z/20 ,z) cylinder(h=40, r=10);
3) scale specific co-ordinate ranges
transform(x>0?2*x:x, abs(y)>50?3*y:y, z) { ... }
4) insert "gap" of 40mm centred on y=0
transform(x ,y>0?y+20:y-20, z) cylinder(h=20, r=10);
Comments please!
Cheers,
Trygon
--
View this message in context: http://forum.openscad.org/Non-Linear-Transformations-tp14539.html
Sent from the OpenSCAD mailing list archive at Nabble.com.
such as translate(), rotate() and scale(), in addition to the generic linear
transformation multmatrix().
OpenSCAD does not provide support for non-linear transformations. I think
support for non-linear transformations would be very useful and this could
be accomplished with a new transformation command:
transform(x_expression, y_expression, z_expression)
reserved names within transform() expressions: x, y & z, these represent the
vertex being processed
The examples below use this syntax.
Equivalent Linear Transformations:
1) pass data through, no change to vertices
transform(x, y, z) { ... }
2) scale([xf,yf,zf]) { ... } <-> transform(xf*x, yf*y, zf*z) { ... }
3) translate([x1,y1,z1]) { ... } <-> transform(x+x1, y+y1, z+z1) { ... }
4) multmatrix([[xx, xy, xz, xc], [yx, yy, yz, yc], [zx, zy, zz, zc], [0, 0,
0, 1]) { ... } <->
transform(xx*x+xy*y+xz*z+xc, yx*x+yy*y+yz*z+yc, zx*x+zy*y+zz*z+zc) { ...
}
Non-Linear Transformations:
1) exponential x scaling
transform(x*x, y, z) { ... }
2) "conic" expansion in x-y plane, scale factor=1 for z=20
transform(x*z/20 ,y*z/20 ,z) cylinder(h=40, r=10);
3) scale specific co-ordinate ranges
transform(x>0?2*x:x, abs(y)>50?3*y:y, z) { ... }
4) insert "gap" of 40mm centred on y=0
transform(x ,y>0?y+20:y-20, z) cylinder(h=20, r=10);
Comments please!
Cheers,
Trygon
--
View this message in context: http://forum.openscad.org/Non-Linear-Transformations-tp14539.html
Sent from the OpenSCAD mailing list archive at Nabble.com.