https://github.com/megaprog/bresenhamline
Bresenham’s line drawing algorithm implementation in 2D and 3D dimensions
https://github.com/megaprog/bresenhamline
Last synced: 10 months ago
JSON representation
Bresenham’s line drawing algorithm implementation in 2D and 3D dimensions
- Host: GitHub
- URL: https://github.com/megaprog/bresenhamline
- Owner: Megaprog
- Created: 2014-03-20T07:35:11.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2014-11-07T19:12:45.000Z (over 11 years ago)
- Last Synced: 2025-07-08T13:52:32.735Z (11 months ago)
- Language: Java
- Size: 219 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
BresenhamLine
=============
Bresenham’s line drawing algorithm implementation in 2D and 3D dimensions.
## How to get it?
You can download the latest build at:
https://github.com/Megaprog/BresenhamLine/releases
Or use it as a maven dependency:
```xml
org.jmmo
bresenham-line
1.0
```
## How to use it?
import org.jmmo.bresenham_line.BresenhamLine;
import org.jmmo.bresenham_line.PointHandler3D;
public class Example {
public static void main(String[] args) {
new BresenhamLine().processLine3D(1, 9, 8, 14, 6, 19, new PointHandler3D() {
@Override
public Void handlePoint(int x, int y, int z) {
System.out.println("x=" + x + ", y=" + y + ", z=" + z);
return null;
}
});
}
}
The output is:
x=1, y=9, z=8
x=2, y=9, z=9
x=3, y=9, z=10
x=4, y=8, z=11
x=5, y=8, z=11
x=6, y=8, z=12
x=7, y=8, z=13
x=8, y=7, z=14
x=9, y=7, z=15
x=10, y=7, z=16
x=11, y=7, z=16
x=12, y=6, z=17
x=13, y=6, z=18
x=14, y=6, z=19