3DLDF can be used to make perspective projections of plane tesselations and other two-dimensional patterns. These can be used for drawing tiled floors and other architectural items, among other things. While patterns can be generated by using the basic facilities of C++ and 3DLDF without any specially defined functions, it can be useful to define such functions.
3DLDF currently contains only one function for drawing patterns based on a plane tessellation. I plan to add more soon.
*Colors::default_color, [Color fill_color_outer = *Colors::background_color, [Color draw_color_middle = *Colors::default_color, [Color fill_color_middle = *Colors::background_color, [Color draw_color_inner = *Colors::default_color, [Color fill_color_inner = *Colors::background_color, [string pen_outer = "pencircle scaled .5mm", [string pen_middle = "pencircle scaled .3mm", [string pen_inner = "pencircle scaled .3mm", [Picture& picture = current_picture, [unsigned int max_hexagons = 1000]]]]]]]]]]]]]]]]])Draws a pattern consisting of hexagons forming a tesselation of the x-z plane, with additional hexagons within them.
The arguments:
realdiameter_outer- Default: 5. The diameter of the outer hexagon in each set of three hexagons. The outer hexagons form a tessellation of the plane.
realdiameter_middle- Default: 0. The diameter of the middle hexagon in a set of three hexagons.
realdiameter_inner- Default: 0. The diameter of the inner hexagon in a set of three hexagons.
unsigned shortfirst_row- Default: 5. The number of sets of hexagons in the first single row. The second single row will have first_row + 1 sets of hexagons.
unsigned shortdouble_rows- Default: 10. The number of double rows drawn.
unsigned shortrow_shift- Default: 2. For row_shift != 0, the number of sets of hexagons in each (single) row is increased by 2 every row_shift rows. If row_shift == 0, the number sets of hexagons remains constant. The rows remain centered around the z-axis.
Colordraw_color_outer- Default:
*Colors::default_color. TheColorused for drawing the outer hexagons.Colorfill_color_outer- Default:
*Colors::background_color. TheColorused for filling the outer hexagons.Colordraw_color_middle- Default:
*Colors::default_color. TheColorused for drawing the middle hexagon.Colorfill_color_middle- Default:
*Colors::background_color. TheColorused for filling the middle hexagons.Colordraw_color_inner- Default:
*Colors::default_color. TheColorused for drawing the inner hexagons.Colorfill_color_inner- Default:
*Colors::background_color. TheColorused for filling the inner hexagons.stringpen_outer- Default:
"pencircle scaled .5mm". The pen used for drawing the outer hexagons.stringpen_middle- Default:
"pencircle scaled .3mm". The pen used for drawing the middle hexagons.stringpen_inner- Default:
"pencircle scaled .3mm". The pen used for drawing the inner hexagons.Picture&picture- Default:
current_picture. ThePictureonto which the pattern is put.unsigned intmax_hexagons- Default: 1000. The maximum number of hexagons that will be drawn.
Draws a pattern in the x-z plane consisting of hexagons. The outer hexagons form a tessellation. The middle and inner hexagons fit within the outer hexagons. The hexagons are drawn in double rows. The tessellation can be repeated by copying a double row and shifting the copy to lie directly behind the first double row. If the
Picturewith the pattern is projected with theFocusin front of the pattern, looking in the direction of the back of the pattern, the first row of hexagons will appear larger than the rows behind it. Therefore, in order for the perspective projection of the pattern to fill a rectangular area on the plane of projection, it will generally be necessary to increase the number of sets of hexagons in each double row. On the other hand, if the same number of sets of hexagons were used in the front double row, as will be needed for the back double row, many of them would probably be unprojectable.The return value of this function is the number of hexagons drawn.
default_focus.set(0, 10, -10, 0, 10, 25, 10); hex_pattern_1(1, 0, 0, 5, 5);
![]()
Fig. 178.
default_focus.set(-5, 5, -10, 0, 10, 25, 10); hex_pattern_1(2, 1.5, 1, 2, 5, 2, black, gray, black, light_gray, black);
![]()
Fig. 179.