Class Segment2ai.BresenhamLineIterator<P extends Point2D<? super P,​? super V>,​V extends Vector2D<? super V,​? super P>>

  • Type Parameters:
    P - the type of the points.
    V - the type of the vectors.
    All Implemented Interfaces:
    Iterator<P>
    Enclosing interface:
    Segment2ai<ST extends Shape2ai<?,​?,​IE,​P,​V,​B>,​IT extends Segment2ai<?,​?,​IE,​P,​V,​B>,​IE extends PathElement2ai,​P extends Point2D<? super P,​? super V>,​V extends Vector2D<? super V,​? super P>,​B extends Rectangle2ai<?,​?,​IE,​P,​V,​B>>

    public static class Segment2ai.BresenhamLineIterator<P extends Point2D<? super P,​? super V>,​V extends Vector2D<? super V,​? super P>>
    extends Object
    implements Iterator<P>
    The Bresenham line algorithm is an algorithm which determines which points in an n-dimensional raster should be plotted in order to form a close approximation to a straight line between two given points. It is commonly used to draw lines on a computer screen, as it uses only integer addition, subtraction and bit shifting, all of which are very cheap operations in standard computer architectures. It is one of the earliest algorithms developed in the field of computer graphics. A minor extension to the original algorithm also deals with drawing circles.

    While algorithms such as Wu's algorithm are also frequently used in modern computer graphics because they can support antialiasing, the speed and simplicity of Bresenham's line algorithm mean that it is still important. The algorithm is used in hardware such as plotters and in the graphics chips of modern graphics cards. It can also be found in many software graphics libraries. Because the algorithm is very simple, it is often implemented in either the firmware or the hardware of modern graphics cards.

    Since:
    13.0
    Version:
    17.0 2020-01-04 14:41:43
    Author:
    Stéphane GALLAND
    Maven Group Id:
    org.arakhne.afc.core
    Maven Artifact Id:
    mathgeom
    • Constructor Detail

      • BresenhamLineIterator

        public BresenhamLineIterator​(GeomFactory2D<V,​P> factory,
                                     int x0,
                                     int y0,
                                     int x1,
                                     int y1)
        Constructor.
        Parameters:
        factory - the point factory.
        x0 - is the x-coordinate of the first point of the Bresenham line.
        y0 - is the y-coordinate of the first point of the Bresenham line.
        x1 - is the x-coordinate of the last point of the Bresenham line.
        y1 - is the y-coordinate of the last point of the Bresenham line.
    • Method Detail

      • hasNext

        @Pure
        public boolean hasNext()
        Specified by:
        hasNext in interface Iterator<P extends Point2D<? super P,​? super V>>
      • next

        public void next​(Point2D<?,​?> pt)
        Replies the next point in the given parameter.
        Parameters:
        pt - the output point.
      • next

        @Pure
        public P next()
        Specified by:
        next in interface Iterator<P extends Point2D<? super P,​? super V>>