POV-Ray : Newsgroups : povray.general : CSG vs. Shape Modifiers Server Time
8 Aug 2024 10:25:08 EDT (-0400)
  CSG vs. Shape Modifiers (Message 1 to 8 of 8)  
From: Eitan Tal
Subject: CSG vs. Shape Modifiers
Date: 20 Jan 2001 13:04:06
Message: <3A69D2E5.A86C52F3@netvision.net.il>
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Take a look at this:
<p><font size=-2>#version 3</font><font size=-2></font>
<p><font size=-2>//#include "colors.inc"</font><font size=-2></font>
<p><font size=-2>global_settings</font>
<br><font size=-2>{</font>
<br><font size=-2>  assumed_gamma 1.0</font>
<br><font size=-2>}</font><font size=-2></font>
<p><font size=-2>// ----------------------------------------</font>
<br><font size=-2>camera</font>
<br><font size=-2>{</font>
<br><font size=-2>  location  <0.0, 0.5, -2.0></font>
<br><font size=-2>  direction 1.5*z</font>
<br><font size=-2>  right     4/3*x</font>
<br><font size=-2>  look_at   <0.0, 0.5,  0.0></font>
<br><font size=-2>}</font><font size=-2></font>
<p><font size=-2>sky_sphere</font>
<br><font size=-2>{</font>
<br><font size=-2>  pigment</font>
<br><font size=-2>  {</font>
<br><font size=-2>    gradient y</font>
<br><font size=-2>    color_map { [0.0 color blue 0.6] [1.0
color rgb 1] }</font>
<br><font size=-2>  }</font>
<br><font size=-2>}</font><font size=-2></font>
<p><font size=-2>light_source</font>
<br><font size=-2>{</font>
<br><font size=-2>  0*x // light's position (translated below)</font>
<br><font size=-2>  color red 1.0  green 1.0  blue 1.0 
// light's color</font>
<br><font size=-2>  translate <-30, 30, -30></font>
<br><font size=-2>}</font>
<br><font size=-2>//Parameters for the RawMaterial (fungus)</font>
<br><font size=-2>#declare toph = 4</font>
<br><font size=-2>#declare w1 = 12</font>
<br><font size=-2>#declare h1 = 22</font>
<br><font size=-2>#declare w2 = 21</font>
<br><font size=-2>#declare CheckPoint = 11</font>
<br><font size=-2>#declare h2 = (w2 * CheckPoint) / w1</font>
<br><font size=-2>#declare CenterX = 10.5</font>
<br><font size=-2>#declare CenterY = 17</font>
<br><font size=-2>#declare r = 3</font>
<br><font size=-2>#declare r1 = 2.16</font><font size=-2></font>
<p><font size=-2>//Parameters for the Room</font>
<br><font size=-2>#declare WallThickness = 1</font>
<br><font size=-2>#declare Size = 10</font><font size=-2></font>
<p><font size=-2>#declare RawMaterial =</font>
<br><font size=-2>merge {</font>
<br><font size=-2>  box</font>
<br><font size=-2>  {</font>
<br><font size=-2>    <(w2-w1)/2,0,0>  // one corner
position <X1 Y1 Z1></font>
<br><font size=-2>    <(w2+w1)/2,h1,1>  // other
corner position <X2 Y2 Z2></font>
<br><font size=-2>  }</font>
<br><font size=-2>  cylinder</font>
<br><font size=-2>  {</font>
<br><font size=-2>    0*z, 1*z, 0.43</font>
<br><font size=-2>    scale <w2,h2,1></font>
<br><font size=-2>    translate <CenterX, CenterY,0></font>
<br><b><font size=-2>   <font color="#FF0000">bounded_by {box
{<-1,CheckPoint,-1>,<w2+1,CenterY,2>}}</font></font></b>
<br><font size=-2> }</font>
<br><font size=-2>  cylinder</font>
<br><font size=-2>  {</font>
<br><font size=-2>    0*z, 1*z, 0.43</font>
<br><font size=-2>    scale <w2,h2-3.5,1></font>
<br><font size=-2>    translate <CenterX, CenterY,0></font>
<br><font size=-2>    <b><font color="#FF0000">bounded_by
{box {<-1,CenterY,-1>,<w2+1,h1,2>}}</font></b></font>
<br><font size=-2>  }</font>
<br><font size=-2>  difference</font>
<br><font size=-2>  {</font>
<br><font size=-2>    box {</font>
<br><font size=-2>      <(w2-w1)/2,h1,0>,</font>
<br><font size=-2>      <(w1+w2)/2,h1+toph,1></font>
<br><font size=-2>    }</font>
<br><font size=-2>    cylinder {-1*z, 2*z, r</font>
<br><font size=-2>      scale <w2/2, toph,
1></font>
<br><font size=-2>      translate
<((w2-w1)/2)-(r1*w2/2),h1+(r1*toph),0></font>
<br><font size=-2>    }</font>
<br><font size=-2>    cylinder {-1*z, 2*z, r</font>
<br><font size=-2>      scale <w2/2, toph,
1></font>
<br><font size=-2>      translate
<((w2+w1)/2)+(r1*w2/2),h1+(r1*toph),0></font>
<br><font size=-2>    }</font>
<br><font size=-2>  }</font>
<br><font size=-2>}</font>
<br><font size=-2>#declare Room =</font>
<br><font size=-2>difference {</font>
<br><font size=-2>  box {</font>
<br><font size=-2>    <-Size,-Size,-Size>,</font>
<br><font size=-2>    <Size,Size,Size></font>
<br><font size=-2>  }</font><font size=-2></font>
<p><font size=-2>{</font>
<br><font size=-2>  <0,0,0>,<50,50,50></font>
<br><font size=-2>  bounded_by {</font>
<br><font size=-2>    box{<-100,-100,0>,<20,30,50>}</font>
<br><font size=-2>  }</font>
<br><font size=-2>}</font><font size=-2></font>
<p><font color="#3333FF"><font size=-2>difference {</font></font>
<br><font color="#3333FF"><font size=-2>  object {Room pigment{color
rgb <1,1,1>}}</font></font>
<br><b><font color="#3333FF">  object {RawMaterial scale <0.5,0.5,2>
translate <-4.5,-4.5,-11> pigment {color rgb 1}}</font></b>
<br><font color="#3333FF"><font size=-2>  translate <0,0,50></font></font>
<br><font color="#3333FF"><font size=-2>}</font></font>
<br><b><font color="#009900">//</font>object {RawMaterial scale <0.5,0.5,2>
translate <-4.5,-4.5,39> pigment {color rgb 1}}</b>
<p>If you skip the difference (marked in blue) by <font color="#009900">/*</font>
and <font color="#009900">*/ </font><font color="#000000">and remove the
</font><b><font color="#009900">// </font></b><font color="#000000">of
the line above,</font>
<br><font color="#000000">you get different results: the difference ignores
the cutting of the big cylinder. </font><b><font color="#FF0000"><font size=-2>(marked
in red above)</font></font></b>
<br><font color="#000000">why? and how do I get over this problem?</font><font
color="#000000"></font>
<p><font color="#000000">  Thanks in advance</font>
<br><font color="#000000">  -Eitan Tal</font>
<br><font color="#000000">Icq: 1515298</font></html>


