# Transform between a cube’s surface and a square

I plan to add this transformation to my upcoming book on computational geometry. This mapping was originally conceived to provide a one-to-one correspondence between RGB color and locations on a dance floor for a positioning correction in a project on robotic square dancers, but then we realized that simply laying down QR codes with coordinate and orientation data would be far more accurate.

So what might be a good application for this transformation? It essentially maps the surface of the RGB cube (i.e., all fully saturated colors) to a square. One possibility would be to extend color plots that are conventionally used to depict one one variable to instead show two variables. In mechanics, for example, engineers typically show two different color plots for pressure and temperature, each with its own a linear legend bar ranging from a logical coordinate eta from 0 to 1, which is mapped to a selected linear color scheme (such as “hue” to range over the rainbow). In the single-variable color plots, the value of eta is set in proportion to the variable being plotted. To avoid needing two separate color plots for pressure and temperature a square color legend could be used with coordinates (eta1, eta2) associated with the two variables. While a “poor man’s” color plot mapping could be RGB[0,eta1,eta2], the one shown here would be far more spectacular because it would represent the full range of fully saturated colors (without “muddy” colors in the interior of the RGB cube) and, furthermore, values outside the range of interest would show as black.

# Tutorial: multi-linear regression

The straight line is the linear regression of a function that takes scalars (x-values) as input and returns scalars (y-values) as output. (figure from GANFYD)

You’ve probably seen classical equations for linear regression, which is a procedure that finds the straight line that best fits a set of discrete points $\{(x_1,y_1), (x_2,y_2),...,(x_N,y_N)\}$. You might also be aware that similar formulas exist to find a straight line that is a best (least squares) fit to a continuous function $y(x)$.

The pink parallelogram is the multi-linear regression of a function that takes vectors (gray dots) as input and returns vectors (blue dots) as output

The bottom of this post provides a link to a tutorial on how to generalize the concept of linear regression to fit a function $\vec{y}(\vec{x})$ that takes a vector $\vec{x}$ as input and produces a vector $\vec{y}$ as output. In mechanics, the most common example of this type of function is a mapping function that describes material deformation: the input vector is the initial location of a point on a body, and the output vector is the deformed location of the same point. The image shows a collection of input vectors (initial positions, as grey dots) and a collection of output vectors (deformed locations as blue dots). The affine fit to these descrete data is the pink parallelogram. Continue reading

# Tutorial: Slideshow introduction to mappings in continuum mechanics

Each time you generate output from input, you are using a mapping. The mappings in continuum mechanics have similarities with simple functions y=f(x) that you already know. This slideshow (which apparently renders properly only when viewed from PowerPoint on a PC rather than Mac) provides a step-by-step introduction to mappings of the type used in Continuum Mechanics.