Пример #1
0
  /**
   * Vrací pozici (v rámci scény) pixelu rastru průmětny na souřadnicích <code>(i, j)</code>.
   *
   * @param i Vertikální souřadnice pixelu v rastru průmětny.
   * @param j Horizontální souřadnice pixelu v rastru průmětny.
   * @return Vrací bod, který popisuje polohu daného pixelu ve scéně.
   */
  protected Point3D getPixelPosition(int i, int j) {
    Point3D pixelPosition = new Point3D(position);

    float u = ((float) (i) / (screenWidth - 1) - 0.5f) * realWidth;
    float v = ((float) (screenHeight - 1 - j) / (screenHeight - 1) - 0.5f) * realHeight;
    pixelPosition = pixelPosition.move(right.mul(u)).move(up.mul(v));
    return pixelPosition;
  }
Пример #2
0
  protected List<Point3D> getPixelPositionSuperSampledList(int i, int j, int r) {
    final int count = getSuperSampledCount(r);
    final List<Point3D> pixelPositionList = new ArrayList<>(count);
    Point3D currentPixelPosition = null;

    final float du = getSuperSampledDU(r);
    final float dv = getSuperSampledDV(r);
    for (int k = -r; k <= r; k++) {
      for (int l = -r; l <= r; l++) {
        currentPixelPosition = new Point3D(position);
        float u = ((float) (i) / (screenWidth - 1) - 0.5f) * realWidth + k * du;
        float v =
            ((float) (screenHeight - 1 - j) / (screenHeight - 1) - 0.5f) * realHeight + l * dv;
        pixelPositionList.add(currentPixelPosition.move(right.mul(u)).move(up.mul(v)));
      }
    }

    return pixelPositionList;
  }