Povray for Optimization Demo

I am always pleasantly surprised of what the open Povray program can do for you. For my script about linear optimization I needed a cylinder to demonstrate a case where the simplex algorithm does not make progress, but has not reached the optimum.

I am not going into the math of the optimization here. I just want to tell how this can be done with a little programming. I add the warning that I am not an expert at all for open Povray.

So here is the code.

#include "colors.inc"
#include "stones.inc"

camera
{
  location <-5, 2, -5>
  look_at <0, 0, 0>
  angle 50 // opening angle of the lens
}

global_settings
{
  ambient_light White
  assumed_gamma 1.4
}

background
{
  color White
}

light_source
{
  <-2, 4, -3>
  White
}

mesh
{
  triangle { <0,1,1>, <1,0,0>, <1,2,0> }
  triangle { <0,1,1>, <1,2,0>, <1,2,2> }
  triangle { <0,1,1>, <1,2,2>, <1,0,2> }
  triangle { <0,1,1>, <1,0,2>, <1,0,0> }

  triangle { <1,2,0>, <1,0,2>, <1,2,2> }
  triangle { <1,2,0>, <1,0,2>, <1,0,0> }

  texture {
    pigment { color rgb <0.8,0.5,0.5> }
  }
  finish {
    ambient 0.5
  }
}

#declare axis = union
{
  cylinder
  {
    <-2,0,0>,<2,0,0>,0.02
  }
  cone
  {
    <2.12,0,0>,0
    <2,0,0,>,0.08
  }
}

union
{
  object
  {
    axis
  }
  object
  {
    axis
    rotate -90*y
  }
  object
  {
    axis
    rotate 90*z
  }
  texture {
  pigment { color Gray }
  }
}

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.