POV-Ray : Newsgroups : povray.unofficial.patches : Isosurfaces and CSG intersection problem. Server Time
2 Nov 2024 09:17:57 EDT (-0400)
  Isosurfaces and CSG intersection problem. (Message 1 to 7 of 7)  
From: Bouf
Subject: Isosurfaces and CSG intersection problem.
Date: 19 Jan 2000 03:50:30
Message: <38857DB2.8EEABD12@nanterre.marelli.fr>
Please help !!!

I can't get this working:
the intersection between an isosurface (a sphere for testing purposes)
and a union of complex CSG. The only result I can get is the
intersection of the surfaces, not the solid objects...

I use this code:

camera {
	location <-8,6, -10>
	right x*4/3
	up y
	angle 40
	look_at <0, 1, 1.5>
}


light_source { <40, 30, -10> color rgb .9 }
light_source { <-40, 20, 10> color rgb .2 }


#declare T_Text = texture {
	pigment { color rgb <255, 0, 0>/255 }
	finish { ambient .4 diffuse .6 }
}


#macro Rounded_Tower(MajRayon1, MajRayon2, MinRayon2, Taille)

union {
	cylinder { <0,Taille - MajRayon2 -.1,0>, <0,Taille,0>, MajRayon2 }
	torus { MajRayon2, MinRayon2 translate y*(Taille - MinRayon2) }
	cone { <0,0,0>, MajRayon1, <0,Taille - MinRayon2,0>,
MajRayon2+MinRayon2 }
	texture { T_Text }
}

#end


#macro Rounded_Wall(Longueur, Largeur, Angle, Rayon, Taille)

union {
	box { <0, -Taille/cos(radians(Angle)), -Rayon>, <Longueur, 0,
Largeur*.5>
		rotate Angle*x
		translate <0, Taille-Rayon, -Largeur*.5+Rayon>
	}
	box { <0, -Taille/cos(radians(Angle)), -Largeur*.5>, <Longueur, 0,
Rayon>
		rotate -Angle*x
		translate <0, Taille-Rayon, Largeur*.5-Rayon>
	}
	cylinder { <0, 0, 0>,  <Longueur, 0, 0>, Rayon
		translate <0, Taille-Rayon, -Largeur*.5+Rayon>
	}
	cylinder { <0, 0, 0>,  <Longueur, 0, 0>, Rayon
		translate <0, Taille-Rayon, Largeur*.5-Rayon>
	}
	box { <0, 0, -(Largeur*.5-Rayon)>, <Longueur, Taille,
(Largeur*.5-Rayon)> }
	texture { T_Text }
}

#end


intersection {
/*	sphere { 0, 1
		scale <6, 3, 3>
		translate <-2,0,2>
		texture { T_Text }
	}*/
	isosurface {
		function { sqrt(x*x+y*y+z*z) -1 }
		threshold 0
		bounded_by { sphere { 0, 1.2 } }
		max_trace 10
		scale <6, 3, 3>
		translate <-2,0,2>
		texture { T_Text }
	}
	union {
		object {
			Rounded_Tower(1.2, .8, .1, 2)
			translate -3*x
		}
		object {
			Rounded_Tower(1.2, .8, .1, 2)
			translate 3*x
		}
		object {
			Rounded_Wall(6, 1.2, 15, .2, 1.5)
			translate -3*x
		}
	}
}



If you replace the sphere isosurface by a sphere primitive, you obtain
the good results....

What I'm doing wrong ????
I can't get an explanation, help please ....

Bouf.


Post a reply to this message

From: Bouf
Subject: Re: Isosurfaces and CSG intersection problem.
Date: 19 Jan 2000 04:01:22
Message: <3885803E.E5DC1DD0@nanterre.marelli.fr>
Ooops !!!
I forgot to mention that I'm using MegaPov 0.3

Bouf.


Post a reply to this message

