Textures

Port of BOSL2’s texture() engine (from skin.scad): the named-texture table that surfaces3d() builds from. texture() resolves a texture name to its data — either a height-field (a 2-D array of heights in [0, 1]) or a VNF tile (verts, faces) describing one unit cell of the surface.

All of BOSL2’s textures are ported (9 height-field + 12 VNF). Height-field textures: ribs, trunc_ribs, wave_ribs, diamonds, pyramids, trunc_pyramids, hills, bricks, rough. VNF-tile textures: diamonds_vnf, pyramids_vnf, trunc_pyramids_vnf, cubes, trunc_ribs_vnf, bricks_vnf, checkers, trunc_diamonds, tri_grid, and the $fn-parametric cones, dots and hex_grid (pass fn for their resolution). A few VNF tiles that can’t be tiled watertight directly (bricks_vnf, checkers, trunc_diamonds) fall back to a sampled height-field, which slightly flattens their vertical faces. .. autofunction:: pybosl2.textures.texture

pybosl2.textures.vnf_tile_to_solid(tile, size, reps, tex_depth=1.0, inset=0.0)[source]

Tile a VNF texture cell over a size [x, y] rectangle and close into a watertight solid.

Parameters:
tile : VNF

The texture cell as a VNF (SPEC C-8).

size : Sequence[float]

The [x, y] rectangle to cover.

reps : Sequence[int]

Repetitions along each axis.

tex_depth : float

Scale applied to the tile’s z.

inset : float

Subtracted from the tile’s z before scaling.

Returns:

The closed solid. Ask is_watertight() whether the tiling closed cleanly – a tile with pinch points or interior holes will not.

Return type:

VNF