POV-Ray : Newsgroups : povray.newusers : Possible to convert the Code for the Predefined Shapes into Isosurface Code= Server Time
29 Jul 2024 20:15:27 EDT (-0400)
  Possible to convert the Code for the Predefined Shapes into Isosurface Code= (Message 1 to 2 of 2)  
From: mephuser
Subject: Possible to convert the Code for the Predefined Shapes into Isosurface Code=
Date: 21 Jan 2005 11:20:00
Message: <web.41f12b1091a930b03d54f5180@news.povray.org>
Is it possible to convert the Code for the Predefined Shapes into Isosurface
Code?

Any external programs that can do this?

How do I write Isosurface Code for all the Predefined Shapes such as Torus,
Sphere, Cube, Rounded cube, cylinder and etc?

For example, I want to convert the code for the Predefined Shape Prism, How
do I so?

// extrude a closed 2-D shape along an axis
prism {
  linear_sweep  // or conic_sweep for tapering to a point
  linear_spline // linear_spline | quadratic_spline | cubic_spline |
bezier_spline
  -0.5,         // height 1
   0.5,         // height 2
  10,           // number of points
  // (--- the <u,v> points ---)
  < 0.2, -1.0>, < 0.2,  0.2>, < 1.0, -0.2>, < 1.0,  0.2>, < 0.2,  1.0>,
  <-0.2,  1.0>, <-1.0,  0.2>, <-1.0, -0.2>, <-0.2,  0.2>, <-0.2, -1.0>
  // , <0.2,   0.2> // match 2nd point, if quadratic_spline add this
  // , <0.2,  -1.0> // match 1st point, if cubic_spline add this as well as
the other
  // [open]
  // [sturm]
}


What parameters do I change to match the above code?

// create a isosurface object - the equipotential surface
// of a 3D math function f(x, y, z)
#declare fn_X = function(x,y,z) { x*x + y*y - 1 }  // cylinder function
isosurface {
  function { x*x + y*y - 1 }          // function (can also contain declared
functions
  //function { fn_X(x, y, z) }        // alternative declared function
  contained_by { box { -1.2, 1.2 } }  // container shape
  //threshold 0.0                     // optional threshold value for
isosurface [0.0]
  accuracy 0.001                      // accuracy of calculation [0.001]
  max_gradient 4                      // maximum gradient the function can
have [1.1]
  //evaluate 5, 1.2, 0.95             // evaluate the maximum gradient
  //max_trace 1                       // maybe increase for use in CSG [1]
  //all_intersections                 // alternative to 'max_trace'
  //open                              // remove visible container surface
}


Post a reply to this message

From: Mike Williams
Subject: Re: Possible to convert the Code for the Predefined Shapes into Isosurface Code=
Date: 21 Jan 2005 12:58:05
Message: <ID9RPGA5IU8BFwev@econym.demon.co.uk>
Wasn't it mephuser who wrote:
>Is it possible to convert the Code for the Predefined Shapes into Isosurface
>Code?
>
>Any external programs that can do this?
>
>How do I write Isosurface Code for all the Predefined Shapes such as Torus,
>Sphere, Cube, Rounded cube, cylinder and etc?

There's no general solution. For some shapes there are builtin
functions, like f_sphere(), f_torus(), f_rounded_box(). Some other
shapes have simple formulae, like

#declare Cube=functionfunction { max((y*y-1),(x*x-1),(z*z-1)) }

#declare Cylinder=function { y*y + z*z - R*R }

Prisms and lathes can be achieved with the technique described here:
<http://www.econym.demon.co.uk/isotut/splines.htm#bent>

Check also the alphabetical index of the Isosurface tutorial:
<http://www.econym.demon.co.uk/isotut/xref.htm>

For many shapes there's also the IsoCSG library.

Some shapes, like meshes, are virtually impossible.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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