LineRenderer
Date: 2019-10-22

org.jmol.g3d

## Class LineRenderer

- java.lang.Object
- - org.jmol.g3d.PrecisionRenderer
  - - org.jmol.g3d.LineRenderer

-     final class LineRenderer
      extends PrecisionRenderer

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private Graphics3D` | `g3d`
    `private javajs.util.BS` | `lineBits`
    `private java.util.Map<java.lang.Float,javajs.util.BS>` | `lineCache`
    `private boolean` | `lineTypeX`
    `private int` | `nBits`
    `private Shader` | `shader`
    `private float` | `slope`
    `private java.lang.Float` | `slopeKey`
    `private static int` | `VISIBILITY_CLIPPED`
    `private static int` | `VISIBILITY_OFFSCREEN`
    `private static int` | `VISIBILITY_UNCLIPPED`
    `private int` | `x1t`
    `private int` | `x2t`
    `private int` | `y1t`
    `private int` | `y2t`
    `private int` | `z1t`
    `private int` | `z2t`

    - ### Fields inherited from class org.jmol.g3d.PrecisionRenderer

      `a, b, isOrthographic`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LineRenderer(Graphics3D g3d)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `(package private) void` | `clearLineCache()`
    `private int` | `getTrimmedLineImpl()` Cohen-Sutherland line clipping used to check visibility.
    `(package private) void` | `plotLineBits(int argbA, int argbB, javajs.util.P3i ptA, javajs.util.P3i ptB, int run, int rise, boolean andClip)`
    `private void` | `plotLineClippedOld(int argb1, int argb2, int x, int y, int z, int dx, int dy, int dz, boolean clipped, int run, int rise)` low-resolution linear z-buffer (old style)
    `(package private) void` | `plotLineDeltaABitsFloat(int[] shades1, int[] shades2, int shadeIndex, javajs.util.P3 ptA, javajs.util.P3 ptB, int screenMask, boolean clipped)`
    `(package private) void` | `plotLineDeltaABitsInt(int[] shades1, int[] shades2, int shadeIndex, javajs.util.P3i ptA, javajs.util.P3i ptB, int screenMask, boolean clipped)`
    `(package private) void` | `plotLineDeltaAOld(int[] shades1, int[] shades2, int screenMask, int shadeIndex, int x, int y, int z, int dx, int dy, int dz, boolean clipped)` low-precision old-style linear z, even in perspective mode
    `(package private) void` | `plotLineDeltaOld(int argbA, int argbB, int xA, int yA, int zA, int dxBA, int dyBA, int dzBA, boolean clipped)` low-resolution linear z
    `(package private) void` | `plotLineOld(int argbA, int argbB, int xA, int yA, int zA, int xB, int yB, int zB)`
    `(package private) void` | `setLineBits(float dx, float dy)`

    - ### Methods inherited from class org.jmol.g3d.PrecisionRenderer

      `getZCurrent, setRastAB, setRastABFloat`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### g3d

          private final Graphics3D g3d

    - #### shader

          private final Shader shader

    - #### lineBits

          private javajs.util.BS lineBits

    - #### slope

          private float slope

    - #### lineTypeX

          private boolean lineTypeX

    - #### nBits

          private int nBits

    - #### lineCache

          private java.util.Map<java.lang.Float,javajs.util.BS> lineCache

    - #### slopeKey

          private java.lang.Float slopeKey

    - #### VISIBILITY_UNCLIPPED

          private static final int VISIBILITY_UNCLIPPED

      See Also:
        Constant Field Values

    - #### VISIBILITY_CLIPPED

          private static final int VISIBILITY_CLIPPED

      See Also:
        Constant Field Values

    - #### VISIBILITY_OFFSCREEN

          private static final int VISIBILITY_OFFSCREEN

      See Also:
        Constant Field Values

    - #### x1t

          private int x1t

    - #### y1t

          private int y1t

    - #### z1t

          private int z1t

    - #### x2t

          private int x2t

    - #### y2t

          private int y2t

    - #### z2t

          private int z2t

  - ### Constructor Detail

    - #### LineRenderer

          LineRenderer(Graphics3D g3d)

  - ### Method Detail

    - #### setLineBits

          void setLineBits(float dx,
                           float dy)

    - #### clearLineCache

          void clearLineCache()

    - #### plotLineOld

          void plotLineOld(int argbA,
                           int argbB,
                           int xA,
                           int yA,
                           int zA,
                           int xB,
                           int yB,
                           int zB)

    - #### plotLineDeltaOld

          void plotLineDeltaOld(int argbA,
                                int argbB,
                                int xA,
                                int yA,
                                int zA,
                                int dxBA,
                                int dyBA,
                                int dzBA,
                                boolean clipped)

      low-resolution linear z
      Parameters:
        `argbA` -
        `argbB` -
        `xA` -
        `yA` -
        `zA` -
        `dxBA` -
        `dyBA` -
        `dzBA` -
        `clipped` -

    - #### plotLineDeltaAOld

          void plotLineDeltaAOld(int[] shades1,
                                 int[] shades2,
                                 int screenMask,
                                 int shadeIndex,
                                 int x,
                                 int y,
                                 int z,
                                 int dx,
                                 int dy,
                                 int dz,
                                 boolean clipped)

      low-precision old-style linear z, even in perspective mode
      Parameters:
        `shades1` -
        `shades2` -
        `screenMask` -
        `shadeIndex` -
        `x` -
        `y` -
        `z` -
        `dx` -
        `dy` -
        `dz` -
        `clipped` -

    - #### plotLineDeltaABitsFloat

          void plotLineDeltaABitsFloat(int[] shades1,
                                       int[] shades2,
                                       int shadeIndex,
                                       javajs.util.P3 ptA,
                                       javajs.util.P3 ptB,
                                       int screenMask,
                                       boolean clipped)

    - #### plotLineDeltaABitsInt

          void plotLineDeltaABitsInt(int[] shades1,
                                     int[] shades2,
                                     int shadeIndex,
                                     javajs.util.P3i ptA,
                                     javajs.util.P3i ptB,
                                     int screenMask,
                                     boolean clipped)

    - #### plotLineBits

          void plotLineBits(int argbA,
                            int argbB,
                            javajs.util.P3i ptA,
                            javajs.util.P3i ptB,
                            int run,
                            int rise,
                            boolean andClip)

    - #### getTrimmedLineImpl

          private int getTrimmedLineImpl()

      Cohen-Sutherland line clipping used to check visibility.

      Note that this routine is only used for visibility checking. To avoid integer rounding errors which cause cracking to occur in 'solid' surfaces, the lines are actually drawn from their original end-points. The nuance is that this algorithm doesn't just deliver a boolean. It delivers the trimmed line. Although we need to start the raster loop at the origin for good surfaces, we can save lots of time by saving the known endpoints as globals variables. -- Bob Hanson 7/06

      Returns:
        Visibility (see VISIBILITY_... constants);

    - #### plotLineClippedOld

          private void plotLineClippedOld(int argb1,
                                          int argb2,
                                          int x,
                                          int y,
                                          int z,
                                          int dx,
                                          int dy,
                                          int dz,
                                          boolean clipped,
                                          int run,
                                          int rise)

      low-resolution linear z-buffer (old style)
      Parameters:
        `argb1` -
        `argb2` -
        `x` -
        `y` -
        `z` -
        `dx` -
        `dy` -
        `dz` -
        `clipped` -
        `run` -
        `rise` -