Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

Java algorithm for drawing a line

    public final void drawLine(double x1, double y1, double x2, double y2) {
        for (double x = x1; x < x2; x++) {
            set(x, y1 + (y2 - y1) * (x - x1) / (x2 - x1));
        }
    }
 
PREVIOUS NEXT
Tagged: #Java #algorithm #drawing #line
ADD COMMENT
Topic
Name
1+1 =