From: omniVERSE
Subject: Re: Isosurfaces and CSG intersection problem.
Date: 19 Jan 2000 05:47:22
Message: <3885963a@news.povray.org>
I just tried it out by defining some numbers for your macro and all and it seems
to be the bounding sphere you used.  Try increasing the radius to 5 instead of
1.2 and see if it's changed for the better or not.  I first went through
everything else I could think to try and that was the last thing.

Bob


Post a reply to this message

From: Thomas Willhalm
Subject: Re: Isosurfaces and CSG intersection problem.
Date: 19 Jan 2000 06:45:53
Message: <qqmembep9n3.fsf@ramsen.fmi.uni-konstanz.de>
Bouf <Chr### [at] nanterremarellifr> writes:

> Please help !!!
> 
> I can't get this working:
> the intersection between an isosurface (a sphere for testing purposes)
> and a union of complex CSG. The only result I can get is the
> intersection of the surfaces, not the solid objects...
> 
> I use this code:
[...]

It seems like there is a problem with scaling isosurfaces. Your scene
produces the same result with a sphere and a isosurface, if you modify
the isosurface like this:

	isosurface {
		function { sqrt(x*x/36+y*y/9+z*z/9) -1 }
		threshold 0
		bounded_by { sphere { 0, 6.1 } }
		max_trace 10
		translate <-2,0,2>
		texture { T_Text }
	}

Maybe, I'll have a look at the source code later. For now, this work
around should work for you.

Thomas

-- 
http://thomas.willhalm.de/ (includes pgp key)


Post a reply to this message

From: Bouf
Subject: Re: Isosurfaces and CSG intersection problem.
Date: 19 Jan 2000 06:58:15
Message: <3885A9B4.E3716353@nanterre.marelli.fr>
omniVERSE wrote:
> 
> I just tried it out by defining some numbers for your macro and all and it seems
> to be the bounding sphere you used.  Try increasing the radius to 5 instead of
> 1.2 and see if it's changed for the better or not.  I first went through
> everything else I could think to try and that was the last thing.
> 
> Bob

It works !!! Thanks a lot.
But I still not understand why...
Sounds like a bug, isn't it ????

Bouf.


Post a reply to this message

From: Bouf
Subject: Re: Isosurfaces and CSG intersection problem.
Date: 19 Jan 2000 07:05:34
Message: <3885AB6B.B9C5B5EA@nanterre.marelli.fr>
Thomas Willhalm wrote:
> 
> It seems like there is a problem with scaling isosurfaces. Your scene
> produces the same result with a sphere and a isosurface, if you modify
> the isosurface like this:
> 
>         isosurface {
>                 function { sqrt(x*x/36+y*y/9+z*z/9) -1 }
>                 threshold 0
>                 bounded_by { sphere { 0, 6.1 } }
>                 max_trace 10
>                 translate <-2,0,2>
>                 texture { T_Text }
>         }

Thanks. It works fine (but the rendering is longer...)
I've already used scaled isosurfaces, it worked well, but they were not
involved in CSG...
Look at OMNIVERSE's solution. It works as well (and that's strange...).
Maybe it will help you to find the bug (if you want to).


Bouf.


Post a reply to this message

From: Thomas Willhalm
Subject: Re: Isosurfaces and CSG intersection problem.
Date: 19 Jan 2000 07:47:55
Message: <qqmaem2p6ro.fsf@ramsen.fmi.uni-konstanz.de>
Bouf <Chr### [at] nanterremarellifr> writes:

> Thanks. It works fine (but the rendering is longer...)
> I've already used scaled isosurfaces, it worked well, but they were not
> involved in CSG...
> Look at OMNIVERSE's solution. It works as well (and that's strange...).
> Maybe it will help you to find the bug (if you want to).

Omniverse is right. The problem is the handling of the bounded_by
statement. (I have modified it in my "work around", too.) However, 
I don't know this part of the source code, so it's up to someeone 
else to fix this "feature".

Thomas

-- 
http://thomas.willhalm.de/ (includes pgp key)


Post a reply to this message

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