Beispiel #1
0
 private void calcArgbEndcap(boolean tCylinder) {
   tEndcapOpen = false;
   if ((endcaps == Graphics3D.ENDCAPS_SPHERICAL) || (dzB == 0)) return;
   xEndcap = xA;
   yEndcap = yA;
   zEndcap = zA;
   int[] shadesEndcap;
   if (dzB >= 0 || !tCylinder) {
     intensityEndcap = Shade3D.calcIntensity(-dxB, -dyB, dzB);
     colixEndcap = colixA;
     shadesEndcap = shadesA;
     // Logger.debug("endcap is A");
   } else {
     intensityEndcap = Shade3D.calcIntensity(dxB, dyB, -dzB);
     colixEndcap = colixB;
     shadesEndcap = shadesB;
     xEndcap += dxB;
     yEndcap += dyB;
     zEndcap += dzB;
     // Logger.debug("endcap is B");
   }
   // limit specular glare on endcap
   if (intensityEndcap > Graphics3D.intensitySpecularSurfaceLimit)
     intensityEndcap = Graphics3D.intensitySpecularSurfaceLimit;
   argbEndcap = shadesEndcap[intensityEndcap];
   tEndcapOpen = (endcaps == Graphics3D.ENDCAPS_OPEN);
 }
Beispiel #2
0
  private void calcRotatedPoint(float t, int i, boolean isPrecision) {
    tRaster[i] = t;
    double tPI = t * Math.PI;
    double xT = Math.sin(tPI) * cosTheta;
    double yT = Math.cos(tPI);
    double xR = radius * (xT * cosPhi - yT * sinPhi);
    double yR = radius * (xT * sinPhi + yT * cosPhi);
    double z2 = radius2 - (xR * xR + yR * yR);
    double zR = (z2 > 0 ? Math.sqrt(z2) : 0);

    if (isPrecision) {
      txRaster[i] = (float) xR;
      tyRaster[i] = (float) yR;
      tzRaster[i] = (float) zR;
    } else if (tEvenDiameter) {
      xRaster[i] = (int) (xR - 0.5);
      yRaster[i] = (int) (yR - 0.5);
      zRaster[i] = (int) (zR + 0.5);
    } else {
      xRaster[i] = (int) (xR);
      yRaster[i] = (int) (yR);
      zRaster[i] = (int) (zR + 0.5);
    }
    fp8IntensityUp[i] = Shade3D.calcFp8Intensity((float) xR, (float) yR, (float) zR);
  }
Beispiel #3
0
  void renderCone(
      short colix,
      byte endcap,
      int diameter,
      float xA,
      float yA,
      float zA,
      float xTip,
      float yTip,
      float zTip) {
    if (diameter > (g3d.width + g3d.height) * MAX_FIX) return;
    dxBf = (xTip) - (xAf = xA);
    dyBf = (yTip) - (yAf = yA);
    dzBf = (zTip) - (zAf = zA);
    this.xA = (int) Math.floor(xAf);
    this.yA = (int) Math.floor(yAf);
    this.zA = (int) Math.floor(zAf);
    this.dxB = (int) Math.floor(dxBf);
    this.dyB = (int) Math.floor(dyBf);
    this.dzB = (int) Math.floor(dzBf);
    this.xTip = xTip;
    this.yTip = yTip;
    this.zTip = zTip;

    colixA = colix;
    shadesA = g3d.getShades(colix);
    isScreenedA = (colixA & Graphics3D.TRANSLUCENT_MASK) != 0;
    int intensityTip = Shade3D.calcIntensity(dxB, dyB, -dzB);
    g3d.plotPixelClipped(shadesA[intensityTip], isScreenedA, (int) xTip, (int) yTip, (int) zTip);

    this.diameter = diameter;
    if (diameter <= 1) {
      if (diameter == 1)
        line3d.plotLineDelta(
            colixA,
            isScreenedA,
            colixA,
            isScreenedA,
            this.xA,
            this.yA,
            this.zA,
            dxB,
            dyB,
            dzB,
            notClipped);
      return;
    }
    // float r2 = dxB*dxB + dyB*dyB + dzB*dzB;
    // System.out.println(r2);
    this.endcaps = endcap;
    calcArgbEndcap(false);
    generateBaseEllipsePrecisely();
    if (endcaps == Graphics3D.ENDCAPS_FLAT) renderFlatEndcap(false);
    for (int i = rasterCount; --i >= 0; ) plotRasterCone(i);
  }
Beispiel #4
0
 public static int[] getShades(short colix) {
   int[] shades = ashades[colix];
   if (shades == null) shades = ashades[colix] = Shade3D.getShades(argbs[colix]);
   return shades;
 }