Class Segment3ai.BresenhamLineIterator<P extends Point3D<? super P,​? super V>,​V extends Vector3D<? 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:
    Segment3ai<ST extends Shape3ai<?,​?,​IE,​P,​V,​B>,​IT extends Segment3ai<?,​?,​IE,​P,​V,​B>,​IE extends PathElement3ai,​P extends Point3D<? super P,​? super V>,​V extends Vector3D<? super V,​? super P>,​B extends RectangularPrism3ai<?,​?,​IE,​P,​V,​B>>

    public static class Segment3ai.BresenhamLineIterator<P extends Point3D<? super P,​? super V>,​V extends Vector3D<? 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​(GeomFactory3D<V,​P> factory,
                                     int x0,
                                     int y0,
                                     int z0,
                                     int x1,
                                     int y1,
                                     int z1)
        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.
        z0 - is the z-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.
        z1 - is the z-coordinate of the last point of the Bresenham line.
    • Method Detail

      • hasNext

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

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

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