Iterators

Bresenham’s line drawing algorithm implementation in 2D and 3D dimensions

License

License

GroupId

GroupId

org.jmmo
ArtifactId

ArtifactId

bresenham-line
Last Version

Last Version

1.0
Release Date

Release Date

Type

Type

jar
Description

Description

Iterators
Bresenham’s line drawing algorithm implementation in 2D and 3D dimensions
Project URL

Project URL

https://github.com/Megaprog/BresenhamLine
Source Code Management

Source Code Management

https://github.com/Megaprog/BresenhamLine

Download bresenham-line

How to add to project

<!-- https://jarcasting.com/artifacts/org.jmmo/bresenham-line/ -->
<dependency>
    <groupId>org.jmmo</groupId>
    <artifactId>bresenham-line</artifactId>
    <version>1.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.jmmo/bresenham-line/
implementation 'org.jmmo:bresenham-line:1.0'
// https://jarcasting.com/artifacts/org.jmmo/bresenham-line/
implementation ("org.jmmo:bresenham-line:1.0")
'org.jmmo:bresenham-line:jar:1.0'
<dependency org="org.jmmo" name="bresenham-line" rev="1.0">
  <artifact name="bresenham-line" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.jmmo', module='bresenham-line', version='1.0')
)
libraryDependencies += "org.jmmo" % "bresenham-line" % "1.0"
[org.jmmo/bresenham-line "1.0"]

Dependencies

test (1)

Group / Artifact Type Version
junit : junit jar 4.11

Project Modules

There are no modules declared in this project.

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:

<dependency>
    <groupId>org.jmmo</groupId>
    <artifactId>bresenham-line</artifactId>
    <version>1.0</version>
</dependency>

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<Void>() {
            @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

Versions

Version
1.0