Java 类javax.vecmath.Point3i 实例源码

项目:PhET    文件:Graphics3D.java   
public void fillEllipsoid(Point3f center, Point3f[] points, int x, int y,
                            int z, int diameter, Matrix3f mToEllipsoidal,
                            double[] coef, Matrix4f mDeriv,
                            int selectedOctant, Point3i[] octantPoints) {
  switch (diameter) {
  case 1:
    plotPixelClipped(argbCurrent, x, y, z);
    return;
  case 0:
    return;
  }
  if (diameter <= (antialiasThisFrame ? Sphere3D.maxSphereDiameter2
      : Sphere3D.maxSphereDiameter))
    sphere3d.render(shadesCurrent, !addAllPixels, diameter, x, y, z,
        mToEllipsoidal, coef, mDeriv, selectedOctant, octantPoints);
}
项目:PhET    文件:Graphics3D.java   
public void drawTriangle(Point3i screenA, Point3i screenB, Point3i screenC,
                         int check) {
  // primary method for unmapped monochromatic Mesh
  if ((check & 1) == 1)
    line3d.plotLine(argbCurrent, !addAllPixels, argbCurrent, !addAllPixels,
        screenA.x, screenA.y, screenA.z, screenB.x, screenB.y, screenB.z,
        true);
  if ((check & 2) == 2)
    line3d.plotLine(argbCurrent, !addAllPixels, argbCurrent, !addAllPixels,
        screenB.x, screenB.y, screenB.z, screenC.x, screenC.y, screenC.z,
        true);
  if ((check & 4) == 4)
    line3d.plotLine(argbCurrent, !addAllPixels, argbCurrent, !addAllPixels,
        screenA.x, screenA.y, screenA.z, screenC.x, screenC.y, screenC.z,
        true);
}
项目:PhET    文件:Graphics3D.java   
public void fillTriangle(Point3i screenA, short colixA,
                                 short normixA, Point3i screenB,
                                 short colixB, short normixB,
                                 Point3i screenC, short colixC,
                                 short normixC, float factor) {
  // isosurface test showing triangles
  boolean useGouraud;
  if (!isPass2 && normixA == normixB && normixA == normixC && colixA == colixB
      && colixA == colixC) {
    setTriangleColixAndShadeIndex(colixA, normix3d.getShadeIndex(normixA));
    useGouraud = false;
  } else {
    if (!setTriangleTranslucency(colixA, colixB, colixC))
      return;
    triangle3d.setGouraud(getShades(colixA)[normix3d.getShadeIndex(normixA)],
        getShades(colixB)[normix3d.getShadeIndex(normixB)],
        getShades(colixC)[normix3d.getShadeIndex(normixC)]);
    useGouraud = true;
  }
  triangle3d.fillTriangle(screenA, screenB, screenC, factor,
      useGouraud);
}
项目:PhET    文件:Graphics3D.java   
public void fillTriangle(Point3i screenA, short colixA, short normixA,
                         Point3i screenB, short colixB, short normixB,
                         Point3i screenC, short colixC, short normixC) {
  // mesh, isosurface
  boolean useGouraud;
  if (!isPass2 && normixA == normixB && normixA == normixC &&
      colixA == colixB && colixA == colixC) {
    setTriangleColixAndShadeIndex(colixA, normix3d.getShadeIndex(normixA));
    useGouraud = false;
  } else {
    if (!setTriangleTranslucency(colixA, colixB, colixC))
      return;
    triangle3d.setGouraud(getShades(colixA)[normix3d.getShadeIndex(normixA)],
                          getShades(colixB)[normix3d.getShadeIndex(normixB)],
                          getShades(colixC)[normix3d.getShadeIndex(normixC)]);
    useGouraud = true;
  }
  triangle3d.fillTriangle(screenA, screenB, screenC, useGouraud);
}
项目:PhET    文件:Graphics3D.java   
/**
 *  used by CartoonRenderer (DNA surface) and GeoSurfaceRenderer (face) to
 *  assign a noisy shade to the surface it will render
 * @param screenA 
 * @param screenB 
 * @param screenC 
 */
public void setNoisySurfaceShade(Point3i screenA, Point3i screenB, Point3i screenC) {
  vectorAB.set(screenB.x - screenA.x, screenB.y - screenA.y, screenB.z
      - screenA.z);
  int shadeIndex;
  if (screenC == null) {
    shadeIndex = Shade3D.getShadeIndex(-vectorAB.x, -vectorAB.y, vectorAB.z);
  } else {
    vectorAC.set(screenC.x - screenA.x, screenC.y - screenA.y, screenC.z
        - screenA.z);
    vectorAB.cross(vectorAB, vectorAC);
    shadeIndex = vectorAB.z >= 0 ? Shade3D.getShadeIndex(-vectorAB.x,
        -vectorAB.y, vectorAB.z) : Shade3D.getShadeIndex(vectorAB.x,
        vectorAB.y, -vectorAB.z);
  }
  if (shadeIndex > Shade3D.shadeIndexNoisyLimit)
    shadeIndex = Shade3D.shadeIndexNoisyLimit;
  setColorNoisy(shadeIndex);
}
项目:PhET    文件:Triangle3D.java   
void fillTriangle(Point3i screenA, Point3i screenB, Point3i screenC,
                  float factor, boolean useGouraud) {
  ax[0] = screenA.x;
  ax[1] = screenB.x;
  ax[2] = screenC.x;
  ay[0] = screenA.y;
  ay[1] = screenB.y;
  ay[2] = screenC.y;
  az[0] = screenA.z;
  az[1] = screenB.z;
  az[2] = screenC.z;
  adjustVertex(ax, factor);
  adjustVertex(ay, factor);
  adjustVertex(az, factor);
  fillTriangle(useGouraud);
}
项目:PhET    文件:HallInfo.java   
private String extractVectorInfo(String name) {
  // (nx ny nz)  where n is 1/12 of the edge. 
  // also allows for (nz), though that is not standard
  vector12ths = new Point3i();
  vectorCode = "";
  int i = name.indexOf("(");
  int j = name.indexOf(")", i);
  if (i > 0 && j > i) {
    String term = name.substring(i + 1, j);
    vectorCode = " (" + term + ")";
    name = name.substring(0, i).trim();
    i = term.indexOf(" ");
    if (i >= 0) {
      vector12ths.x = Integer.parseInt(term.substring(0, i));
      term = term.substring(i + 1).trim();
      i = term.indexOf(" ");
      if (i >= 0) {
        vector12ths.y = Integer.parseInt(term.substring(0, i));
        term = term.substring(i + 1).trim();
      }
    }
    vector12ths.z = Integer.parseInt(term);
  }
  return name;
}
项目:PhET    文件:UnitCell.java   
void setMinMaxLatticeParameters(Point3i minXYZ, Point3i maxXYZ) {
  if (maxXYZ.x <= 555 && maxXYZ.y >= 555) {
    //alternative format for indicating a range of cells:
    //{111 666}
    //555 --> {0 0 0}
    minXYZ.x = (maxXYZ.x / 100) - 5;
    minXYZ.y = (maxXYZ.x % 100) / 10 - 5;
    minXYZ.z = (maxXYZ.x % 10) - 5;
    //555 --> {1 1 1}
    maxXYZ.x = (maxXYZ.y / 100) - 4;
    maxXYZ.z = (maxXYZ.y % 10) - 4;
    maxXYZ.y = (maxXYZ.y % 100) / 10 - 4;
  }
  switch (dimension) {
  case 1: // polymer
    minXYZ.y = 0;
    maxXYZ.y = 1;
    // fall through
  case 2: // slab
    minXYZ.z = 0;
    maxXYZ.z = 1;
  }
}
项目:PhET    文件:FontLineShapeRenderer.java   
protected void renderLine(Point3f p0, Point3f p1, int diameter,
                          Point3i pt0, Point3i pt1, boolean drawTicks) {
  // used by Bbcage, Uccage, and axes
  pt0.set((int) p0.x, (int) p0.y, (int) p0.z);
  pt1.set((int) p1.x, (int) p1.y, (int) p1.z);
  if (diameter < 0)
    g3d.drawDottedLine(pt0, pt1);
  else
    g3d.fillCylinder(endcap, diameter, pt0, pt1);
  if (!drawTicks || tickInfo == null)
    return;
  // AtomA and AtomB molecular coordinates must be set previously
  atomA.screenX = pt0.x;
  atomA.screenY = pt0.y;
  atomA.screenZ = pt0.z;
  atomB.screenX = pt1.x;
  atomB.screenY = pt1.y;
  atomB.screenZ = pt1.z;
  drawTicks(atomA, atomB, diameter, true);
}
项目:PhET    文件:TransformManager.java   
private Point3i transformScreenPoint(Point3f ptXyp) {
  // just does the processing for [x y] and [x y %]
  if (ptXyp.z == -Float.MAX_VALUE) {
    point3iScreenTemp.x = (int) (ptXyp.x / 100 * screenWidth);
    point3iScreenTemp.y = (int) ((1 - ptXyp.y / 100) * screenHeight);
  } else {
    point3iScreenTemp.x = (int) ptXyp.x;
    point3iScreenTemp.y = (screenHeight - (int) ptXyp.y);
  }
  if (antialias) {
    point3iScreenTemp.x <<= 1;
    point3iScreenTemp.y <<= 1;
  }
  matrixTransform.transform(fixedRotationCenter, pointTsp);
  point3iScreenTemp.z = (int) pointTsp.z;
  return point3iScreenTemp;
}
项目:MrglgaghCore    文件:OBJModel.java   
@SideOnly(Side.CLIENT)
public void tessellate(VertexBuffer vb){
    vb.begin(GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION_TEX_NORMAL);
    for (Triple<Point3i, Point3i, Point3i> face : faces) {
        vb.pos(vertices.get(face.getLeft().x).x, vertices.get(face.getLeft().x).y, vertices.get(face.getLeft().x).z)
                .tex(uvs.get(face.getLeft().y).x, uvs.get(face.getLeft().y).y)
                .normal(normals.get(face.getLeft().z).x, normals.get(face.getLeft().z).y, normals.get(face.getLeft().z).z).endVertex();
        vb.pos(vertices.get(face.getMiddle().x).x, vertices.get(face.getMiddle().x).y, vertices.get(face.getMiddle().x).z)
                .tex(uvs.get(face.getMiddle().y).x, uvs.get(face.getMiddle().y).y)
                .normal(normals.get(face.getMiddle().z).x, normals.get(face.getMiddle().z).y, normals.get(face.getMiddle().z).z).endVertex();
        vb.pos(vertices.get(face.getRight().x).x, vertices.get(face.getRight().x).y, vertices.get(face.getRight().x).z)
                .tex(uvs.get(face.getRight().y).x, uvs.get(face.getRight().y).y)
                .normal(normals.get(face.getRight().z).x, normals.get(face.getRight().z).y, normals.get(face.getRight().z).z).endVertex();
    }
}
项目:PhET    文件:PolyhedraRenderer.java   
@Override
protected void render() {
  Polyhedra polyhedra = (Polyhedra) shape;
  Polyhedra.Polyhedron[] polyhedrons = polyhedra.polyhedrons;
  drawEdges = polyhedra.drawEdges;
  short[] colixes = polyhedra.colixes;
  Point3i[] screens = null;
  for (int i = polyhedra.polyhedronCount; --i >= 0;) {
    int iAtom = polyhedrons[i].centralAtom.getIndex();
    short colix = (colixes == null || iAtom >= colixes.length ? 
        Graphics3D.INHERIT_ALL : polyhedra.colixes[iAtom]);
    screens = render1(polyhedrons[i], colix, screens);
  }
}
项目:PhET    文件:PolyhedraRenderer.java   
private Point3i[] render1(Polyhedra.Polyhedron p, short colix, Point3i[] screens) {
  if (p.visibilityFlags == 0)
    return screens;
  colix = Graphics3D.getColixInherited(colix, p.centralAtom.getColix());
  Point3f[] vertices = p.vertices;
  byte[] planes;
  if (screens == null || screens.length < vertices.length) {
    screens = new Point3i[vertices.length];
    for (int i = vertices.length; --i >= 0;)
      screens[i] = new Point3i();
  }
  planes = p.planes;
  for (int i = vertices.length; --i >= 0;) {
    Atom atom = (vertices[i] instanceof Atom ? (Atom) vertices[i] : null);
    if (atom == null)
      viewer.transformPoint(vertices[i], screens[i]);
    else
      screens[i].set(atom.screenX, atom.screenY, atom.screenZ);
  }

  isAll = (drawEdges == Polyhedra.EDGES_ALL);
  frontOnly = (drawEdges == Polyhedra.EDGES_FRONT);

  // no edges to new points when not collapsed
  if (g3d.setColix(colix))
    for (int i = 0, j = 0; j < planes.length;)
      fillFace(p.normixes[i++], screens[planes[j++]], screens[planes[j++]],
          screens[planes[j++]]);
  if (g3d.setColix(Graphics3D.getColixTranslucent(colix, false, 0)))
  for (int i = 0, j = 0; j < planes.length;)
    drawFace(p.normixes[i++], screens[planes[j++]],
        screens[planes[j++]], screens[planes[j++]]);
  return screens;
}
项目:PhET    文件:Export3D.java   
public void drawTriangle(Point3i screenA, short colixA, Point3i screenB,
                         short colixB, Point3i screenC, short colixC,
                         int check) {
  // primary method for mapped Mesh
  if ((check & 1) == 1)
    drawLine(colixA, colixB, screenA.x, screenA.y, screenA.z, screenB.x,
        screenB.y, screenB.z);
  if ((check & 2) == 2)
    drawLine(colixB, colixC, screenB.x, screenB.y, screenB.z, screenC.x,
        screenC.y, screenC.z);
  if ((check & 4) == 4)
    drawLine(colixA, colixC, screenA.x, screenA.y, screenA.z, screenC.x,
        screenC.y, screenC.z);
}
项目:PhET    文件:Export3D.java   
public void fillTriangle(Point3i pointA, short colixA, short normixA,
                         Point3i pointB, short colixB, short normixB,
                         Point3i pointC, short colixC, short normixC) {
  // mesh, isosurface
  if (colixA != colixB || colixB != colixC) {
    // shouldn't be here, because that uses renderIsosurface
    return;
  }
  ptA.set(pointA.x, pointA.y, pointA.z);
  ptB.set(pointB.x, pointB.y, pointB.z);
  ptC.set(pointC.x, pointC.y, pointC.z);
  exporter.fillTriangle(colixA, ptA, ptB, ptC, false);
}
项目:PhET    文件:Graphics3D.java   
public void fillCylinder(byte endcaps, int diameter,
                         Point3i screenA, Point3i screenB) {
  //axes, bbcage, uccage, cartoon, dipoles, mesh
  cylinder3d.render(colixCurrent, colixCurrent, !addAllPixels, !addAllPixels, endcaps, diameter,
                    screenA.x, screenA.y, screenA.z,
                    screenB.x, screenB.y, screenB.z);
}
项目:PhET    文件:Export3D.java   
public void drawQuadrilateral(short colix, Point3i pointA, Point3i pointB,
                              Point3i pointC, Point3i screenD) {
  // mesh only -- translucency has been checked
  setColix(colix);
  drawLine(pointA, pointB);
  drawLine(pointB, pointC);
  drawLine(pointC, screenD);
  drawLine(screenD, pointA);
}
项目:PhET    文件:Export3D.java   
public void fillTriangle(Point3i pointA, short colixA, short normixA,
                         Point3i pointB, short colixB, short normixB,
                         Point3i pointC, short colixC, short normixC,
                         float factor) {
  fillTriangle(pointA, colixA, normixA, pointB, colixB, normixB, pointC,
      colixC, normixC);
}
项目:PhET    文件:Graphics3D.java   
public void drawTriangle(Point3i screenA, short colixA, Point3i screenB,
                         short colixB, Point3i screenC, short colixC,
                         int check) {
  // primary method for mapped Mesh
  if ((check & 1) == 1)
    drawLine(colixA, colixB, screenA.x, screenA.y, screenA.z, screenB.x,
        screenB.y, screenB.z);
  if ((check & 2) == 2)
    drawLine(colixB, colixC, screenB.x, screenB.y, screenB.z, screenC.x,
        screenC.y, screenC.z);
  if ((check & 4) == 4)
    drawLine(colixA, colixC, screenA.x, screenA.y, screenA.z, screenC.x,
        screenC.y, screenC.z);
}
项目:PhET    文件:Graphics3D.java   
public void drawQuadrilateral(short colix, Point3i screenA, Point3i screenB,
                              Point3i screenC, Point3i screenD) {
  //mesh only -- translucency has been checked
  setColix(colix);
  drawLine(screenA, screenB);
  drawLine(screenB, screenC);
  drawLine(screenC, screenD);
  drawLine(screenD, screenA);
}
项目:PhET    文件:Graphics3D.java   
public void fillQuadrilateral(Point3i screenA, short colixA, short normixA,
                              Point3i screenB, short colixB, short normixB,
                              Point3i screenC, short colixC, short normixC,
                              Point3i screenD, short colixD, short normixD) {
  // mesh
  fillTriangle(screenA, colixA, normixA,
               screenB, colixB, normixB,
               screenC, colixC, normixC);
  fillTriangle(screenA, colixA, normixA,
               screenC, colixC, normixC,
               screenD, colixD, normixD);
}
项目:PhET    文件:Triangle3D.java   
void fillTriangle(Point3i screenA, Point3i screenB, Point3i screenC,
                  boolean useGouraud) {
  //t = Thread.currentThread();
  ax[0] = screenA.x;
  ax[1] = screenB.x;
  ax[2] = screenC.x;
  ay[0] = screenA.y;
  ay[1] = screenB.y;
  ay[2] = screenC.y;
  az[0] = screenA.z;
  az[1] = screenB.z;
  az[2] = screenC.z;
  fillTriangle(useGouraud);
}
项目:PhET    文件:Export3D.java   
public void drawHermite(boolean fill, boolean border, int tension,
                        Point3i s0, Point3i s1, Point3i s2, Point3i s3,
                        Point3i s4, Point3i s5, Point3i s6, Point3i s7,
                        int aspectRatio) {
  hermite3d.renderHermiteRibbon(fill, border, tension, s0, s1, s2, s3, s4,
      s5, s6, s7, aspectRatio);
}
项目:PhET    文件:Export3D.java   
public void fillEllipsoid(Point3f center, Point3f[] points, int x, int y,
                          int z, int diameter, Matrix3f mToEllipsoidal,
                          double[] coef, Matrix4f mDeriv, int selectedOctant,
                          Point3i[] octantPoints) {
  exporter.fillEllipsoid(center, points, colix, x, y, z, diameter,
      mToEllipsoidal, coef, mDeriv, octantPoints);
}
项目:PhET    文件:SurfaceReader.java   
public int getSurfacePointIndexAndFraction(float cutoff, boolean isCutoffAbsolute,
                                int x, int y, int z, Point3i offset, int vA,
                                int vB, float valueA, float valueB,
                                Point3f pointA, Vector3f edgeVector,
                                boolean isContourType, float[] fReturn) {
  float thisValue = getSurfacePointAndFraction(cutoff, isCutoffAbsolute, valueA,
      valueB, pointA, edgeVector, x, y, z, vA, vB, fReturn, ptTemp);
  /* 
   * from MarchingCubes
   * 
   * In the case of a setup for a Marching Squares calculation,
   * we are collecting just the desired type of intersection for the 2D marching
   * square contouring -- x, y, or z. In the case of a contoured f(x,y) surface, 
   * we take every point.
   * 
   */

  if (marchingSquares != null && params.isContoured)
    return marchingSquares.addContourVertex(x, y, z, offset,
        ptTemp, cutoff);
  int assocVertex = (assocCutoff > 0 ? (fReturn[0] < assocCutoff ? vA
      : fReturn[0] > 1 - assocCutoff ? vB : MarchingSquares.CONTOUR_POINT)
      : MarchingSquares.CONTOUR_POINT);
  if (assocVertex >= 0)
    assocVertex = marchingCubes.getLinearOffset(x, y, z, assocVertex);
  int n = addVertexCopy(ptTemp, thisValue, assocVertex);
  if (n >= 0 && params.iAddGridPoints) {
    marchingCubes.calcVertexPoint(x, y, z, vB, ptTemp);
    addVertexCopy(valueA < valueB ? pointA : ptTemp, Float.NaN,
        MarchingSquares.EDGE_POINT);
    addVertexCopy(valueA < valueB ? ptTemp : pointA, Float.NaN,
        MarchingSquares.EDGE_POINT);
  }
  return n;
}
项目:PhET    文件:IsoSolventReader.java   
private void setGridLimitsForAtom(Point3f ptA, float rA, Point3i pt0,
                                  Point3i pt1) {
  rA += volumeData.maxGrid * 1.8f; // to span corner-to-corner possibility
  volumeData.xyzToVoxelPt(ptA.x - rA, ptA.y - rA, ptA.z - rA, pt0);
  pt0.x = Math.max(pt0.x - 1, 0);
  pt0.y = Math.max(pt0.y - 1, 0);
  pt0.z = Math.max(pt0.z - 1, 0);
  volumeData.xyzToVoxelPt(ptA.x + rA, ptA.y + rA, ptA.z + rA, pt1);
  pt1.x = Math.min(pt1.x + 1, nPointsX);
  pt1.y = Math.min(pt1.y + 1, nPointsY);
  pt1.z = Math.min(pt1.z + 1, nPointsZ);
}
项目:PhET    文件:IsoSolventReader.java   
private static void mergeLimits(Point3i ptA, Point3i ptB, Point3i pt0,
                                Point3i pt1) {
  if (pt0 != null) {
    pt0.x = Math.min(ptA.x, ptB.x);
    pt0.y = Math.min(ptA.y, ptB.y);
    pt0.z = Math.min(ptA.z, ptB.z);
  }
  if (pt1 != null) {
    pt1.x = Math.max(ptA.x, ptB.x);
    pt1.y = Math.max(ptA.y, ptB.y);
    pt1.z = Math.max(ptA.z, ptB.z);
  }
}
项目:PhET    文件:MarchingSquares.java   
public int addContourVertex(int x, int y, int z, Point3i offsets,
                            Point3f vertexXYZ, float value) {
  if (contourVertexCount == contourVertexes.length)
    contourVertexes = (ContourVertex[]) ArrayUtil
        .doubleLength(contourVertexes);
  if (offsets != null) {
    x += offsets.x;
    y += offsets.y;
    z += offsets.z;
  }
  int vPt = surfaceReader.addVertexCopy(vertexXYZ, value, VERTEX_POINT);
  contourVertexes[contourVertexCount++] = new ContourVertex(vertexXYZ);
  return vPt;
}
项目:PhET    文件:HallInfo.java   
private Translation(char translationCode, 
    Point3i vectorShift12ths) {
  this.translationCode = translationCode;
  this.rotationOrder = 0;
  this.rotationShift12ths = 0;
  this.vectorShift12ths = vectorShift12ths;        
}
项目:PhET    文件:HallInfo.java   
private Translation(char translationCode, int order, 
    int rotationShift12ths) {
  this.translationCode = translationCode;
  this.rotationOrder = order;
  this.rotationShift12ths = rotationShift12ths;
  this.vectorShift12ths = new Point3i();        
}
项目:PhET    文件:Export3D.java   
public void drawTriangle(Point3i screenA, Point3i screenB, Point3i screenC,
                         int check) {
  // primary method for mapped Mesh
  if ((check & 1) == 1)
    drawLine(colix, colix, screenA.x, screenA.y, screenA.z, screenB.x,
        screenB.y, screenB.z);
  if ((check & 2) == 2)
    drawLine(colix, colix, screenB.x, screenB.y, screenB.z, screenC.x,
        screenC.y, screenC.z);
  if ((check & 4) == 4)
    drawLine(colix, colix, screenA.x, screenA.y, screenA.z, screenC.x,
        screenC.y, screenC.z);
}
项目:PhET    文件:BioShapeRenderer.java   
/**
 * calculate screen points based on control points and wing positions
 * (cartoon, strand, meshRibbon, and ribbon)
 * 
 * @param offsetFraction
 * @return Point3i array THAT MUST BE LATER FREED
 */
protected Point3i[] calcScreens(float offsetFraction) {
  int count = controlPoints.length;
  Point3i[] screens = viewer.allocTempScreens(count);
  if (offsetFraction == 0) {
    for (int i = count; --i >= 0;)
      viewer.transformPoint(controlPoints[i], screens[i]);
  } else {
    float offset_1000 = offsetFraction / 1000f;
    for (int i = count; --i >= 0;)
      calc1Screen(controlPoints[i], wingVectors[i], (mads[i] == 0 && i > 0 ? mads[i-1] : mads[i]), offset_1000,
          screens[i]);
  }
  return screens;
}
项目:PhET    文件:BioShapeRenderer.java   
private void calc1Screen(Point3f center, Vector3f vector, short mad,
                         float offset_1000, Point3i screen) {
  pointT.set(vector);
  float scale = mad * offset_1000;
  pointT.scaleAdd(scale, center);
  viewer.transformPoint(pointT, screen);
}
项目:PhET    文件:BioShapeRenderer.java   
protected void renderHermiteCylinder(Point3i[] screens, int i) {
  //strands
  colix = getLeadColix(i);
  if (!g3d.setColix(colix))
    return;
  setNeighbors(i);
  g3d.drawHermite(isNucleic ? 4 : 7, screens[iPrev],
      screens[i], screens[iNext], screens[iNext2]);
}
项目:PhET    文件:Export3D.java   
public void fillTriangle(Point3i pointA, Point3i pointB, Point3i pointC) {
  // cartoon only, for nucleic acid bases

  ptA.set(pointA.x, pointA.y, pointA.z);
  ptB.set(pointB.x, pointB.y, pointB.z);
  ptC.set(pointC.x, pointC.y, pointC.z);
  exporter.fillTriangle(colix, ptA, ptB, ptC, true);
}
项目:PhET    文件:Isosurface.java   
public int getSurfacePointIndexAndFraction(float cutoff, boolean isCutoffAbsolute,
                                int x, int y, int z, Point3i offset, int vA,
                                int vB, float valueA, float valueB,
                                Point3f pointA, Vector3f edgeVector,
                                boolean isContourType, float[] fReturn) {
  return 0;
}
项目:PhET    文件:MeshRenderer.java   
public boolean render1(Mesh mesh) { // used by mps renderer
  this.mesh = mesh;
  if (!setVariables())
    return false;
  if (!g3d.setColix(colix) && !mesh.showContourLines)
    return mesh.title != null;
  latticeOffset.set(0, 0, 0);
  for (int i = vertexCount; --i >= 0;)
    if (vertices[i] != null)
      viewer.transformPoint(vertices[i], screens[i]);
  if (mesh.lattice == null || mesh.modelIndex < 0) {
    render2(exportType != Graphics3D.EXPORT_NOT);
  } else {
    SymmetryInterface unitcell = viewer.getModelUnitCell(mesh.modelIndex);
    if (unitcell != null) {
      Point3f vTemp = new Point3f();
      Point3i minXYZ = new Point3i();
      Point3i maxXYZ = new Point3i((int) mesh.lattice.x,
          (int) mesh.lattice.y, (int) mesh.lattice.z);
      unitcell.setMinMaxLatticeParameters(minXYZ, maxXYZ);
      for (int tx = minXYZ.x; tx < maxXYZ.x; tx++)
        for (int ty = minXYZ.y; ty < maxXYZ.y; ty++)
          for (int tz = minXYZ.z; tz < maxXYZ.z; tz++) {
            latticeOffset.set(tx, ty, tz);
            unitcell.toCartesian(latticeOffset, false);
            for (int i = vertexCount; --i >= 0;) {
              vTemp.set(vertices[i]);
              vTemp.add(latticeOffset);
              viewer.transformPoint(vTemp, screens[i]);
            }
            render2(exportType != Graphics3D.EXPORT_NOT);
          }
    }
  }

  if (screens != null)
    viewer.freeTempScreens(screens);
  return true;
}
项目:PhET    文件:MeshRenderer.java   
protected void drawLine(int iA, int iB, boolean fill, 
                        Point3f vA, Point3f vB, 
                        Point3i sA, Point3i sB) {
  byte endCap = (iA != iB  && !fill ? Graphics3D.ENDCAPS_NONE 
      : width < 0 || width == -0.0 || iA != iB && isTranslucent ? Graphics3D.ENDCAPS_FLAT
      : Graphics3D.ENDCAPS_SPHERICAL);
  if (width == 0) {
    if (diameter == 0)
      diameter = (mesh.diameter > 0 ? mesh.diameter : iA == iB ? 7 : 3);
    if (exportType == Graphics3D.EXPORT_CARTESIAN) {
      pt1f.set(vA);
      pt1f.add(vB);
      pt1f.scale(1f / 2f);
      viewer.transformPoint(pt1f, pt1i);
      diameter = (int) (viewer.unscaleToScreen(pt1i.z, diameter) * 1000);
    }
    if (iA == iB) {
      g3d.fillSphere(diameter, sA);
    } else {
      g3d.fillCylinder(endCap, diameter, sA, sB);
    }
  } else {
    pt1f.set(vA);
    pt1f.add(vB);
    pt1f.scale(1f / 2f);
    viewer.transformPoint(pt1f, pt1i);
    int mad = (int) (Math.abs(width) * 1000); 
    diameter = (exportType == Graphics3D.EXPORT_CARTESIAN ? mad 
        : viewer.scaleToScreen(pt1i.z, mad));
    if (diameter == 0)
      diameter = 1;
    viewer.transformPoint(vA, pt1f);
    viewer.transformPoint(vB, pt2f);
    g3d.fillCylinderBits(endCap, diameter, pt1f, pt2f);
  }
}
项目:PhET    文件:SticksRenderer.java   
@Override
protected void render() {
  slabbing = viewer.getSlabEnabled();
  slabByAtom = viewer.getSlabByAtom();          
  endcaps = Graphics3D.ENDCAPS_SPHERICAL;
  multipleBondSpacing = viewer.getMultipleBondSpacing();
  multipleBondRadiusFactor = viewer.getMultipleBondRadiusFactor();
  if (multipleBondSpacing > 0) {
    z = new Vector3f();
    x = new Vector3f();
    y = new Vector3f();
    p1 = new Point3f();
    p2 = new Point3f();
    s1 = new Point3i();
    s2 = new Point3i();
  }
  showMultipleBonds = multipleBondSpacing != 0 && viewer.getShowMultipleBonds();
  modeMultipleBond = viewer.getModeMultipleBond();
  renderWireframe = viewer.getInMotion() && viewer.getWireframeRotation();
  ssbondsBackbone = viewer.getSsbondsBackbone();
  hbondsBackbone = viewer.getHbondsBackbone();
  bondsBackbone = hbondsBackbone | ssbondsBackbone;
  hbondsSolid = viewer.getHbondsSolid();
  isAntialiased = g3d.isAntialiased();
  Bond[] bonds = modelSet.getBonds();
  for (int i = modelSet.getBondCount(); --i >= 0; ) {
    bond = bonds[i];
    if ((bond.getShapeVisibilityFlags() & myVisibilityFlag) != 0) 
      renderBond();
  }
}
项目:PhET    文件:Viewer.java   
public void hoverOn(int x, int y, String text) {
  if (!isHoverEnabled())
    return;
  // from draw for drawhover on
  if (eval != null && isScriptExecuting())
    return;
  loadShape(JmolConstants.SHAPE_HOVER);
  setShapeProperty(JmolConstants.SHAPE_HOVER, "xy", new Point3i(x, y, 0));
  setShapeProperty(JmolConstants.SHAPE_HOVER, "target", null);
  setShapeProperty(JmolConstants.SHAPE_HOVER, "specialLabel", null);
  setShapeProperty(JmolConstants.SHAPE_HOVER, "text", text);
  hoverAtomIndex = -1;
  hoverText = text;
  refresh(3, "hover on point");
}