|
![](/i/fill.gif) |
> It also adds "Object_Name" inside quotes to the array, which adds that
> string to the array, not the contents of the identifier Object_Name. This
> means your test for the actual object name is never successful. So you'd
> need:
>
> #declare Cylinder_Objects_Id[ Cylinder_Id_I ] = Object_Name;
>
>
I tried this but kept getting errors. But I will try it again
> But I have a more general concern that you're making life far more
> complicated for yourself than it needs to be. If you were working in a
> computer language with a full trace and debug toolset then indexing problems
> like this would be easy enough to trace through, but you don't have anything
> more powerful than the #debug statement to get you through this in POV-Ray.
> I'd recommend using more of the powerful features of POV-Ray SDL to vastly
> simplifying what you've got before going any further.
Yes I totally agree. I have a tight schedule but really could not help diving
in. I know there are terribly mistakes as I have not used POV consistently over
the years... but so long as I was stumbling along... I will try to calm down a
bit. Your comments are invaluable though. I was really getting drowned.
>
> Anywhere you've got a macro for 1 or 2 lines of code I'd recommend
> eliminating it.
>
> There's no need to keep so many different indices. You can store 3D vectors
> inside arrays and you can have multi-dimensional arrays, so you can store a
> start vector and an end vector in the same array:
>
> #declare Cylinder_Locations = array [5][2];
> #declare Cylinder_Locations[0][0] = <1,2,3>;
> #declare Cylinder_Locations[0][1] = <4,5,6>;
>
> This means you only need one index for all the cylinder arrays.
>
> You can still access individual vector components e.g.
> Cylinder_Locations[0,1].y
> gives you the value '5'
>
> So the whole Save_Cylinder_Loc macro comes down to 2 lines, at which point
> I'd scrap the macro altogether and simply inline the code.
>
This would be beautiful!
> It seems excessive to keep resizing the array (a relatively expensive
> option) each time you add an element. I don't think empty arrays take up
> much memory in POV-Ray, so you could declare your arrays with sufficient
> elements at the start and cut down on render times and on the amount of code
> you need to debug.
>
Sigh!
> When using debug I'd recommend using it with the 'concat' function to help
> make messages stand out better in the message stream. Eg:
>
> #debug concat("Match: ",Cylinder_Objects_Id[ Count ],"\n")
> #debug concat("No Match: ",Cylinder_Objects_Id[ Count ],"\n")
>
Thanks
Post a reply to this message
|
![](/i/fill.gif) |