POV-Ray : Newsgroups : povray.newusers : shape generation (functions and more) : Re: shape generation (functions and more) Server Time
30 Jul 2024 14:26:03 EDT (-0400)
  Re: shape generation (functions and more)  
From: Hughes, B 
Date: 16 Feb 2004 20:21:16
Message: <40316c8c$1@news.povray.org>
"lars petter" <lar### [at] higno> wrote in message
news:4030e7fc$1@news.povray.org...
> I'll try again.. (sorry for any inclarities, i dont exactly know what i'm
> asking for :) )

I've seen your original message post at the programming group.

> The view in the tool will be in the x,y plane, viewed from top.. in the
> "drawing board" they will place differented shapes suchs as bezier curves,
> parabolas, circles (closed, open), ellipes (closed, open), and so on.
these
> shapes will have user-specific properties regarding to absorption,
> diffusion, width, and color. After placing a light source, we want to
render
> the scene in povray. The main point is to illustrate the caustics
generated
> by the system of mirrors in the scene..

So you'll be using photons, no doubt.

> Anyway, we've looked at the documentation, and tested a little "coding",
and
> concluded with that we probably should use the prism object to generate
the
> pov-ray figures, at least the bezier shapes.

You could be right about that. Not real sure myself.

> We've also looked at the various internal/math/whatever-functions in the
> .inc files, but we really cant understand how we actually use these to get
> shapes into the scene.. i'm looking at:
> Quartic_Paraboloid
> Quartic parabola - a 4th degree polynomial (has two bumps at the bottom)
> that has been swept around the z axis. The equation is:
> 0.1 x^4 - x^2 - y^2 - z^2 + 0.9 = 0
>
> how do i use this?
>
> all in all, we do have the mathematical parametres from the 2d-plane, and
> what we're looking for is some easy way to apply these to generate the 3d
> figures..

Isosurfaces seem the most plausible thing to me, since you'll be working
with equations anyhow. I've taken the example for f_quartic_paraboloid()
from the scenes\incdemo\i_internal.inc to make:

camera {
  location  <0.0, 0.0, -5.0>
  look_at   <0.0, 0.0, 0.0>
}

sky_sphere {
  pigment {
    gradient y
    color_map {
      [0 rgb <0.9,0.9,0.9>]
      [1 rgb <0.3,0.3,0.3>]
    }
  }
}

light_source {
 -100*z,
 color rgb <1, 1, 1>
  rotate <15, 15, 0>
}

// ----------------------------------------

#include "functions.inc"

#declare IsoQP=
isosurface {
 function  {
  // f_quartic_paraboloid(x,y,z, -0.01)
  0-(0.5*x*x*x*x-x*x-y*y-z*z+0.5)
 }
 // contained_by {box { <-1.45, -0.1, -1.45>, <1.45, 2.5, 1.45> }}
 max_gradient 2.5
 all_intersections
}

difference {
object { // outside
    IsoQP
    material {
     texture {
      pigment {color rgb 0.75}
      finish {reflection {0.3,0.9}}
     }
    }
}
object { // inside
    IsoQP
    scale <0.95,0.95,0.95>
    translate y/6
    material {
     texture {
      pigment {color rgb 0.25}
      finish {reflection {0.1,0.3}}
     }
    }
}
// rotate -90*x // turn to look into parabloid
}

Maybe you can figure something out from this and by reading up on isosurface
functions. I'm not very good at the math, and you should be warned that the
carat (^) sign is not used in POV-Ray. If you'll be needing semitransparent
materials, the above texturing won't suffice to blend from one side to the
other.

Bob H.


Post a reply to this message

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