POV-Ray : Newsgroups : povray.general : One Object in Union Server Time
16 Nov 2024 17:24:45 EST (-0500)
  One Object in Union (Message 1 to 10 of 19)  
Goto Latest 10 Messages Next 9 Messages >>>
From: mmm
Subject: One Object in Union
Date: 1 Oct 2003 07:05:01
Message: <web.3f7ab44c4e1728de48fe3750@news.povray.org>
I'm writing a macro that takes the union of from 1 to n objects.  If there
is one object, POV rightfully issues a warning message.  How can I get
around the problem?  If POV had a null object, I could always include that
in the union.
Thanks in Advance.


Post a reply to this message

From: ABX
Subject: Re: One Object in Union
Date: 1 Oct 2003 07:13:45
Message: <abdlnvoojc7pvkjvpp213ulc3ij39quv96@4ax.com>
On Wed,  1 Oct 2003 07:02:36 EDT, "mmm" <mik### [at] comcastnet> wrote:
> I'm writing a macro that takes the union of from 1 to n objects.  If there
> is one object, POV rightfully issues a warning message.  How can I get
> around the problem?

Is below sufficient ?


#macro Get_Nth_Object(Nth) // Nth is 0-based
  sphere{ ... }
#end

#macro Get_Objects_In_One_Body(N)
  #if(N=1)
    #local Object = Get_Nth_Object(0)
  #else
    #local Object = union{
      #local Counter = 0;
      #while (Counter < N )
        Get_Nth_Object(Counter)
        #local Counter = Counter + 1;
      #end
    }
  #end
  Object
#end

difference{
  object{ Get_Objects_In_One_Body(3) }
  object{ Get_Objects_In_One_Body(1) }
}

ABX


Post a reply to this message

From: SeeSchloss
Subject: Re: One Object in Union
Date: 1 Oct 2003 07:36:09
Message: <mesnews.0b307d3a.2d400faf.123.1389@seeschloss.net>
> I'm writing a macro that takes the union of from 1 to n objects.  
> If there is one object, POV rightfully issues a warning message.  
> How can I get around the problem?  If POV had a null object, I 
> could always include that in the union.

Well I guess a box {0,0} would act as a null object ?


-- 


Post a reply to this message

From: Tom Melly
Subject: Re: One Object in Union
Date: 1 Oct 2003 07:40:28
Message: <3f7abd2c$1@news.povray.org>
"mmm" <mik### [at] comcastnet> wrote in message
news:web.3f7ab44c4e1728de48fe3750@news.povray.org...

> is one object, POV rightfully issues a warning message.  How can I get

Ignore the warning? Is the warning causing you a specific problem, or is your
objection to it purely aesthetic?


Post a reply to this message

From: Warp
Subject: Re: One Object in Union
Date: 1 Oct 2003 08:08:04
Message: <3f7ac3a3@news.povray.org>
#if(there will be only 1 object)
  create the object alone
#else
  union
  {
    create the objects
  }
#end

-- 
#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: Warp
Subject: Re: One Object in Union
Date: 1 Oct 2003 08:10:01
Message: <3f7ac419$1@news.povray.org>
OTOH, if the object creation is complicated, you might want to try
this idea instead:

#if(there will be more than 1 object)
  union {
#else
  object {
#end
    create object(s) here
  }

-- 
plane{-x+y,-1pigment{bozo color_map{[0rgb x][1rgb x+y]}turbulence 1}}
sphere{0,2pigment{rgbt 1}interior{media{emission 1density{spherical
density_map{[0rgb 0][.5rgb<1,.5>][1rgb 1]}turbulence.9}}}scale
<1,1,3>hollow}text{ttf"timrom""Warp".1,0translate<-1,-.1,2>}//  - Warp -


Post a reply to this message

From: Tim Nikias v2 0
Subject: Re: One Object in Union
Date: 1 Oct 2003 08:39:18
Message: <3f7acaf6$1@news.povray.org>
Warp already gave that reply, but with a chunk of #if around it, so I
thought I'd put it here for simplicity:

union{} takes several objects.
object{} takes just one.

So, instead of union{}, just use object{}, but once you'll use more than one
actual object there, I think POV-Ray issues not only a warning, but stops as
well. That's the point where Warp's #if come in: check if you actually have
one or more objects, and then use object{}/union{} as required.

Greets,
Tim

-- 
Tim Nikias v2.0
Homepage: http://www.digitaltwilight.de/no_lights
Email: tim.nikias (@) gmx.de


> I'm writing a macro that takes the union of from 1 to n objects.  If there
> is one object, POV rightfully issues a warning message.  How can I get
> around the problem?  If POV had a null object, I could always include that
> in the union.
> Thanks in Advance.
>


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.521 / Virus Database: 319 - Release Date: 23.09.2003


Post a reply to this message

From: mmm
Subject: Re: One Object in Union
Date: 1 Oct 2003 09:15:02
Message: <web.3f7ad2c812fa09048fe3750@news.povray.org>
mmm wrote:
>I'm writing a macro that takes the union of from 1 to n objects.  If there
>is one object, POV rightfully issues a warning message.  How can I get
>around the problem?  If POV had a null object, I could always include that
>in the union.
>Thanks in Advance.
>


Thanks for the thoughts and possible solutions.  The solution by Warp and
Tim will do nicely in my application.

.... mmm


Post a reply to this message

From: Mark Weyer
Subject: Re: One Object in Union
Date: 1 Oct 2003 12:50:29
Message: <3F7B06E9.90104@informatik.uni-freiburg.de>
> Well I guess a box {0,0} would act as a null object ?

Actually it still contains one point.
My null object currently is union {} - I ignore the first warning.


-- 
merge{#local i=-11;#while(i<11)#local
i=i+.1;sphere{<i*(i*i*(.05-i*i*(4e-7*i*i+3e-4))-3)10*sin(i)30>.5}#end
pigment{rgbt 1}interior{media{emission x}}hollow}//  Mark Weyer


Post a reply to this message

From: Gilles Tran
Subject: Re: One Object in Union
Date: 1 Oct 2003 13:37:29
Message: <3f7b10d9$1@news.povray.org>

news:3f7abd2c$1@news.povray.org...
> "mmm" <mik### [at] comcastnet> wrote in message
> news:web.3f7ab44c4e1728de48fe3750@news.povray.org...

> Ignore the warning? Is the warning causing you a specific problem, or is
your
> objection to it purely aesthetic?

In fact, warning messages can be a real problem. A long parsing loop issuing
that sort of warning can make the parsing extremely slow. Ditto with some of
the isosurface warnings.

For instance :
#declare i=0;union{#while (i<100000)union{sphere{0,1 translate x*i}}#declare
i=i+1;#end
takes 2 min 10 to parse on my machine, instead of 10s if no union is used.

Though much preferable, making a check isn't always easy and can increase
the parsing time so there are some cases where it's just more practical to
turn the messages off with -GW if they become a nuisance.

G.

-- 

**********************
http://www.oyonale.com
**********************
- Graphic experiments
- POV-Ray and Poser computer images
- Posters


Post a reply to this message

Goto Latest 10 Messages Next 9 Messages >>>

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