Sketch a line in NetLogo From it's coefficents

夙愿已清 提交于 2019-12-13 17:32:57

问题


How can a draw a line in NetLogo given in the following form:

                                    Ax+By+C=0

That is, A , B and C are given.

CODE:

    to make-line[a]; a is list containing A, B and C and in that order.
    let x 0
    let y((-item 2 A) / item 1 A)
    let y1 0
    let x1((-item 2 A) / item 0 A)
    crt 1[
      set size 0.5 setxy x y
      pen-down
      facexy x1 y1
      while [distancexy x1 y1 > 0.5]
          [
           fd 0.1
          ]
         ]
     end

PROBLEM: The points tend to be outside the NetLogo boundaries many a lines.

Given the coefficients of a line, is there a way to draw one using any extensions or library functions directly

来源:https://stackoverflow.com/questions/27632521/sketch-a-line-in-netlogo-from-its-coefficents

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!