POV-Ray : Newsgroups : povray.general : Please Help Me Find My Stupid Mistake : Re: Please Help Me Find My Stupid Mistake Server Time
3 Aug 2024 04:15:52 EDT (-0400)
  Re: Please Help Me Find My Stupid Mistake  
From: Dave Matthews
Date: 6 May 2004 14:58:23
Message: <409a8acf$1@news.povray.org>
Never mind.  I found it.  I need a "union" in my second macro to make it 
work the way I thought it should -- i.e. treat it as a single object.

Dave Matthews

Dave Matthews wrote:
> The code below works, but by my reasoning it shouldn't.  I had to move a 
> "}" to what is "clearly" the "wrong" location (obviously it isn't wrong, 
> since it works; what is wrong is my logic.)  When I close out my objects 
> the way I think I should, I get a parse error.  Can someone spot my 
> mistake?
> 
> (If the code seems a bit strange, it's because I've stripped it down as 
>  much as I can, I think, and still have the problem.)
> 
> ////////Code
> //Ball-And-Stick Fragment
> 
> #macro B_And_S_Triangle(V_Array,BR,SR)
>         union {
>         sphere { 0, 1  scale BR pigment { color rgb x }
>                  translate V_Array[0]}
>         sphere { 0, 1  scale BR pigment { color rgb y }
>                  translate V_Array[1]}
>         sphere { 0, 1  scale BR pigment { color rgb z }
>                  translate V_Array[2]}
>         cylinder { V_Array[0], V_Array[1], SR
>                    pigment { color rgb x+y } }
>         cylinder { V_Array[0], V_Array[2], SR
>                    pigment { color rgb x+y } }
>         cylinder { V_Array[1], V_Array[2], SR
>                    pigment { color rgb x+y } }
>         }
> #end
> //Of Macro The problem's probably somewhere above, but I can't find it.
> 
> 
> 
> // Second macro, calls above macro twice:
> 
> #macro Ball_And_Stick(SArray,DArray,B_Rad,S_Rad)
> 
> #declare Source_Triangle =
>                      B_And_S_Triangle(SArray,B_Rad,S_Rad)
> 
> #declare Destination_Triangle =
>                      B_And_S_Triangle(DArray,B_Rad/2,S_Rad/2)
> 
> //Here's "misplaced" "}"
> 
> object { Source_Triangle }}
> 
> //I think there should only be one "}" ending above object
> 
> object { Destination_Triangle }
> 
> #end    //Of 2nd macro
> 
> 
> // Here's the main body
> 
> 
> #declare Source_Points = array[3];
> 
> #declare Source_Points[0] = <0, 0, 0>;
> #declare Source_Points[1] = <0, 5, 0>;
> #declare Source_Points[2] = <5, 0, 0>;
> 
> 
> #declare Destination_Points = array[3];
> 
> #declare Destination_Points[0] = <1, 1, 0>;
> #declare Destination_Points[1] = <2, 1, 0>;
> #declare Destination_Points[2] = <1, 2, 0>;
> 
> //Here's "missing" "}"
> object { Ball_And_Stick(Source_Points,Destination_Points,0.5, 0.1)
> //I think there should be a "}" to end the above object.
> 
> camera { angle 60 location <3, 3, -20>
>     look_at <3, 3, 0>
>     right x*image_width/image_height
>         up y }
> 
> light_source { -100*z color rgb 1 }
> 
> background { color rgb 0.7 }
> 
> 
> //////////////////////////
> I've been tearing out what little hair I have left, trying to solve 
> this.  Thanks in advance for any help.
> 
> Dave Matthews
>


Post a reply to this message

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