POV-Ray : Newsgroups : povray.text.scene-files : POVEarth: once more mesh2writer.pov : Re: POVEarth: once more mesh2writer.pov Server Time
5 Oct 2024 14:21:23 EDT (-0400)
  Re: POVEarth: once more mesh2writer.pov  
From: Alain Martel
Date: 4 Aug 2020 13:33:43
Message: <5f299bf7$1@news.povray.org>


> 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
> 
> 
Arghhh! That DO hurt !
That kind of array indexing gymnastic is only acceptable if you are 
using a language that don't support multidimensional arrays.


Alain


Post a reply to this message

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