Testwiki:Reference desk/Archives/Mathematics/2020 December 6

From testwiki
Revision as of 01:07, 14 December 2020 by imported>Scsbot (edited by robot: archiving December 6)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Template:Error:not substituted

{| width = "100%"

|- ! colspan="3" align="center" | Mathematics desk |- ! width="20%" align="left" | < December 5 ! width="25%" align="center"|<< Nov | December | Jan >> ! width="20%" align="right" |Current desk > |}

Welcome to the Wikipedia Mathematics Reference Desk Archives
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


December 6

Breaking down a gyroid into layers

I'm trying to figure out how a gyroid surface, expressed as

sinxcosy+sinycosz+sinzcosx=0

can be sliced horizontally.

This is a solved problem, as illustrated by the figures below. The first image shows a cross section of a cube generated by a 3D printing slicer to fill a cube with a gyroid infill, clearly showing that the slicer software figured out how to break the surface down into horizontal layers. The second image shows an animation of a gyroid surface being built up vertically in steps. The third is a unit cell, which would be ideal if I could figure out how to create it with some thickness, but I thought maybe the slicing approach would be simpler. I could be wrong though.

My goal here is to see if I can create a model of a gyroid surface in OpenSCAD, which I can then use as I please as a component of a 3D object rather than structural infill. I don't know yet if that is even feasible, but if I can generate coordinates of triangular facets, I can create any object.

The equation is simple enough. To generate a layer, I just fix the z height to some value, and generate y values as a function of x. Using Wolfram Alpha to solve the equation above for y, I get:

y=2πn+2tan1(cosz±sin2x+cos2zcos2xsin2zsinxcosxsinz)

The problem is, when I try to plot this, I get curves with discontinuities that look sort of like a gyroid cross section in a piecewise fashion, but clearly aren't the same.

I've been searching for days and have not found any algorithm for generating vertices or facets or cross sections of a gyroid. And in spite of the seeming simplicity of the equation I am feeling somewhat stumped. How should I approach this? ~Anachronist (talk) 02:46, 6 December 2020 (UTC)

I have not looked into your solution, but here is how I'd solve the gyroid equation for y.
First, determine ρ0 and α (modulo 2π) such that ρcosα=cosz and ρsinα=sinx. This can be done by taking
ρ=cos2z+sin2x and
α=atan2(sinx,cosz).
Then the equation can be rewritten as
ρsin(y+α)+sinzcosx=0.
From this equation you can see a numerical problem arising when ρ=0 (or very close to it). The values of ρ and sinzcosx cannot simultaneously be zero, however; otherwise, all values for y would solve the equation. But assume |sinzcosx|<ε2. Then min(|sinz|,|cosx|)<ε, so
ρmax(|cosz|,|sinx|)=max(1sin2z,1cos2x)=1min(|sinz|,|cosx|)2>1ε2.
The solution set for y is empty whenever ρ<|sinzcosx|, and the inequation implies that not attempting to solve such cases also will avoid dividing by values of ρ that are (close to) zero.
Put η=arcsin(ρ1sinzcosx). Then the solutions for y are given by:
y=ηα+2πn, y=πηα+2πn.
Taking the Minkowski sum of the set of triples (x,y,z) + a small ball will give this some thickness. Caveat lector: I have not tested this.  --Lambiam 13:12, 6 December 2020 (UTC)