OpenSCAD User Manual/Transformations: Difference between revisions
[unreviewed revision] | [unreviewed revision] |
better example |
Add hull() Tag: external link added |
||
Line 76: | Line 76: | ||
} |
} |
||
=== hull === |
|||
Displays the [http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Convex_hull_2/Chapter_main.html convex hull] of child nodes. |
|||
Usage example: |
|||
hull() { |
|||
translate([15,10,0]) circle(10); |
|||
circle(10); |
|||
} |
|||
{{BookCat}} |
{{BookCat}} |
Revision as of 03:54, 15 May 2011
scale
Scales its child elements using the specified vector. The argument name is optional.
Usage Example: scale(v = [x, y, z]) { ... }
rotate
Rotates its child a degrees around the specified vector (rooted in the origin of the coordinate system). The argument names are optional if the arguments are given in the same order as specified above.
Usage example: rotate(a = deg, v = [x, y, z]) { ... }
Alternatively the a parameter may be a vector of three degrees. In this case the child nodes are rotated around the positive x, y and z axis (in this order) by the specified number of degrees and the v argument is ignored and may be left unspecified.
For example, to flip an object upside-down, you might do this:
rotate(a=[0,180,0]) { ... }
translate
Translates (moves) its child elements along the specified vector. The argument name is optional.
Usage example: translate(v = [x, y, z]) { ... }
mirror
Mirrors the child element on a plane thru the origin. The argument to mirror() is the normal vector on that plane.
Usage example: mirror([ 0, 1, 0 ]) { ... }
multmatrix
Multiplies the geometry of all child elements with the given 4x4 transformation matrix.
Usage: multmatrix(m = [...]) { ... }
Example (translates by [10, 20, 30]):
multmatrix(m = [ [1, 0, 0, 10], [0, 1, 0, 20], [0, 0, 1, 30], [0, 0, 0, 1] ]) cylinder();
color
Displays the child elements using the specified RGB color + alpha value. This is only used for the OpenCSG and Thrown Together display modes. The alpha value will default to 1.0 (opaque) if not specified.
Usage example: color([r, g, b, a]) { ... }
Note that the r, g, b, a values are limited to floating point values in the range { 0.0 ... 1.0 } rather than the more traditional integers { 0 ... 255 }. However you can specify the values as fractions, e.g. for R,G,B integers in {0 ... 255} you can use:
color([ R/255, G/255, B/255 ]) { ... }
minkowski
Displays the minkowski sum of child nodes.
Usage example:
$fn=50; minkowski() { cube([10,10,1]); cylinder(r=2,h=1); }
hull
Displays the convex hull of child nodes.
Usage example:
hull() { translate([15,10,0]) circle(10); circle(10); }