dda

Digital Diferential Analizer Dotted Line

旧巷老猫 提交于 2019-12-01 21:31:43
问题 Im using de DDA (Digital Diferential Analizer) to make a line, and thought I know maybe using de DrawLine the way I am, just run along with it. Im trying to make different types of lines like dashed or dotted, etc. Im thinking in makeing the for from below jump some numbers to make a dotted line. But I cant still find a way todo it. This is what I have so far: public void paint(Graphics g) { super.paint(g); int dot=0; int x1 = pointStart.x; int x2 = pointEnd.x; int y1 = pointStart.y; int y2 =

Digital Diferential Analizer Dotted Line

社会主义新天地 提交于 2019-12-01 19:48:50
Im using de DDA (Digital Diferential Analizer) to make a line, and thought I know maybe using de DrawLine the way I am, just run along with it. Im trying to make different types of lines like dashed or dotted, etc. Im thinking in makeing the for from below jump some numbers to make a dotted line. But I cant still find a way todo it. This is what I have so far: public void paint(Graphics g) { super.paint(g); int dot=0; int x1 = pointStart.x; int x2 = pointEnd.x; int y1 = pointStart.y; int y2 = pointEnd.y; float dx, dy, m, y, x; if (x1>x2){ int ax = x2; int ay = y2; x2 = x1; x1 = ax; y2 = y1; y1