POV-Ray : Newsgroups : povray.general : Empty object Server Time
14 Oct 2026 14:09:18 EDT (-0400)
  Empty object (Message 1 to 14 of 14)  
From: Mark Weyer
Subject: Empty object
Date: 21 Nov 2002 09:38:03
Message: <3DDCF201.8E1826C9@frege.mathematik.uni-freiburg.de>
Hi,

I occasionally (usually to feed parameters to CSG macros where) need an
empty object.
(This means that the spatial extension is empty.) Consider the following
approaches:

    #declare No_object1 = box {0 0}
    #declare No_object2 = intersection {box {0 0} box {1 1}}
    #declare No_object3 = quadric {0 0 0 1}

The first is quite fast but actually not correct: The object contains
one point.
It might happen that a stray ray accidentally hits this point, causing
artefacts.
The second remedies the problem, but causes a

    Warning: Degenerate CSG bounding box (not used!).

which I dislike for aesthetical reasons. The third, which I currently
use,
is fine. But it has no bounding box either and hence uses as much time
as the second. I might add a bounding box to the third approach, but I
still hope there might be a more elegant solution.

Any suggestions?

  Mark Weyer


Post a reply to this message

From: Warp
Subject: Re: Empty object
Date: 21 Nov 2002 09:47:31
Message: <3ddcf203@news.povray.org>
Mark Weyer <wey### [at] fregemathematikuni-freiburgde> wrote:
>     #declare No_object1 = box {0 0}

> The first is quite fast but actually not correct: The object contains
> one point.
> It might happen that a stray ray accidentally hits this point, causing
> artefacts.

  Add "no_image no_reflection no_shadow" to it, so it should be completely
ignored (at least in theory).

-- 
#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: Mark Weyer
Subject: Re: Empty object
Date: 21 Nov 2002 09:59:33
Message: <3DDCF70D.3354F466@frege.mathematik.uni-freiburg.de>
> >     #declare No_object1 = box {0 0}
>
>   Add "no_image no_reflection no_shadow" to it, so it should be completely
> ignored (at least in theory).

Not if used in difference. Or do I get something wrong?

To be more precise:

difference {
  box {<-1,-1,0> <1,1,1}
  box {0 0 no_image no_reflection no_shadow}
}

I did not try this, but if the stray ray actually hits the 0-box, I think it
would decide not to have hit the surface of the defference yet. Hence
it would continue INSIDE the object.

  Mark


Post a reply to this message

From: ABX
Subject: Re: Empty object
Date: 21 Nov 2002 10:04:23
Message: <u8tptu8n6u4u1tf3qrttrgss5sopp72vug@4ax.com>
On Thu, 21 Nov 2002 16:09:02 +0100, Mark Weyer
<wey### [at] fregemathematikuni-freiburgde> wrote:
> Not if used in difference. Or do I get something wrong?
> To be more precise:
> difference {
>   box {<-1,-1,0> <1,1,1}
>   box {0 0 no_image no_reflection no_shadow}
> }

Do you really need an empty object ? Can't you directly use first box object
then instead of whole difference object ?

ABX


Post a reply to this message

From: Mark Weyer
Subject: Re: Empty object
Date: 21 Nov 2002 10:16:44
Message: <3DDCFB14.62D0D20C@frege.mathematik.uni-freiburg.de>
> Do you really need an empty object ? Can't you directly use first box object
> then instead of whole difference object ?

It seems I forgot to repeat the following information in my
second post: It need the empty object to feed it as a parameter
to macros using CSG.

Example: I might have a macro for doors. One of its parameters
is the key shape, so I can carve in (using difference) an appropriate
keyhole. Sometimes I might need a door without a keyhole. The I
would feed the empty object for the key shape. Following your idea
I would have to make a second copy of the door macro where I omit
the carving out of the keyhole.

  Mark Weyer


Post a reply to this message

From: Christoph Hormann
Subject: Re: Empty object
Date: 21 Nov 2002 10:26:00
Message: <3DDCFB05.CDBD2CD8@gmx.de>
Mark Weyer wrote:
> 
> It seems I forgot to repeat the following information in my
> second post: It need the empty object to feed it as a parameter
> to macros using CSG.

If you are not up to maximum speed just use a poly or isosurface with no
solutions...

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 15 Nov. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: ABX
Subject: Re: Empty object
Date: 21 Nov 2002 10:27:43
Message: <68uptuc2ftpaajn57ltngrubigtm6vllhn@4ax.com>
On Thu, 21 Nov 2002 16:26:12 +0100, Mark Weyer
<wey### [at] fregemathematikuni-freiburgde> wrote:
> > Do you really need an empty object ? Can't you directly use first box object
> > then instead of whole difference object ?
>
> It seems I forgot to repeat the following information in my
> second post: It need the empty object to feed it as a parameter
> to macros using CSG.

I already saw this but I intentionaly provoked you to more precise answer :-)