Post a reply to this message

From: Eitan Tal
Subject: Re: CSG vs. Shape Modifiers
Date: 20 Jan 2001 13:07:21
Message: <3A69D3AA.3154D48@netvision.net.il>
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
 
<p>Eitan Tal wrote:
<blockquote TYPE=CITE>Take a look at this:
<p><font size=-2>#version 3</font>
<p><font size=-2>//#include "colors.inc"</font>
<p><font size=-2>global_settings</font>
<br><font size=-2>{</font>
<br><font size=-2>  assumed_gamma 1.0</font>
<br><font size=-2>}</font>
<p><font size=-2>// ----------------------------------------</font>
<br><font size=-2>camera</font>
<br><font size=-2>{</font>
<br><font size=-2>  location  <0.0, 0.5, -2.0></font>
<br><font size=-2>  direction 1.5*z</font>
<br><font size=-2>  right     4/3*x</font>
<br><font size=-2>  look_at   <0.0, 0.5,  0.0></font>
<br><font size=-2>}</font>
<p><font size=-2>sky_sphere</font>
<br><font size=-2>{</font>
<br><font size=-2>  pigment</font>
<br><font size=-2>  {</font>
<br><font size=-2>    gradient y</font>
<br><font size=-2>    color_map { [0.0 color blue 0.6] [1.0
color rgb 1] }</font>
<br><font size=-2>  }</font>
<br><font size=-2>}</font>
<p><font size=-2>light_source</font>
<br><font size=-2>{</font>
<br><font size=-2>  0*x // light's position (translated below)</font>
<br><font size=-2>  color red 1.0  green 1.0  blue 1.0 
// light's color</font>
<br><font size=-2>  translate <-30, 30, -30></font>
<br><font size=-2>}</font>
<br><font size=-2>//Parameters for the RawMaterial (fungus)</font>
<br><font size=-2>#declare toph = 4</font>
<br><font size=-2>#declare w1 = 12</font>
<br><font size=-2>#declare h1 = 22</font>
<br><font size=-2>#declare w2 = 21</font>
<br><font size=-2>#declare CheckPoint = 11</font>
<br><font size=-2>#declare h2 = (w2 * CheckPoint) / w1</font>
<br><font size=-2>#declare CenterX = 10.5</font>
<br><font size=-2>#declare CenterY = 17</font>
<br><font size=-2>#declare r = 3</font>
<br><font size=-2>#declare r1 = 2.16</font>
<p><font size=-2>//Parameters for the Room</font>
<br><font size=-2>#declare WallThickness = 1</font>
<br><font size=-2>#declare Size = 10</font>
<p><font size=-2>#declare RawMaterial =</font>
<br><font size=-2>merge {</font>
<br><font size=-2>  box</font>
<br><font size=-2>  {</font>
<br><font size=-2>    <(w2-w1)/2,0,0>  // one corner
position <X1 Y1 Z1></font>
<br><font size=-2>    <(w2+w1)/2,h1,1>  // other
corner position <X2 Y2 Z2></font>
<br><font size=-2>  }</font>
<br><font size=-2>  cylinder</font>
<br><font size=-2>  {</font>
<br><font size=-2>    0*z, 1*z, 0.43</font>
<br><font size=-2>    scale <w2,h2,1></font>
<br><font size=-2>    translate <CenterX, CenterY,0></font>
<br><b><font size=-2>   <font color="#FF0000">bounded_by {box
{<-1,CheckPoint,-1>,<w2+1,CenterY,2>}}</font></font></b>
<br><font size=-2> }</font>
<br><font size=-2>  cylinder</font>
<br><font size=-2>  {</font>
<br><font size=-2>    0*z, 1*z, 0.43</font>
<br><font size=-2>    scale <w2,h2-3.5,1></font>
<br><font size=-2>    translate <CenterX, CenterY,0></font>
<br><font size=-2>    <b><font color="#FF0000">bounded_by
{box {<-1,CenterY,-1>,<w2+1,h1,2>}}</font></b></font>
<br><font size=-2>  }</font>
<br><font size=-2>  difference</font>
<br><font size=-2>  {</font>
<br><font size=-2>    box {</font>
<br><font size=-2>      <(w2-w1)/2,h1,0>,</font>
<br><font size=-2>      <(w1+w2)/2,h1+toph,1></font>
<br><font size=-2>    }</font>
<br><font size=-2>    cylinder {-1*z, 2*z, r</font>
<br><font size=-2>      scale <w2/2, toph,
1></font>
<br><font size=-2>      translate
<((w2-w1)/2)-(r1*w2/2),h1+(r1*toph),0></font>
<br><font size=-2>    }</font>
<br><font size=-2>    cylinder {-1*z, 2*z, r</font>
<br><font size=-2>      scale <w2/2, toph,
1></font>
<br><font size=-2>      translate
<((w2+w1)/2)+(r1*w2/2),h1+(r1*toph),0></font>
<br><font size=-2>    }</font>
<br><font size=-2>  }</font>
<br><font size=-2>}</font>
<br><font size=-2>#declare Room =</font>
<br><font size=-2>difference {</font>
<br><font size=-2>  box {</font>
<br><font size=-2>    <-Size,-Size,-Size>,</font>
<br><font size=-2>    <Size,Size,Size></font>
<br><font size=-2>  }</font>
<p><font size=-2>{</font>
<br><font size=-2>  <0,0,0>,<50,50,50></font>
<br><font size=-2>  bounded_by {</font>
<br><font size=-2>    box{<-100,-100,0>,<20,30,50>}</font>
<br><font size=-2>  }</font>
<br><font size=-2>}</font>
<p><font color="#3333FF"><font size=-2>difference {</font></font>
<br><font color="#3333FF"><font size=-2>  object {Room pigment{color
rgb <1,1,1>}}</font></font>
<br><b><font color="#3333FF">  object {RawMaterial scale <0.5,0.5,2>
translate <-4.5,-4.5,-11> pigment {color rgb 1}}</font></b>
<br><font color="#3333FF"><font size=-2>  translate <0,0,50></font></font>
<br><font color="#3333FF"><font size=-2>}</font></font>
<br><b><font color="#009900">//</font>object {RawMaterial scale <0.5,0.5,2>
translate <-4.5,-4.5,39> pigment {color rgb 1}}</b>
<p>If you skip the difference (marked in blue) by <font color="#009900">/*</font>
and <font color="#009900">*/ </font><font color="#000000">and remove the
</font><b><font color="#009900">//
</font></b><font color="#000000">of the line above,</font>
<br><font color="#000000">you get different results: the difference ignores
the cutting of the big cylinder. </font><b><font color="#FF0000"><font size=-2>(marked
in red above)</font></font></b>
<br><font color="#000000">why? and how do I get over this problem?</font>
<p><font color="#000000">  Thanks in advance</font>
<br><font color="#000000">  -Eitan Tal</font>
<br><font color="#000000">Icq: 1515298</font></blockquote>
And if you change the bounded_by into clipped_by, the difference will not
work at all -- it will make
<br>the object dissapear. that makes sense because clipped_by makes the
object to be unreal, I mean
<br>if you try to fill it, it will take infinite screen. that might be
a reason.
<p>Question 2: what's the difference between union {} and merge {} ?</html>


