POV-Ray : Newsgroups : povray.advanced-users : Questions about fixing SHAPES.INC re: recent bug reports : Re: Questions about fixing SHAPES.INC re: recent bug reports Server Time
3 Jul 2024 06:12:43 EDT (-0400)
  Re: Questions about fixing SHAPES.INC re: recent bug reports  
From: Kenneth
Date: 5 Oct 2008 13:40:01
Message: <web.48e8f9cd80f4bccd78dcad930@news.povray.org>
I figured out how to eliminate exponential notation from the HFCreate_() macro's
vertex_vectors, too.

At line 903 in the original shapes.inc file, the code is this:
..........
#local J = 1;
   #while (J<=xRes)
      #local K = 1;
      #while (K<=zRes)
         PArr[J][K],
         #declare K = K+1;
      #end
      #declare J = J+1;
..........


Replace it with this:
.........
#local J = 1;
   #while (J<=xRes)
      #local K = 1;
      #while (K<=zRes)
           #if(WriteFile)
           "<",vstr(3,PArr[J][K],",",0,12),"> ",
           #else
           PArr[J][K],
           #end
        #declare K = K+1;
      #end
      #declare J = J+1;
.........

Again, this is a 'global' fix for all the mesh generators using HFCreate.

Frankly, I didn't think such string syntax would work in this case (plugging a
multi-dimensional array into a single vstr statement.) But somehow, POV-Ray
knows what to do, and #writes the 3-value vectors found in both [J] and [K]
correctly.  Amazing!

The only remaining question was, How many decimal places to use for the
triangle-vertex precision? Using the unmodified, orignal shapes.inc, POV-Ray
for Windows #writes a max of 6 decimal places (or rather, always 6 USEFUL
places, if there happen to be zeros to the left.)  But I wonder if that's
enough precision when #writing a high-resolution HF file? I decided to use 12
decimal places. Probably overkill (difficult to determine!) And it does make
the #written file larger (in bytes)...but on fast modern computers, that's a
very small price to pay.

SO...the only things remaining to be fixed in the HFCreate macro (to eliminate
exponential notation) are uv_vectors and normal_vectors. They can both be
updated using similar string syntax and #if/#else commands (although
normal_vectors looks to be particularly difficult!)

Ken W.


Post a reply to this message

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