POV-Ray : Newsgroups : povray.beta-test : Reverse_Array Bug : Reverse_Array Bug Server Time
4 Nov 2024 13:45:35 EST (-0500)
  Reverse_Array Bug  
From: Martial
Date: 29 Sep 2001 10:27:06
Message: <3bb5da3a@news.povray.org>
in array.inc
//--------------------------------------
#macro Reverse_Array(Array)
    #local J = 0;
    #local N = dimension_size(Array, 1);
    #while(J < floor(N/2))
        #local Temp = Array[J]
        #local Array[J] = Array[N-J]  //<-- subscipt out of range
        #local Array[N-J] = Temp  //<-- subscipt out of range
        #local J = J + 1;
    #end
#end

//-----REVISION-------------------------------- 

#macro Reverse_Array(Array)
    #local J = 0;
    #local N = dimension_size(Array, 1);
    #while(J < floor(N/2))
        #local Temp = Array[J]
        #local Array[J] = Array[N-J-1] //<---Correction--
        #local Array[N-J-1] = Temp //<-----Correction--
        #local J = J + 1;
    #end
#end
//--------------------------------------------------------
-- 
Martial
http://martial.rameaux.free.fr
http://www.cathemline.org


Post a reply to this message

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