POV-Ray : Newsgroups : povray.general : One Object in Union Server Time
4 Aug 2024 02:19:42 EDT (-0400)
  One Object in Union (Message 11 to 19 of 19)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Tom Melly
Subject: Re: One Object in Union
Date: 2 Oct 2003 08:03:32
Message: <3f7c1414$1@news.povray.org>
"Gilles Tran" <tra### [at] inapginrafr> wrote in message
news:3f7b10d9$1@news.povray.org...

> 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 :

(tests) Eeek!

> turn the messages off with -GW if they become a nuisance.

Which may be a pain for other elements of the scene.... Hmm, see my new post on
this.


Post a reply to this message

From: Tom Melly
Subject: Re: One Object in Union
Date: 2 Oct 2003 08:09:16
Message: <3f7c156c$1@news.povray.org>
"mmm" <mik### [at] comcastnet> wrote in message
news:web.3f7ad2c812fa09048fe3750@news.povray.org...

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

Glad to hear it - it did occur to me that, under some circs., none of the
suggestions made so far (incl. mine) would work.

For a start, sphere{0,0} caused me problems when there were enough of them, so
that would seem to rule out a null object (or at least sphere{0,0} as a null).

Secondly, turning off warnings might not be ideal, since you might want to see
other warnings relating to other elements of the scene.

Finally, the suggestions from ABX and Warp only apply if you know whether you
have one object or more prior to issueing the union{ or object{.

Consider the following code:

camera {location  <0,0,-80>  look_at 0}
light_source {0 color rgb 1 translate <-30, 30, -30>}


#declare Rand1 = seed(235);
#macro OneOrMore() // creates between 1 and 10 spheres
  #declare OCnt = int(rand(Rand1)*10)+1;
  #declare C2 = 1;
  #while(C2<=OCnt)
    sphere{0,0.45 translate y*C2}
    #declare C2=C2+1;
  #end
#end

#declare C1 = 0;
#while(C1<100)
  union{
    OneOrMore()
    translate x*(C1-50)
    pigment{rgb<1,0,0>}
    finish{ambient 1/4}
  }
  #declare C1=C1+1;
#end


Now, there is an obvious fix - move the union{ to inside the macro (and then
switch between union and object), but IMHO a more complex macro and/or scene
might make fixing it tricky....


Post a reply to this message

From: Tim Cook
Subject: Re: One Object in Union
Date: 2 Oct 2003 09:26:04
Message: <3f7c276c$1@news.povray.org>
Drop a sphere with no_image, no_shadow, no_reflection, etc in the
union?


Post a reply to this message

From: Tom Melly
Subject: Re: One Object in Union
Date: 2 Oct 2003 09:53:07
Message: <3f7c2dc3@news.povray.org>
"Tim Cook" <z99### [at] bellsouthnet> wrote in message
news:3f7c276c$1@news.povray.org...
> Drop a sphere with no_image, no_shadow, no_reflection, etc in the
> union?

I had a similiar thought, but just pigment{rgbf 1} - still looks like a nasty
kludge.


Post a reply to this message

From:
Subject: Re: One Object in Union
Date: 2 Oct 2003 11:00:36
Message: <3f7c3d94$1@news.povray.org>
The "Match Brace" command from the search menu will be irritated
by this code (although it is parsed as intended).  Appending
" // }" to the closing brace in the last line will fix this
because the Match Brace command doesn't ignore braces inside
comments.
A slightly more transparent solution (in more complex situations)
is to postfix every non-matching "{" with " // }" or "/* } */ and
prefix such "}" with "/* { */".

   Sputnik


Post a reply to this message

From: Jellby
Subject: Re: One Object in Union
Date: 2 Oct 2003 17:01:29
Message: <3f7c9228@news.povray.org>
Entre otras cosas, Tom Melly tuvo a bien escribir:

>> Drop a sphere with no_image, no_shadow, no_reflection, etc in the
>> union?
> 
> I had a similiar thought, but just pigment{rgbf 1} - still looks like a
> nasty kludge.

For a null object, in case it's needed, I suggest:

sphere {
  0, 0                             // or 0, 0.1
  clipped_by { sphere { 1, 0 } }   // or 1, 0.1
}

Would there be any problem with this?

-- 
light_source{9+9*x,1}camera{orthographic look_at(1-y)/4angle 30location
9/4-z*4}light_source{-9*z,1}union{box{.9-z.1+x clipped_by{plane{2+y-4*x
0}}}box{z-y-.1.1+z}box{-.1.1+x}box{.1z-.1}pigment{rgb<.8.2,1>}}//Jellby


Post a reply to this message

From: Warp
Subject: Re: One Object in Union
Date: 2 Oct 2003 18:44:09
Message: <3f7caa38@news.povray.org>
Jellby <jel### [at] m-yahoocom> wrote:
> sphere {
>   0, 0                             // or 0, 0.1
>   clipped_by { sphere { 1, 0 } }   // or 1, 0.1
> }

> Would there be any problem with this?

  It requires memory and I don't know if POV-Ray is able to optimize
it away in the ray-shape intersection tests.
  If it's possible to replace "union" with "object" when there's only
only object, that would be the best solution.

-- 
#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: One Object in Union
Date: 8 Oct 2003 05:23:41
Message: <3F83D8C0.1090902@informatik.uni-freiburg.de>
> Drop a sphere with no_image, no_shadow, no_reflection, etc in the
> union?

What happens if the union is later used as a cutaway in a difference?
(I really don't know and you made me curious.)


-- 
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: Tim Cook
Subject: Re: One Object in Union
Date: 8 Oct 2003 09:54:29
Message: <3f841715$1@news.povray.org>
Mark Weyer wrote:
>> Drop a sphere with no_image, no_shadow, no_reflection, etc in the
>> union?
> What happens if the union is later used as a cutaway in a difference?
> (I really don't know and you made me curious.)

Hmm.  Well, there's one way to find out.
...
It behaves like any other sphere differenced from something.


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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