POV-Ray : Newsgroups : povray.general : A problem with HF macros in shapes.inc : A problem with HF macros in shapes.inc Server Time
2 Aug 2024 06:21:10 EDT (-0400)
  A problem with HF macros in shapes.inc  
From: Jellby
Date: 1 Jan 2005 10:09:59
Message: <41d6bd46@news.povray.org>
When creating a *large* heightfield with these macros (I was using HF_Sphere
with 750*750 points) and writing the data to a file, an error can be
triggered. There are two issues here.

a) Since the file is created with almost no "newlines", when there's an
error povray tries to output the last 5 lines before the problem, which are
endless lines, so this takes forever. I had to include a newline (",\n")
after each data to be able to see where the error actually was.

b) The real error is due to high numbers being written as floats, in
exponential format (1.22e+06, for example). So, when the number of points,
faces or whatever is very large, this leads to problems, as this number
needs to be an integer.

I solved this replacing "xRes*zRes" with "str(xRes*zRes,0,0)" and similarly
for "(xRes-1)*(zRes-1)*2" in the macro HFCreate_().

Still, there's a problem when the size is too large, the vertex indices are
too large too, so the way the face_indices are written should be changed
too. I replaced "F1+A" with:
  "<",str((F1+A).x,0,0),",",str((F1+A).y,0,0),",",str((F1+A).z,0,0),">"
and "F2+A" accordingly.

I think these changes are enough (and harmless).

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

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