> Example: I might have a macro for doors. One of its parameters
> is the key shape, so I can carve in (using difference) an appropriate
> keyhole. Sometimes I might need a door without a keyhole. The I
> would feed the empty object for the key shape. Following your idea
> I would have to make a second copy of the door macro where I omit
> the carving out of the keyhole.

There is a lot of ways how you can do this without empty object.

For example:

// indexes to array
#declare DoorsId=0;
#declare KeyholeId=1;
#declare Key=2;


#macro Room(Elements)
  #local Door=Elements[DoorsId];
  #ifdef(Elements[KeyholeId])
    #local Door=intersection{
                  object{Door}
                  object{Elements[KeyholeId]}
                };
    #ifdef(Elements[Key])
      #local Door=union{
                    object{Door}
                    object{Elements[Key]}
                  };
    #end
  #end
#end

ABX


Post a reply to this message

From: Mark Weyer
Subject: Re: Empty object
Date: 21 Nov 2002 10:35:23
Message: <3DDCFF73.C06ACF8C@frege.mathematik.uni-freiburg.de>
> There is a lot of ways how you can do this without empty object.

You are right. But I still prefer the empty-object-method for
some applications, because it is more elegant to my taste.

  Mark


Post a reply to this message

From: Mark Weyer
Subject: Re: Empty object
Date: 21 Nov 2002 10:37:35
Message: <3DDCFFF8.96CF425D@frege.mathematik.uni-freiburg.de>
> If you are not up to maximum speed just use a poly or isosurface with no
> solutions...

In fact, my third approach (quadric {0 0 0 1}) is quite similar.
What is your suggestion for maximum speed?

  Mark


Post a reply to this message

From: ABX
Subject: Re: Empty object
Date: 21 Nov 2002 10:48:36
Message: <vevptu8f8emubfmiq27dba239m9rak6qoj@4ax.com>
On Thu, 21 Nov 2002 16:44:51 +0100, Mark Weyer
<wey### [at] fregemathematikuni-freiburgde> wrote:
> > There is a lot of ways how you can do this without empty object.
>
> You are right. But I still prefer the empty-object-method for
> some applications, because it is more elegant to my taste.

Wasting memory for not necessary CSG objects is elegant? I doubt.

ABX


Post a reply to this message

From: Christopher James Huff
Subject: Re: Empty object
Date: 21 Nov 2002 10:59:58
Message: <chrishuff-0FCA8C.10581821112002@netplex.aussie.org>
In article <3DDCFF73.C06ACF8C@frege.mathematik.uni-freiburg.de>,
 Mark Weyer <wey### [at] fregemathematikuni-freiburgde> wrote:

> You are right. But I still prefer the empty-object-method for
> some applications, because it is more elegant to my taste.

It is in no way "elegant". It needlessly slows things down, takes 
memory, and is just an ugly hack. The array method looks like the best 
way to do it: simple, flexible, doesn't waste processing power or do 
other odd things that could cause trouble. You don't need a "nothing" 
object.

-- 
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: chr### [at] tagpovrayorg
http://tag.povray.org/


Post a reply to this message

From: Warp
Subject: Re: Empty object
Date: 21 Nov 2002 12:29:41
Message: <3ddd1805@news.povray.org>
Mark Weyer <wey### [at] fregemathematikuni-freiburgde> wrote:
> What is your suggestion for maximum speed?

  Don't use an object at all. That achieves maximum speed.

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Rafal 'Raf256' Maj
Subject: Re: Empty object
Date: 21 Nov 2002 12:32:39
Message: <Xns92CDBC0F1D0BBraf256com@204.213.191.226>
Mark Weyer <wey### [at] fregemathematikuni-freiburgde> wrote in 
news:3DDCF201.8E1826C9@frege.mathematik.uni-freiburg.de

> Any suggestions?

maybe :

isosurface { function { 1 } gradient 0.01 accuracy 100000 
contained_by { box { -1e5,+1e5 } }


-- 
#macro g(U,V)(.4*abs(sin(9*sqrt(pow(x-U,2)+pow(y-V,2))))*pow(1-min(1,(sqrt(
pow(x-U,2)+pow(y-V,2))*.3)),2)+.9)#end#macro p(c)#if(c>1)#local l=mod(c,100
);g(2*div(l,10)-8,2*mod(l,10)-8)*p(div(c,100))#else 1#end#end light_source{
y 2}sphere{z*20 9pigment{function{p(26252423)*p(36455644)*p(66656463)}}}//M


Post a reply to this message

From: Jellby
Subject: Re: Empty object
Date: 21 Nov 2002 16:15:02
Message: <3ddd4cd6@news.povray.org>
Mark Weyer wrote:

> I occasionally (usually to feed parameters to CSG macros where) need an
> empty object.
>
> [...]
>
> Any suggestions?

sphere { 0, 0 clipped_by { sphere { 1, 0 } }

-- 
Ignacio Fernández Galván
Linux User #289967 (counter.li.org)
PGP Pub Key ID: 0x01A95F99 (pgp.escomplinux.org)


Post a reply to this message

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