Merge pull request #1732 from RAMilewski/master

Update skin.scad
This commit is contained in:
adrianVmariano
2025-06-22 19:42:11 -04:00
committed by GitHub
2 changed files with 43 additions and 11 deletions

View File

@@ -409,7 +409,7 @@ _ANCHOR_TYPES = ["intersect","hull"];
// Things get difficult when the objects are curved, or even when their edges are not neatly aligned with the coordinate axes.
// In these cases, the library may provide multiple different anchoring schemes, called the anchor types. When a module supports
// multiple anchor types, use the `atype=` parameter to select the anchor type you need.
// .
// .
// First consider the case of a simple rectangle whose corners have been rounded. Where should the anchors lie?
// The default anchor type puts them in the same location as the anchors of an unrounded rectangle, which means that for
// positive rounding radii, they are not even located on the perimeter of the object.

View File

@@ -3526,10 +3526,6 @@ function associate_vertices(polygons, split, curpoly=0) =
)
associate_vertices(newpoly, split, curpoly+1);
// Section: Texturing
// Some operations are able to add texture to the objects they create. A texture can be any regularly repeated variation in the height of the surface.
// To define a texture you need to specify how the height should vary over a rectangular block that is repeated to tile the object. Because textures
@@ -3611,12 +3607,15 @@ function associate_vertices(polygons, split, curpoly=0) =
// dots together. But in 3D example we need to triangulate the points on a grid, and this triangulation is not unique.
// The `style` argument lets you specify how the points are triangulated using the styles supported by {{vnf_vertex_array()}}.
// In the example below we have expanded the 2D example into 3D:
//
// ```openscad
// [[0,0,0,0],
// [0,1,1,0],
// [0,1,1,0],
// [0,0,0,0]]
// ```
//
// Continues:
// and we show the 3D triangulations produced by the different styles:
// Figure(3D,Big,NoAxes,VPR=[45.5,0,18.2],VPT=[2.3442,-6.25815,3.91529],VPD=35.5861):
// tex = [
@@ -3691,12 +3690,11 @@ function associate_vertices(polygons, split, curpoly=0) =
// extra points can be introduced in the interior of faces leading to unexpected irregularities in the textures, which appear
// as extra triangles. These artifacts can be minimized by making the VNF texture's faces as large as possible rather than using
// a triangulated VNF, but depending on the specific VNF texture, it may be impossible to entirely eliminate them.
// Figure(3D,Big,NoAxes,VPR=[140.9,0,345.7],VPT=[9.48289,-0.88709,5.7837],VPD=39.5401): The left shows a normal bricks_vnf texture. The right shows a texture that was first passed through {{vnf_triangulate()}}. Note the extra triangle artifacts visible at the ends on the brick faces.
// Figure(3D,Med,NoAxes,VPR=[140.9,0,345.7],VPT=[9.48289,-0.88709,5.7837],VPD=39.5401): The left shows a normal bricks_vnf texture. The right shows a texture that was first passed through {{vnf_triangulate()}}. Note the extra triangle artifacts visible at the ends on the brick faces.
// tex = texture("bricks_vnf");
// cyl(d=10,h=15,texture=tex, tex_reps=[4,2],tex_samples=5,rounding=2);
// up(7)fwd(-3)right(15)cyl(d=10,h=15,texture=vnf_triangulate(tex), tex_reps=[4,2],tex_samples=5,rounding=2);
//
// Function: texture()
// Topics: Textures, Knurling
// Synopsis: Produce a standard texture.
@@ -5262,8 +5260,42 @@ function _resample_point_array(data, size, col_wrap=false, row_wrap=false) =
]
];
// Subsection: Textures from Graphic Images
// The BOSL2 scripts folder contains three scripts for creating texture arrays from graphic images.
// .
// - **img2scad.py** is a python script that creates a texture array from most common raster image formats, including gif, png, jpeg.
// .
// - **img2scad.html** contains a javascript creates a texture array from any image your browser can render.
// .
// - **geotiff2scad.py** is a python script creates a texture array from geotiff depth maps.
// .
// Each of these scripts places a named array in an .scad file with names specified at run time. Use include<> to add the array to your model.
// .
// Both **img2scad.py** and **img2scad.html** provide similar capabilities, but the html script has a few additional capabilities
// as well as providing a graphical user interface.
// .
// On the right is a {{textured_tile()}} with the texture array created by **img2scad.html** from the .png file on the left:
// .
// ![Textured Tile](images/skin/WilburTex01.png)
// .
// The image luminance is directly translated into texture depth in the example above. Better results can be obtained by passing
// the original image through an AI image processor to produce a depth map from the image before creating the texture array.
// .
// ![Texture Tile](images/skin/WilburTex02.png)
// .
// AI image processing tool and workflows are still evolving rapidly. See the [discussion](https://github.com/BelfrySCAD/BOSL2/discussions/1731) on depth map workflows for current best practices.
// .
// Sources of whole planet GeoTIFF Data include:
// * [USGS Astrogeology Science Center](https://astrogeology.usgs.gov/search)
// * [NASA PDS (Planetary Data System)](https://pds.nasa.gov)
// * [OpenPlanetaryMap / OpenPlanetary](https://github.com/OpenPlanetary/opm)
// .
// GeoTIFF data for smaller areas comes from the Space Shuttle Radar Topography Mission. Data covering about 80% of the Earth's surface
// is available from [Earthdata](https://www.earthdata.nasa.gov/data/instruments/srtm/data-access-tools)
// .
// A globe created using the **geotiff2scad.py** script to generate the texture array:
// .
// ![Geotiff Example](images/skin/globe_animation.gif)
// .
// vim: expandtab tabstop=4 shiftwidth=4 softtabstop=4 nowrap