Post a reply to this message

From: Chris Huff
Subject: Re: CSG vs. Shape Modifiers
Date: 20 Jan 2001 13:23:36
Message: <chrishuff-71C14A.13244320012001@news.povray.org>
In article <3A6### [at] netvisionnetil>, Eitan Tal 
<eit### [at] netvisionnetil> wrote:

> <!doctype html public "-//w3c//dtd html 4.0 transitional//en">

*Please* don't post in HTML on this server...many newsreaders don't 
support it, and it unnecessarily uses up server space and bandwidth.

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: Christoph Hormann
Subject: Re: CSG vs. Shape Modifiers
Date: 20 Jan 2001 14:08:48
Message: <3A69E241.E32E088E@gmx.de>
Eitan Tal wrote:
> 
> [some code]
> >
> > If you skip the difference (marked in blue) by /* and */ and remove
> > the // of the line above,
> > you get different results: the difference ignores the cutting of the
> > big cylinder. (marked in red above)
> > why? and how do I get over this problem?
> >
> >   Thanks in advance
> >   -Eitan Tal
> > Icq: 1515298
> 
> And if you change the bounded_by into clipped_by, the difference will
> not work at all -- it will make
> the object dissapear. that makes sense because clipped_by makes the
> object to be unreal, I mean
> if you try to fill it, it will take infinite screen. that might be a
> reason.

