问题
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