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:
real
diameter_outer- Default: 5. The diameter of the outer hexagon in each set of three hexagons. The outer hexagons form a tessellation of the plane.
real
diameter_middle- Default: 0. The diameter of the middle hexagon in a set of three hexagons.
real
diameter_inner- Default: 0. The diameter of the inner hexagon in a set of three hexagons.
unsigned short
first_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 short
double_rows- Default: 10. The number of double rows drawn.
unsigned short
row_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.
Color
draw_color_outer- Default:
*Colors::default_color
. TheColor
used for drawing the outer hexagons.Color
fill_color_outer- Default:
*Colors::background_color
. TheColor
used for filling the outer hexagons.Color
draw_color_middle- Default:
*Colors::default_color
. TheColor
used for drawing the middle hexagon.Color
fill_color_middle- Default:
*Colors::background_color
. TheColor
used for filling the middle hexagons.Color
draw_color_inner- Default:
*Colors::default_color
. TheColor
used for drawing the inner hexagons.Color
fill_color_inner- Default:
*Colors::background_color
. TheColor
used for filling the inner hexagons.string
pen_outer- Default:
"pencircle scaled .5mm"
. The pen used for drawing the outer hexagons.string
pen_middle- Default:
"pencircle scaled .3mm"
. The pen used for drawing the middle hexagons.string
pen_inner- Default:
"pencircle scaled .3mm"
. The pen used for drawing the inner hexagons.Picture&
picture- Default:
current_picture
. ThePicture
onto which the pattern is put.unsigned int
max_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
Picture
with the pattern is projected with theFocus
in 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.