You seem to assume clipped_by{} and bounded_by{} do the same as CSG
intersection.  But they don't.  

bounded_by{} is for manual bounding and usually does not need to be used
at all.  

clipped_by{} is similar to intersection but it leaves the object open at
the cut areas.  After that the object maybe does no more work correctly in
CSG operations.

All this is explained in detail in the documentation IIRC.

> 
> Question 2: what's the difference between union {} and merge {} ?

union just puts together objects in a logical construct, merge merges the
objects and therefore removes inner surfaces.  

Also this is explained more detailed in the documentation.

BTW your code had errors, needed some modifications to run.

Christoph

-- 
Christoph Hormann <chr### [at] gmxde>
IsoWood include, radiosity tutorial, TransSkin and other 
things on: http://www.schunter.etc.tu-bs.de/~chris/


Post a reply to this message

From: Eitan Tal
Subject: Re: CSG vs. Shape Modifiers
Date: 20 Jan 2001 15:01:19
Message: <3A69EE62.A287AF31@netvision.net.il>
I am sorry, I won't do that again. I didn't know, please don't ban me!


Post a reply to this message

From: Chris Huff
Subject: Re: CSG vs. Shape Modifiers
Date: 20 Jan 2001 16:00:19
Message: <chrishuff-DB845F.16012520012001@news.povray.org>
In article <3A69EE62.A287AF31@netvision.net.il>, Eitan Tal 
<eit### [at] netvisionnetil> wrote:

