POV-Ray : Newsgroups : povray.binaries.images : Isosurface help please Server Time
19 Aug 2024 18:31:35 EDT (-0400)
  Isosurface help please (Message 1 to 9 of 9)  
From: David Fontaine
Subject: Isosurface help please
Date: 18 Oct 2000 23:11:32
Message: <39EE63B6.7B6F87BD@faricy.net>
In order to make a Menger-sponge isosurface i want a function that will
give me a triangular wave.
I tried using floor, but I get a plane at x=0 where it should be empty
space. Is this a bug? What would be a better way to get a triangle wave?

isosurface {
   function {
      abs(x/6+3-floor(x/6+3)-.5)-2/6
   }
   contained_by { box { -3,3 } }
   pigment { color rgb x }
}

--
David Fontaine  <dav### [at] faricynet>  ICQ 55354965
My raytracing gallery:  http://davidf.faricy.net/


Post a reply to this message


Attachments:
Download 'mengeriso.gif' (5 KB)

Preview of image 'mengeriso.gif'
mengeriso.gif


 

From: David Fontaine
Subject: Re: Isosurface help please
Date: 19 Oct 2000 00:07:22
Message: <39EE70CB.4AE7FD6F@faricy.net>
% seems to do what I need

man, this renders slow!!

how come, when i put
   isosurface { function { ... } }
it seems to ignore max_grad, accuracy or eval, but if i put
   #declare foo = function { ... }
   isosurface { function { foo(x,y,z) } }
it doesn't?

--
David Fontaine  <dav### [at] faricynet>  ICQ 55354965
My raytracing gallery:  http://davidf.faricy.net/


Post a reply to this message

From: Christoph Hormann
Subject: Re: Isosurface help please
Date: 19 Oct 2000 09:54:05
Message: <39EEFCFE.47E078D1@schunter.etc.tu-bs.de>
David Fontaine wrote:
> 
> % seems to do what I need
> 
> man, this renders slow!!
> 
> how come, when i put
>    isosurface { function { ... } }
> it seems to ignore max_grad, accuracy or eval, but if i put
>    #declare foo = function { ... }
>    isosurface { function { foo(x,y,z) } }
> it doesn't?
> 

the default method (1/2) depends on the use of declared functions.  If you want
to use the other method, you have to specify it manually (see megapov docu).

Christoph

-- 
Christoph Hormann <chr### [at] gmxde>
Homepage: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

From: Mike Williams
Subject: Re: Isosurface help please
Date: 20 Oct 2000 14:00:21
Message: <80wEwBA2wG85EwZv@econym.demon.co.uk>
Wasn't it David Fontaine who wrote:
>In order to make a Menger-sponge isosurface i want a function that will
>give me a triangular wave.
>I tried using floor, but I get a plane at x=0 where it should be empty
>space. Is this a bug? What would be a better way to get a triangle wave?
>
>isosurface {
>   function {
>      abs(x/6+3-floor(x/6+3)-.5)-2/6
>   }
>   contained_by { box { -3,3 } }
>   pigment { color rgb x }
>}

I can't imagine why you might possibly think that might lead to a
triangle wave. Any function that only involves x can only ever produce
results that are made up of x planes.

Let's try so solve this equation

    abs(x/6+3-floor(x/6+3)-.5)-2/6 = 0

The first thing we notice is that 3-floor(3) is always zero, so we can
get rid of the "+3"s.

    abs(x/6-floor(x/6)-.5)-2/6 = 0

Now, since x goes from -3 to +3 (due to the contained_by box) we can see
that x/6 goes from -0.5 to +0.5, and floor(x/6) can only be 0 or -1.

When x>0, floor(x/6) is zero, the equation reduces to

    abs(x/6-.5)-2/6 = 0

which has solutions at x=1 and x=5. The x=5 solution is outside the
contained_by box.

When x<0, floor(x/6) is -1, the equation reduces to

    abs(x/6+.5)-2/6 = 0

which has solutions at x=-1 and x=-5. The x=-5 solution is outside the
contained_by box.

So what you see is the two planes x=1 and x=-1.



If you want a sawtooth wave, try starting with something like 

   function { y - x + floor(x) }

If you want a symmetrical triangle wave, try starting with 

   function { y - abs(x-floor(x)-0.5) }


-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: David Fontaine
Subject: Re: Isosurface help please
Date: 20 Oct 2000 15:57:12
Message: <39F0A0F2.38E18E72@faricy.net>
Mike Williams wrote:

> Let's try so solve this equation
>
>     abs(x/6+3-floor(x/6+3)-.5)-2/6 = 0

[snip]
Sorry, I wanted a triangle wave if said equation equals y, not if it is less
than or equal to zero. That way, by making it less than or equal to zero I
get a regular pattern of solid space and empty space. That equation should
give me what I want, but I was wondering why there was a plane at x=0:

