diff --git a/content/sundries/a-very-digital-artifact/geotiff-files.png b/content/sundries/a-very-digital-artifact/geotiff-files.png new file mode 100644 index 0000000..a7ef7d4 Binary files /dev/null and b/content/sundries/a-very-digital-artifact/geotiff-files.png differ diff --git a/content/sundries/a-very-digital-artifact/index.md b/content/sundries/a-very-digital-artifact/index.md index d526e06..9d7fc7d 100644 --- a/content/sundries/a-very-digital-artifact/index.md +++ b/content/sundries/a-very-digital-artifact/index.md @@ -39,9 +39,9 @@ say, that was a bluff. ![the programmer's creed: we do these things not because they are easy, but because we thought they were going to be easy -- from twitter user @unoservix, 2016-08-05][programmers_creed] -*
me, every time
* +*
me, every single time
* -Also needless to say, my bluff was called almost immediately, and I had the following exchange with the +Also needless to say, my bluff was immediately called, and I had the following exchange with the shop: > *CNC Shop*: STL can work but I can’t manipulate it, which could save some money. If possible can it @@ -54,19 +54,21 @@ shop: > > *Me*: That's totally fair! I'll get you some files in a few days. -"I'll get you some files in a few days," was an even harder lean into the bluff; my next -communication with the shop was nearly four weeks later. But that's getting ahead of things. +"STP should be no problem ... I'll get you some files in a few days," was an even harder lean into +the bluff; my next communication with the shop was nearly four weeks later. But that's getting ahead +of things. # Meshes and solid bodies First off, let's talk about file formats and how to represent shapes with a -computer.[^math-computers] I said I could provide an *STL +computer.[^math-computers] I first said I could provide an *STL file*. [STL](https://en.wikipedia.org/wiki/STL_(file_format)) is a pretty bare-bones format that -describes the outside surface of a shape as a set of many, many triangles, each of which is -described by three 3D points, forming a "mesh" in the shape of the thing you're modeling. This -format is popular with 3D printers, which is how I became familiar with it. +describes the outside surface of a shape as a mesh of many, many triangles, each of which is +described by three 3D points, where each point (but not necessarily each edge) of the triangle lies +on the surface of the shape of the thing you're modeling. This format is popular with 3D printers, +which is how I became familiar with it. -This format is simple to implement and easy for a computer to read, but if you have a model in that +STL is simple to implement and easy for a computer to read, but if you have a model in that format that you need to manipulate, like you want to merge it with another shape, you won't have a good time. In order to actually do things like change the shape of the model, it needs to be converted into a CAD program's native representation of a "solid body", which is pretty much what it @@ -77,39 +79,98 @@ In order for the CAD program to convert a mesh into a solid body, the mesh must meaning, no missing faces (triangles), and with a clearly-defined interior and exterior (all triangles are facing in one direction relative to their interior). When there are no missing faces, it's called "water tight". You can still have "holes" in a mesh, like if you have a model of a -donut, but the surface of the donut can't have any missing faces. +donut[^manifold_holes], but the surface of the donut can't have any missing faces. A valid STL +file's meshes are manifold. The CNC shop had requested a model in a format called [ST**P**](https://www.fastradius.com/resources/everything-you-need-to-know-about-step-files/). `.stp` is the extension for a "STEP" file; STEP is supposed to be short for "standard for the exchange of product data", so someone was playing pretty fast and loose with their initialisms, but I digress. The main thing about STEP files is that CAD programs can really easily convert them -into their native internal solid body representation, which allows easy manipulation. +into their native internal solid body representation, which allows easy manipulation. Another thing +about them is that a CAD program can usually turn an STL file into an STP file, unless the mesh is +too complicated and your computer doesn't have enough RAM (*note: foreshadowing*[^chekhovs-ram]). + +![an overly-complicated mesh of a cube][meshy-cube] +*
this cube's mesh has too many vertices and edges, I hope my computer has enough +RAM to work with it
* But so far, I had nothing at all. Time to get some data and see if I can turn it into a model. - # Public data +My first impulse was to search [USGS](https://usgs.gov)'s website for +[heightmap](https://en.wikipedia.org/wiki/Heightmap) data, but I wound up not finding anything +appropriate. Once again, now that I'm looking after I'm done, I found this, which would have been +perfect: +[https://apps.nationalmap.gov/downloader/](https://apps.nationalmap.gov/downloader/) + +Did I just accidentally miss it then? Did I not know how to recognize it because I didn't know what +I was doing *at all*? The world may never know, but at least now you can benefit from my many, many +missteps. ## From space? -## Thanks, California state! +Anyway, having not found anything I could really use from the USGS, I found [this +site](https://portal.opentopography.org/raster?opentopoID=OTSRTM.082015.4326.1), from +OpenTopography, an organization run by the UCSD Supercomputer Center, under a grant from the +National Science Foundation. So, hooray for public data! + +That particular page is for a particular dataset; in this case, "[SRTM +GL1](http://www2.jpl.nasa.gov/srtm/) Global 30m". "SRTM" stands for "[Shuttle Radar Topography +Mission](https://en.wikipedia.org/wiki/Shuttle_Radar_Topography_Mission)", which was a Space Shuttle +mission in February, 2000, where it did a [fancy radar +scan](https://en.wikipedia.org/wiki/Interferometric_synthetic-aperture_radar) of most of the land on +Earth. Though, it's hard to verify that the data was not synthesized with other datasets of more +recent, non-space origin, especially in places like California. But probably space was involved in +some way. ## In Australia, it's pronounced "g'dal" +Anyway, I'd found an open source of public data. This dataset's [horizontal resolution is 1 arc +second](https://gisgeography.com/srtm-shuttle-radar-topography-mission/) (which is why it's +"GL**1**"), or roughly 30x30 meters, and the height data is accurate to within 16 meters. Not too +shabby! + +The only problem was that you could only download data covering up to 450 square kilometers at a +time, so I had had to download three or four separate +[GeoTIFF](https://en.wikipedia.org/wiki/GeoTIFF) files and then mosaic them together. A GeoTIFF file +is basically an image where each pixel represents one data point (so, a 30x30 square meter plot) +centered at a particular location on the Earth's surface. It's a monochrome image, where height is +mapped to brightness, so the lowest spot is `0` (black), and the highest spot is `65535` (brightest +white), since each pixel is a 16-bit integer. + +## Thanks, California state! + +https://data.ca.gov/dataset/ca-geographic-boundaries + ## Give it a good smear # Test prints # Final cut -# Thanks +# Thank yous, lessons learned, and open questions + +--- [main_image]: PXL_20220723_214758454.jpg "A plywood slab carved with CNC into a topographic representation of California" [programmers_creed]: programmers_creed.jpg "jfk overlaid with the programmer's creed: we do these things not because they are easy, but because we thought they were going to be easy" +[meshy-cube]: meshy-cube.png "an overly-complicated mesh of a cube" + [^math-computers]: I'm pretty sure this is more "represent shapes with math" than with a computer, but the computer is just helping us do the math and it's more relatable. + +[^manifold_holes]: I *think* you could also have a 2D sheet with a hole cut out of it represented by a +mesh that is manifold, as long as the connectivity was correct in terms of how many shared edges and +vertices there were (though this would not be a valid STL file). Imagine a +cloth sheet with a hole cut out and the edge of the hole hemmed or otherwise "sealed", which is then +a *manifold boundary*. See [this powerpoint +deck](https://pages.mtu.edu/~shene/COURSES/cs3621/SLIDES/Mesh.pdf) for a pretty math-y overview of +"mesh basics" (but not really that basic, that's just academics trolling us, don't let it bother +you). If I'm wrong about a 2D sheet with a hole being possibly manifold, I invite correction! + +[^chekhovs-ram]: A classic use of Chekhov's Scarce Computational Resource. diff --git a/content/sundries/a-very-digital-artifact/meshy-cube.png b/content/sundries/a-very-digital-artifact/meshy-cube.png new file mode 100644 index 0000000..3e145ff Binary files /dev/null and b/content/sundries/a-very-digital-artifact/meshy-cube.png differ