SphereRenderer
Date: 2019-10-22

org.jmol.g3d

## Class SphereRenderer

- java.lang.Object
- - org.jmol.g3d.SphereRenderer

-     public class SphereRenderer
      extends java.lang.Object

  Implements high performance rendering of shaded spheres.

  Drawing spheres quickly is critically important to Jmol. These routines implement high performance rendering of spheres in 3D.

  If you can think of a faster way to implement this, please let us know.

  There is a lot of bit-twiddling going on here, which may make the code difficult to understand for non-systems programmers.

  Ellipsoid code added 4/2008 -- Bob Hanson hansonr@stolaf.edu
  Author:
    Miguel, miguel@jmol.org

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private double[]` | `coef`
    `private int` | `depth`
    `private float[][]` | `dxyz`
    `private Graphics3D` | `g3d`
    `private int` | `height`
    `private javajs.util.M3` | `mat`
    `private static int` | `maxOddSizeSphere`
    `(package private) static int` | `maxSphereDiameter`
    `(package private) static int` | `maxSphereDiameter2`
    `private javajs.util.M4` | `mDeriv`
    `private int` | `offsetPbufBeginLine`
    `private int` | `planeShade`
    `private int[]` | `planeShades`
    `private javajs.util.P3` | `ptTemp`
    `private int` | `selectedOctant`
    `private static int` | `SHADE_SLAB_CLIPPED`
    `private Shader` | `shader`
    `private int` | `slab`
    `private int` | `width`
    `private int[]` | `zbuf`
    `private double[]` | `zroot`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SphereRenderer(Graphics3D g3d)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `(package private) void` | `render(int[] shades, int diameter, int x, int y, int z, javajs.util.M3 mat, double[] coef, javajs.util.M4 mDeriv, int selectedOctant, javajs.util.P3[] octantPoints)`
    `private void` | `renderQuadrant(int xSign, int ySign, int x, int y, int z, int diameter, int[] shades)`
    `private void` | `renderQuadrantClipped(int radius, int xSign, int ySign, int x, int y, int z, int[] shades)`
    `private void` | `renderQuadrantUnclipped(int radius, int xSign, int ySign, int z, int[] s)`
    `private void` | `renderSphereClipped(int[] sphereShape, int x, int y, int z, int diameter, int[] shades)`
    `private void` | `renderSphereUnclipped(int[] sphereShape, int z, int diameter, int[] shades)`

    - ### 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

    - #### maxOddSizeSphere

          private static final int maxOddSizeSphere

      See Also:
        Constant Field Values

    - #### maxSphereDiameter

          static final int maxSphereDiameter

      See Also:
        Constant Field Values

    - #### maxSphereDiameter2

          static final int maxSphereDiameter2

      See Also:
        Constant Field Values

    - #### zroot

          private double[] zroot

    - #### mat

          private javajs.util.M3 mat

    - #### coef

          private double[] coef

    - #### mDeriv

          private javajs.util.M4 mDeriv

    - #### selectedOctant

          private int selectedOctant

    - #### planeShade

          private int planeShade

    - #### zbuf

          private int[] zbuf

    - #### width

          private int width

    - #### height

          private int height

    - #### depth

          private int depth

    - #### slab

          private int slab

    - #### offsetPbufBeginLine

          private int offsetPbufBeginLine

    - #### SHADE_SLAB_CLIPPED

          private static final int SHADE_SLAB_CLIPPED

      See Also:
        Constant Field Values

    - #### ptTemp

          private final javajs.util.P3 ptTemp

    - #### planeShades

          private final int[] planeShades

    - #### dxyz

          private final float[][] dxyz

  - ### Constructor Detail

    - #### SphereRenderer

          SphereRenderer(Graphics3D g3d)

  - ### Method Detail

    - #### render

          void render(int[] shades,
                      int diameter,
                      int x,
                      int y,
                      int z,
                      javajs.util.M3 mat,
                      double[] coef,
                      javajs.util.M4 mDeriv,
                      int selectedOctant,
                      javajs.util.P3[] octantPoints)

    - #### renderSphereUnclipped

          private void renderSphereUnclipped(int[] sphereShape,
                                             int z,
                                             int diameter,
                                             int[] shades)

    - #### renderSphereClipped

          private void renderSphereClipped(int[] sphereShape,
                                           int x,
                                           int y,
                                           int z,
                                           int diameter,
                                           int[] shades)

    - #### renderQuadrant

          private void renderQuadrant(int xSign,
                                      int ySign,
                                      int x,
                                      int y,
                                      int z,
                                      int diameter,
                                      int[] shades)

    - #### renderQuadrantUnclipped

          private void renderQuadrantUnclipped(int radius,
                                               int xSign,
                                               int ySign,
                                               int z,
                                               int[] s)

    - #### renderQuadrantClipped

          private void renderQuadrantClipped(int radius,
                                             int xSign,
                                             int ySign,
                                             int x,
                                             int y,
                                             int z,
                                             int[] shades)