> I am sorry, I won't do that again. I didn't know, please don't ban me!

Don't worry, if you were going to be banned, I wouldn't bother asking 
you not to do it, would I? ;-)
Anyway, I read your messages in a web browser, and it looks like you are 
miunderstanding bounded_by...the bounded_by feature is for optimization 
only. POV-Ray checks to see if the bounding shape is visible, and then 
checks for the object. The bounding shape doesn't even have to be around 
the object, it just has to be in the line of sight from the camera 
toward the object. If you make it smaller than the object, you can not 
rely on pieces of the object being cut off. To repeat: bounded_by does 
not cut pieces off of the object, it simply helps POV decide if the 
object is visible.

And the clipped_by feature is very similar to the intersection object, 
except it removes the surfaces instead of replacing them with the 
surface of the clipping object. It should work in a CSG, sort 
of...though it may not do what you expect. It is actually used fairly 
rarely compared to the CSG objects.

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: Mark Wagner
Subject: Re: CSG vs. Shape Modifiers
Date: 21 Jan 2001 00:59:15
Message: <3a6a7ab3@news.povray.org>
Most of your message appears to be blank.  I'm assuming you're using a
medium grey color for your text.  Please don't.

--
Mark


Post a reply to this message

From: Peter Popov
Subject: Re: CSG vs. Shape Modifiers
Date: 21 Jan 2001 03:06:14
Message: <jn3l6tgi0nekmr2m8q05tg7t7t32ame42q@4ax.com>
On Sat, 20 Jan 2001 22:00:35 +0200, Eitan Tal
<eit### [at] netvisionnetil> wrote:

>I am sorry, I won't do that again. I didn't know, please don't ban me!

Eitan,

we are a helpful crowd here and if you're shown a mistake of yours, it
is only for your benefit. Chill down :)

Banning is an extreme step. So far, in the 4 (5?) years this
newsserver has been active, only one person has been banned and the
action was not taken lightheartedly from the admin. This person, Matt
Giwer, was banner because he continuously (read: for at least a year,
if not two) and deliberately broke the server Acceptable Use Policy.
He often posted inflammatory material that insulted members of this
community, including Team members, on their race, religion, political
views, or simply by name-calling. He has started and actively
maintained numerous flame wars. He was warned many times, publically
and privately, but he did not wish to comply to the AUP. It was as
late as then that he was then banned, and it was not without a long
and heavy discussion among Team and TAG members before the action was
taken.

It takes a lot of effort on one's side to deserve a ban from this
server. Don't worry :)


Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] vipbg
TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

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