x-floor(x):

      y
 / / /| / / /
/ / / |/ / /
-------------x

dividing by 6 increases the wavelength, adding 3 translates it, subtracting
the .5 makes half of it go below the x-axis, and taking the absolute value
inverts the lower portion to form the parts with negative slope:

     y
/\/\/|\/\/\
-----------x

So I'm thinking perhaps it is a bug.

Anyway, I got what I wanted using modulo so it doesn't matter.

--
David Fontaine  <dav### [at] faricynet>  ICQ 55354965
My raytracing gallery:  http://davidf.faricy.net/


Post a reply to this message

From: Mike Williams
Subject: Re: Isosurface help please
Date: 21 Oct 2000 02:06:23
Message: <OhXYFEAqDT85Ewvz@econym.demon.co.uk>
Wasn't it David Fontaine who wrote:
>Mike Williams wrote:
>
>> Let's try so solve this equation
>>
>>     abs(x/6+3-floor(x/6+3)-.5)-2/6 = 0
>
>[snip]
>Sorry, I wanted a triangle wave if said equation equals y, not if it is less
>than or equal to zero. That way, by making it less than or equal to zero I
>get a regular pattern of solid space and empty space. That equation should
>give me what I want, but I was wondering why there was a plane at x=0:
>
>x-floor(x):
>
>      y
> / / /| / / /
>/ / / |/ / /
>-------------x
>
>dividing by 6 increases the wavelength, adding 3 translates it, subtracting
>the .5 makes half of it go below the x-axis, and taking the absolute value
>inverts the lower portion to form the parts with negative slope:
>
>     y
>/\/\/|\/\/\
>-----------x
>
>So I'm thinking perhaps it is a bug.
>
>Anyway, I got what I wanted using modulo so it doesn't matter.

So, you meant to type

isosurface {
   function {
    y - (abs(x/6+3-floor(x/6+3)-.5)-2/6)
   }
   contained_by { box { -3,3 } }
   pigment { color rgb x }
}

But this doesn't have a plane at x=0.

Although you added +3, you also subtracted floor(3), so these cancel
out, so it doesn't get translated.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: David Fontaine
Subject: Re: Isosurface help please
Date: 21 Oct 2000 02:29:59
Message: <39F1352E.8787BB2A@faricy.net>
Mike Williams wrote:

> So, you meant to type
>
> isosurface {
>    function {
>     y - (abs(x/6+3-floor(x/6+3)-.5)-2/6)
>    }
>    contained_by { box { -3,3 } }
>    pigment { color rgb x }
> }

No, I meant no y. I want the equation to return a value consistent with a
sawtooth wave as x changes. The way I want to use this function is to create
alternating solid and empty spaces.

> But this doesn't have a plane at x=0.

It does when the y is removed.

> Although you added +3, you also subtracted floor(3), so these cancel
> out, so it doesn't get translated.

Hmm, you're right, would be +(0..1) regardless of wavelength... but I checked and
the waveform was still what I was looking for.

--
David Fontaine  <dav### [at] faricynet>  ICQ 55354965
My raytracing gallery:  http://davidf.faricy.net/


Post a reply to this message

From: Mike Williams
Subject: Re: Isosurface help please
Date: 21 Oct 2000 02:50:21
Message: <hRqTZHAdsT85EwIv@econym.demon.co.uk>
Wasn't it David Fontaine who wrote:
>Mike Williams wrote:
>
>> So, you meant to type
>>
>> isosurface {
>>    function {
>>     y - (abs(x/6+3-floor(x/6+3)-.5)-2/6)
>>    }
>>    contained_by { box { -3,3 } }
>>    pigment { color rgb x }
>> }
>
>No, I meant no y. I want the equation to return a value consistent with a
>sawtooth wave as x changes. The way I want to use this function is to create
>alternating solid and empty spaces.

If you remove the y, then your surface will always be only a series of x
planes. Typing

 function { abs(x/6+3-floor(x/6+3)-.5)-2/6}

Gives you the surface described by

 abs(x/6+3-floor(x/6+3)-.5)-2/6 = 0

If you want the surface

 abs(x/6+3-floor(x/6+3)-.5)-2/6 = y

You have to move the y to the left hand side of the equation before
turning it into a function.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: David Fontaine
Subject: Re: Isosurface help please
Date: 21 Oct 2000 16:20:04
Message: <39F1F7C7.CA359E86@faricy.net>
Mike Williams wrote:

> If you remove the y, then your surface will always be only a series of x
> planes. Typing [snip]

But that's what I want. I'm saying I want f(x) to be a sawtooth wave, not the
surface itself. (Actually, all values below zero would be considered inside the
object too.) Problem was I got an *extra* plane; see the original picture.


--
David Fontaine  <dav### [at] faricynet>  ICQ 55354965
My raytracing gallery:  http://davidf.faricy.net/


Post a reply to this message

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