Octave/MATLABは初めてです。三角形の単純なスキャンラインの塗りつぶしをベクトル化したいと思います。これが私が排除したいwhileループです:
#Iterate over all the scan lines from bottom to top
while(yCurr <= 200)
#VARIABLES:
# img - Zero matrix used as an image. Zero is black. Assume 320x200 pixels.
# leftIdx - Vector that contains the left-most pixel to fill in each
# scanline. Dim is 1x200. Each element represents x-coord of a pixel.
# rightIdx - Vector that contains the right-most pixel to fill in each
# scanline. Dim is also 1x200. Each element represents x-coord of a pixel.
# yCurr - The current row being scanned.
#Fill all the pixels in one scan line
img(leftIdx(yCurr) : rightIdx(yCurr), yCurr) = color;
#Increment the row
yCurr++;
endwhile