POV-Ray : Newsgroups : povray.newusers : gyroid structure : Re: gyroid structure Server Time
2 Jul 2024 12:51:34 EDT (-0400)
  Re: gyroid structure  
From: stbenge
Date: 17 Feb 2011 17:56:29
Message: <4d5da79d@news.povray.org>
On 2/17/2011 1:36 PM, stbenge wrote:
> Do a Google search for "v(x,y,z) = sin 2x cos y sin z" and you will get
> a single result linking to a PDF ("EmissaryFall99"). Open the PDF
> document and search for "v(x,y,z) = sin 2x cos y sin z" and it will take
> you directly to an image of a "core-shelled double gyroid." The equation
> is exactly the same as the one you posted. The inner surface of the
> object shown is the same one I got when I used the equation directly in
> an isosurface (you may need to adjust the threshold).

Since it looks like you may be in for some trouble ahead, here's some 
code to get you started. I used the "core-shelled double gyroid" formula 
found in the aforementioned PDF:

// CSD_Gyroid.pov

#version 3.7;

global_settings{assumed_gamma 1.0}

camera{
  orthographic
  location <12,7,-10>
  look_at 0
  scale .165
}

light_source{<.5,1,-.5>*1e8, 1}

background{rgb 1}

#declare CSD_Gyroid =
function{
   sin(2*x)*cos(y)*sin(z)
  +sin(2*y)*cos(z)*sin(x)
  +sin(2*z)*cos(x)*sin(y)
  -0.15*(
    cos(2*x)*cos(2*y)
   +cos(2*y)*cos(2*z)
   +cos(2*x)
  )
}

isosurface{
  function{
   // calling the function and scaling it
   CSD_Gyroid(
    x*2*pi,
    y*2*pi,
    z*2*pi
   )
  }
  open

  // I guessed the threshold
  threshold 0.75
  accuracy 0.001
  max_gradient 13.944
  contained_by{
   box{
    <-0.5,-1.0,-0.5>,
    <0.5,1.0,0.5>
   }
  }
  scale <-1,1,1>
  rotate y*270
  interior_texture{
   pigment{rgb <.2,.3,.5>}
   finish{phong 1}
  }
  texture{
   pigment{rgb 1}
   finish{ambient .5}
  }
}

#include"shapes.inc"

object{
  Wire_Box_Union(
   <-.5,-1,-.5>,
   <.5,1,.5>,
   .01
  )
  pigment{rgb <.1,.2,.5>}
}

// ~CSD_Gyroid.pov

To achieve something like in the image you linked to may require minimal 
surface calculations to be performed on the gyroid function, which could 
slow down the rendering speed significantly. I wouldn't even know where 
to begin :(

Sam


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.