ios - swift- get exc_bad_instruction (code=exc_i386_invop, subcode=0x0) with array value replacement in while loop -


i making note writing app. in app turning lines bezier curve. @ moment getting error when try put new values matrix defined outside of while loop. have tried expression when put dummy variable , works in loop. when use format replacing value of 2 dimensions variable works outside loop, however, when both actions in loop not work.

//: playground - noun: place people can play  import uikit   var x2 = 6.0 var y2 = 5.0 var x1 = 1.0 var y1 = 1.0  var p1x = 2.0 var p1y = 3.0  var b = 6.5 var ba = 2.2 var percentall = ba/b  var yall = 5.0 var xall = 1.0 var = 4.0 var c = 5.0 var ct = 0.0 var @ = 0.0 var aall = int(a) * 10 var call = int(c) * 10   var thelistx = [[double]](count: call, repeatedvalue: [double](count: call, repeatedvalue: 0.0 )) var thelisty = array(count: aall, repeatedvalue: array(count: call, repeatedvalue: 0.0 ))   var theat = 0 var thect = 0   while @ <= {     var apercent = percentall * @     var aend = y1 + @     var yslope = (a - at) * percentall + aend     var lefty = (yslope - apercent) * percentall + apercent     var righty = ( y2 - yslope) * percentall + yslope     while ct <= c {         var cpercent = percentall * ct         var cend = x2 - ct         var xslope = (c - ct) * percentall + cend         var leftx = (xslope - x1) * percentall + x1         var rightx = (x2 - xslope) * percentall + xslope          thelistx [theat] [thect] = (rightx - leftx) * percentall + left  *********************execution interrupted, reason exc_bad_instruction (code=exc_i386_invop, subcode=0x0) ***************          thelisty [theat] [thect] = (righty - lefty) * percentall + lefty          ct +=  0.1         thect += 1     }     @ = @ + 0.1     theat += 1 } 

the console shows error is:

fatal error: index out of range

you're going out of bounds thelistx [theat] [thect]

changing while ct < c ct < c - 1 keeps calls in bounds of array.


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -