POV-Ray : Newsgroups : povray.advanced-users : Quiz Server Time
29 Jul 2024 12:19:20 EDT (-0400)
  Quiz (Message 1 to 10 of 10)  
From: Micha Riser
Subject: Quiz
Date: 28 May 2002 12:16:38
Message: <3cf3ad66@news.povray.org>
For what O is

        object{O}

the same as

        object{object{O inverse} inverse}

?

- Micha


-- 
objects.povworld.org - The POV-Ray Objects Collection
book.povworld.org    - The POV-Ray Book Project


Post a reply to this message

From: Jan Walzer
Subject: Re: Quiz
Date: 28 May 2002 13:15:06
Message: <3cf3bb1a@news.povray.org>
"Micha Riser" <mri### [at] gmxnet> wrote:
> For what O is
>
>         object{O}
>
> the same as
>
>         object{object{O inverse} inverse}
>

shouldn't this apply for all objects ?


Post a reply to this message

From: Warp
Subject: Re: Quiz
Date: 28 May 2002 13:25:29
Message: <3cf3bd89@news.povray.org>
Micha Riser <mri### [at] gmxnet> wrote:
> For what O is

>         object{O}

> the same as

>         object{object{O inverse} inverse}

> ?

  Logically yes, but whether POV-Ray is able to optimize the inverses away
or not is a different question.

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

From: Micha Riser
Subject: Re: Quiz
Date: 28 May 2002 16:52:44
Message: <3cf3ee1c@news.povray.org>
Jan Walzer wrote:

> "Micha Riser" <mri### [at] gmxnet> wrote:
>> For what O is
>>
>>         object{O}
>>
>> the same as
>>
>>         object{object{O inverse} inverse}
>>
> 
> shouldn't this apply for all objects ?

Well, - as Warp wrote - logically yes, but it depends how POV handles it. 

The answer is *not* "for all". Have another try :)

- Micha


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Quiz
Date: 28 May 2002 17:31:26
Message: <3cf3f72e@news.povray.org>
In article <3cf3bd89@news.povray.org> , Warp <war### [at] tagpovrayorg>  wrote:

>   Logically yes, but whether POV-Ray is able to optimize the inverses away
> or not is a different question.

Well, "inverse" keyword sets the internal INVERTED_FLAG and just like all bit
flags it is promoted and then handled by the object intersection code itself.
Consequently an object is either inverted or it is nor.  Thus the inverse flag
is always "optimised" also the correct term would probably be "promoted".

    Thorsten

____________________________________________________
Thorsten Froehlich
e-mail: mac### [at] povrayorg

I am a member of the POV-Ray Team.
Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Micha Riser
Subject: Solution
Date: 30 May 2002 11:17:59
Message: <3cf642a7@news.povray.org>
Thorsten Froehlich wrote:
> 
> Well, "inverse" keyword sets the internal INVERTED_FLAG and just like all
> bit flags it is promoted and then handled by the object intersection code
> itself.
> Consequently an object is either inverted or it is nor.  Thus the inverse
> flag is always "optimised" also the correct term would probably be
> "promoted".

As I see this from the source code this is handled differently from object 
to object. Most of them just set the INVERTED_FLAG but not all. It is not 
possible to do this for CSG objects. Instead POV has to use De Morgans's 
law. This means that all members of the CSG get inverted and the CSG type 
is changed as follows:

 union -> intersection
 merge -> intersection
 intersection -> merge

This has the consequence that a double-inverted union results in a merge!

So for 
 #declare O = union{
  sphere{<0,0,1>,2}
  sphere{<0,0,-1>,2}
  pigment{rgbf 0.9} finish{ambient 1}
 }

 object{O} 
and
 object{object{O inverse} inverse}

is not the same as in the second version the internal walls are removed. 

- Micha


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Solution
Date: 30 May 2002 13:41:24
Message: <3cf66444@news.povray.org>
In article <3cf642a7@news.povray.org> , Micha Riser <mri### [at] gmxnet>  wrote:

> is not the same as in the second version the internal walls are removed.

Well, that is intentional as you are essentially misusing the "union" object
as a merge object in the first place.  There is no correct inversion of a
union object that is not a merge so POV-Ray changes it for you automatically.
So inverting has a side effect in this case, yes (and maybe a warning might be
a good idea for this), but is changes nothing about the optimal handling of
"inverse", that is multiple-inversions will not add any otherhead, which is
the answer to the initial question you asked...

    Thorsten

____________________________________________________
Thorsten Froehlich
e-mail: mac### [at] povrayorg

I am a member of the POV-Ray Team.
Visit POV-Ray on the web: http://mac.povray.org


Post a reply to this message

From: Warp
Subject: Re: Solution
Date: 30 May 2002 13:56:23
Message: <3cf667c6@news.povray.org>
Micha Riser <mri### [at] gmxnet> wrote:
> This has the consequence that a double-inverted union results in a merge!

  If you think about it, that's exactly the correct behaviour.

  An inverted union is everything outside the union. Now the "outside"
is everything that was "inside" the union. "Outside" doesn't have any surfaces
in it, but it's just empty space. Inverting a union implicitly "removes" all
the inner surfaces (because they are not inner anymore).
  Now if you invert this object, you get an object which is everything that
was "outside" the object. That is, the original union with the inner surfaces
removed.

-- 
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}//  - Warp -


Post a reply to this message

From: Micha Riser
Subject: Re: Solution
Date: 30 May 2002 16:42:03
Message: <3cf68e9b@news.povray.org>
Thorsten Froehlich wrote:
> as a merge object in the first place.  There is no correct inversion of a
> union object that is not a merge 

Yep, that's exactly the point. I did not mean to claim that there is 
anything wrong with POV-Ray. It is just something I came across while 
implementing CSG for my own little ray-tracer.

> so POV-Ray changes it for you
> automatically. So inverting has a side effect in this case, yes (and maybe
> a warning might be a good idea for this), but is changes nothing about the
> optimal handling of "inverse", that is multiple-inversions will not add
> any otherhead, which is the answer to the initial question you asked...

That was Warp's question not mine. I just wanted to point out that 
double-inversing does sometimes do something one would not expect at the 
first moment.

- Micha


Post a reply to this message

From: Micha Riser
Subject: Re: Solution
Date: 30 May 2002 16:44:51
Message: <3cf68f43@news.povray.org>
Warp wrote:

> Micha Riser <mri### [at] gmxnet> wrote:
>> This has the consequence that a double-inverted union results in a merge!
> 
>   If you think about it, that's exactly the correct behaviour.

I never said there was anything wrong. 

> 
>   An inverted union is everything outside the union. Now the "outside"
> is everything that was "inside" the union. "Outside" doesn't have any
> surfaces in it, but it's just empty space. Inverting a union implicitly
> "removes" all the inner surfaces (because they are not inner anymore).

Hmm, I better like the idea that there is no correct inversion of unions.

- MIcha


Post a reply to this message

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