POV-Ray : Newsgroups : povray.text.scene-files : POVEarth: once more mesh2writer.pov : Re: POVEarth: once more mesh2writer.pov Server Time
26 Apr 2024 23:17:34 EDT (-0400)
  Re: POVEarth: once more mesh2writer.pov  
From: Tor Olav Kristensen
Date: 3 Aug 2020 14:35:00
Message: <web.5f2857d367d51b0cdf8360b40@news.povray.org>
=?UTF-8?Q?J=c3=b6rg_=22Yadgar=22_Bleimann?= <yaz### [at] gmxde> wrote:
> Hi(gh)!
>
> By request in the process of debugging, here the current version of the
> script file mentioned in the subject:
>
> // begin of code
> ...
> // end of code

Yadgar,

Your array V_vec_Arr is a 1 dimensional array.
But it seems like you are using it as if it was a 2 dimensional array.

If so, then you could have defined and used it like this:

#declare V_vec_Arr = array[ydim][xdim];
V_vec_Arr[a][b]

- but instead you seem to define and use it like this:

#declare V_vec_Arr = array[ydim*xdim];
V_vec_Arr[a*xdim + b]

This makes the indexing more awkward and error prone than it needs to be.

E.g.:

You have several lines that look somewhat like this:

#declare nno =
    nno +
    vcross(
        V_vec_Arr[(a + 1)*ydim + (b - 1)] - V_vec_Arr[(a + 1)*xdim + b],
        V_vec_Arr[                b     ] - V_vec_Arr[(a + 1)*xdim + b]
    )
;

- where the "*ydim" part seems wrong to me.

And then you have a line like this:

#if (a > 0 & a < ydim - 1 & b = ydim - 1) // rightmost column except lower

- where I suspect that "b = ydim - 1" should be "b = xdim - 1".

If these are bugs, they will probably not bite you until xdim becomes different
from ydim.

So I suggest that you do your array indexing in a different way.

--
Tor Olav
http://subcube.com
https://github.com/t-o-k


Post a reply to this message

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