How to draw a line using y = mx +b in java?

前端 未结 3 1167
北恋
北恋 2021-01-29 01:45

So I have a program that solves a system of linear equations, but that is not relevant. So what happens is that my program pass two linear equations in the form of: y = mx +b. I

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-29 02:02

    When you draw a line in code, you need to draw from point A to point B. (a line segment)

    Pick a point A to start the line from, then draw from A to (A.X + dx, A.Y + m * dx), where dx is the desired width of the line.

    For example, you may want A to be one corner of your area, and dx to be the width of the area.

提交回复
热议问题