![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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] faricy net> 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](/povray.binaries.images/attachment/%3C39EE63B6.7B6F87BD%40faricy.net%3E/mengeriso.gif?ttop=443840&toff=11750&preview=1)
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
% 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] faricy net> ICQ 55354965
My raytracing gallery: http://davidf.faricy.net/
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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] gmx de>
Homepage: http://www.schunter.etc.tu-bs.de/~chris/
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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] faricy net> ICQ 55354965
My raytracing gallery: http://davidf.faricy.net/
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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] faricy net> ICQ 55354965
My raytracing gallery: http://davidf.faricy.net/
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
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] faricy net> ICQ 55354965
My raytracing gallery: http://davidf.faricy.net/
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |