Пример #1
0
void NzPatch::InitializeFromParent(NzTerrainNodeID nodeID, nzTerrainNodeData* data, const NzPatch& parentPatch)
{
    Reset();

    m_id = nodeID;
    m_data = data;

    int offx = 2 * (m_id.locx - std::floor(m_id.locx / 2.f) * 2);
    int offy = 2 * (m_id.locy - std::floor(m_id.locy / 2.f) * 2);

    m_vertices[1][1].SetPosition(parentPatch.m_vertices[1 + offx][1 + offy]);
    m_vertices[3][1].SetPosition(parentPatch.m_vertices[2 + offx][1 + offy]);
    m_vertices[5][1].SetPosition(parentPatch.m_vertices[3 + offx][1 + offy]);

    m_vertices[1][3].SetPosition(parentPatch.m_vertices[1 + offx][2 + offy]);
    m_vertices[3][3].SetPosition(parentPatch.m_vertices[2 + offx][2 + offy]);
    m_vertices[5][3].SetPosition(parentPatch.m_vertices[3 + offx][2 + offy]);

    m_vertices[1][5].SetPosition(parentPatch.m_vertices[1 + offx][3 + offy]);
    m_vertices[3][5].SetPosition(parentPatch.m_vertices[2 + offx][3 + offy]);
    m_vertices[5][5].SetPosition(parentPatch.m_vertices[3 + offx][3 + offy]);

    ComputeHeights();
    ComputeNormals();
    ComputeSlope();
}
Пример #2
0
  //! Constructs an AlphaCube object using a PVL object.
  AlphaCube::AlphaCube(Cube &cube) {
    Isis::PvlObject &isiscube = cube.label()->findObject("IsisCube");
    if(isiscube.hasGroup("AlphaCube")) {
      Isis::PvlGroup &alpha = isiscube.findGroup("AlphaCube");
      p_alphaSamples        = alpha["AlphaSamples"];
      p_alphaLines          = alpha["AlphaLines"];
      p_alphaStartingSample = alpha["AlphaStartingSample"];
      p_alphaStartingLine   = alpha["AlphaStartingLine"];
      p_alphaEndingSample   = alpha["AlphaEndingSample"];
      p_alphaEndingLine     = alpha["AlphaEndingLine"];
      p_betaSamples         = alpha["BetaSamples"];
      p_betaLines           = alpha["BetaLines"];
    }
    else {
      p_alphaSamples        = cube.sampleCount();
      p_alphaLines          = cube.lineCount();
      p_alphaStartingSample = 0.5;
      p_alphaStartingLine   = 0.5;
      p_alphaEndingSample   = (double) p_alphaSamples + 0.5;
      p_alphaEndingLine     = (double) p_alphaLines + 0.5;
      p_betaSamples         = p_alphaSamples;
      p_betaLines           = p_alphaLines;
    }

    ComputeSlope();
  }
Пример #3
0
void NzPatch::Initialize(NzTerrainNodeID nodeID, nzTerrainNodeData* data)
{
    Reset();

    m_id = nodeID;
    m_data = data;

    ComputeHeights();
    ComputeNormals();
    ComputeSlope();
}
Пример #4
0
  /** Constructs an AlphaCube object given alphaSamples, alphaLines,
   *  betaSamples and betaLines.
   */
  AlphaCube::AlphaCube(int alphaSamples, int alphaLines,
                       int betaSamples, int betaLines) {
    p_alphaSamples        = alphaSamples;
    p_alphaLines          = alphaLines;
    p_alphaStartingSample = 0.5;
    p_alphaStartingLine   = 0.5;
    p_alphaEndingSample   = (double) alphaSamples + 0.5;
    p_alphaEndingLine     = (double) alphaLines + 0.5;

    p_betaSamples = betaSamples;
    p_betaLines = betaLines;

    ComputeSlope();
  }
Пример #5
0
  /**
   * Merges two AlphaCube objects. This facilities combinations of programs
   * crop-enlarge, crop-crop, reduce-pad, etc.
   *
   * @param add The AlphaCube object to be merged.
   */
  void AlphaCube::Rehash(AlphaCube &add) {
    double sl = AlphaLine(add.AlphaLine(0.5));
    double ss = AlphaSample(add.AlphaSample(0.5));
    double el = AlphaLine(add.AlphaLine(add.BetaLines() + 0.5));
    double es = AlphaSample(add.AlphaSample(add.BetaSamples() + 0.5));

    p_alphaStartingLine = sl;
    p_alphaStartingSample = ss;
    p_alphaEndingLine = el;
    p_alphaEndingSample = es;
    p_betaLines = add.BetaLines();
    p_betaSamples = add.BetaSamples();

    ComputeSlope();
  }
Пример #6
0
  /** Constructs an AlphaCube object with a basic mapping from corner-to-corner,
   * beta 0.5,0.5 maps to alpha 0.5,0.5 and beta ns+0.5,nl+0.5 maps to alpha
   * ns+0.5, nl+0.5.
   */
  AlphaCube::AlphaCube(int alphaSamples, int alphaLines,
                       int betaSamples, int betaLines,
                       double alphaSs, double alphaSl,
                       double alphaEs, double alphaEl) {
    p_alphaSamples        = alphaSamples;
    p_alphaLines          = alphaLines;
    p_alphaStartingSample = alphaSs;
    p_alphaStartingLine   = alphaSl;
    p_alphaEndingSample   = alphaEs;
    p_alphaEndingLine     = alphaEl;

    p_betaSamples = betaSamples;
    p_betaLines = betaLines;

    ComputeSlope();
  }