Learning Objectives
By the end of this lesson, students should be able to:
- Understand the concept of mirroring in OpenSCAD.
- Use the
mirror
function to create symmetrical models. - Apply the
mirror
function to manipulate objects’ positions in the 3D space.
Mirroring Objects in OpenSCAD
Mirroring is a common technique used in 3D modeling to create symmetrical shapes or to change the orientation of an object. In OpenSCAD, the mirror
function allows us to transform an object into a mirror image of itself across a plane that intersects the origin.
The argument to the mirror
function specifies the normal vector of the mirror plane (the vector perpendicular to the mirror plane). This argument is a list of three numbers representing the X, Y, and Z coordinates of the normal vector.
Remember, the mirror
function does not create a copy of the original object but rather modifies it directly.
Examples of Using the mirror
Function
Here are some examples of using the mirror
function:
- Mirroring along the x-axis:
hand(); // original mirror([1,0,0]) hand();
- Mirroring along a plane defined by the vector [1,1,0]:
hand(); // original mirror([1,1,0]) hand();
- Mirroring along a plane defined by the vector [1,1,1]:
hand(); // original mirror([1,1,1]) hand();
- Mirroring a rotated cube:
rotate([0,0,10]) cube([3,2,1]); mirror([1,0,0]) translate([1,0,0]) rotate([0,0,10]) cube([3,2,1]);
In these examples, the hand();
and cube([3,2,1]);
functions create the original 3D objects, and the mirror
function is used to create their mirror images.
Review
In this lesson, you learned:
- What mirroring is in 3D modeling and how it is implemented in OpenSCAD.
- How to use the
mirror
function to create symmetrical objects or change the orientation of an object. - The argument to the
mirror
function specifies the normal vector to the mirror plane.