Unverified Commit 3c647081 authored by kledmundson's avatar kledmundson Committed by GitHub
Browse files

Merge pull request #202 from kledmundson/LroLidar_Infrastructure

left out these files
parents 01c8096b f722ffe1
Loading
Loading
Loading
Loading
+131 −0
Original line number Diff line number Diff line
#include "BundleControlPointVector.h"

#include <QDebug>
#include <QFutureWatcher>
#include <QtConcurrentRun>

#include "IException.h"

namespace Isis {

  /**
   * Constructs an empty BundleControlPointVector.
   */
  BundleControlPointVector::BundleControlPointVector() {
  }


  /**
   * Copy constructor.
   * 
   * @param src A reference to the BundleControlPointVector to copy from.
   */
  BundleControlPointVector::BundleControlPointVector(const BundleControlPointVector &src)
      :QVector<BundleControlPointQsp>(src) {
  }


  /**
   * Destructor.
   *
   * Contained BundleControlPoints will remain until all shared pointers to them are deleted.
   */
  BundleControlPointVector::~BundleControlPointVector() {
    clear();
  }


  /**
   * Assignment operator.
   * 
   * Assigns the state of the source BundleControlPointVector to this BundleControlPointVector.
   * 
   * @param src The BundleControlPointVector to assign from.
   * 
   * @return BundleControlPointVector& A reference to this BundleControlPointVector.
   */
  BundleControlPointVector &BundleControlPointVector::operator=(const BundleControlPointVector &src) {
    if (&src != this) {
      QVector<BundleControlPointQsp>::operator=(src);
    }
    return *this;
  }


  /**
   * Apply point parameter corrections.
   *
   * @param normalsMatrix Normal equations matrix.
   * @param imageSolution Current iteration solution vector for image parameters.
   *
   */
  void BundleControlPointVector::applyParameterCorrections(SparseBlockMatrix &normalsMatrix,
                                                           LinearAlgebra::Vector &imageSolution) {
    for (int i = 0; i < size(); i++) {
      at(i)->applyParameterCorrections(normalsMatrix, imageSolution);
    }
  }


  /**
   * Compute vtpv, the weighted sum of squares of constrained point residuals.
   *
   * @return double Weighted sum of squares of constrained point residuals.
   */
  void BundleControlPointVector::computeMeasureResiduals() {

    for (int i = 0; i < size(); i++) {
      at(i)->computeResiduals();
    }
  }


  /**
   * Compute vtpv of image measures (weighted sum of squares of measure residuals).
   *
   * @return double weighted sum of squares of measure residuals (vtpv).
   */
  double BundleControlPointVector::vtpvMeasureContribution() {
    double vtpv = 0;

    for (int i = 0; i < size(); i++) {
      vtpv += at(i)->vtpvMeasures();
    }

    return vtpv;
  }


  /**
   * Compute vtpv, the weighted sum of squares of constrained point residuals.
   *
   * @return double Weighted sum of squares of constrained point residuals.
   */
  double BundleControlPointVector::vtpvContribution() {
    double vtpvControl = 0;

    for (int i = 0; i < size(); i++) {
      vtpvControl += at(i)->vtpv();
    }

    return vtpvControl;
  }

  /**
   * Compute vtpv of lidar range constraints.
   *
   * @return double vtpv of lidar range constraints.
   */
  double BundleControlPointVector::vtpvRangeContribution() {
    double vtpv = 0;

    for (int i = 0; i < size(); i++) {
      vtpv += at(i)->vtpvRangeContribution();
    }

    return vtpv;
  }

}

+65 −0
Original line number Diff line number Diff line
#ifndef BundleControlPointVector_h
#define BundleControlPointVector_h
/**
 * @file
 * $Revision: 1.20 $
 * $Date: 2014/5/22 01:35:17 $
 *
 *   Unless noted otherwise, the portions of Isis written by the USGS are
 *   public domain. See individual third-party library and package descriptions
 *   for intellectual property information, user agreements, and related
 *   information.
 *
 *   Although Isis has been used by the USGS, no warranty, expressed or
 *   implied, is made by the USGS as to the accuracy and functioning of such
 *   software and related material nor shall the fact of distribution
 *   constitute any such warranty, and no responsibility is assumed by the
 *   USGS in connection therewith.
 *
 *   For additional information, launch
 *   $ISISROOT/doc//documents/Disclaimers/Disclaimers.html
 *   in a browser or see the Privacy &amp; Disclaimers page on the Isis website,
 *   http://isis.astrogeology.usgs.gov, and the USGS privacy and disclaimers on
 *   http://www.usgs.gov/privacy.html.
 */

#include <QMap>
#include <QSharedPointer>
#include <QString>
#include <QVector>

#include "BundleControlPoint.h"

namespace Isis {


  /**
   * This class is a container class for BundleControlPoints.
   *
   * Contained BundleControlPoints are stored as shared pointers, so are automatically deleted when
   * all shared pointers are deleted.
   *
   * @author 2014-05-22 Ken Edmundson
   *
   * @internal
   *   @history 2018-04-16 Ken Edmundson - Original version.
   */
  class BundleControlPointVector : public QVector<BundleControlPointQsp> {

    public:
      BundleControlPointVector();
      BundleControlPointVector(const BundleControlPointVector &src);
      ~BundleControlPointVector();

      BundleControlPointVector &operator=(const BundleControlPointVector &src);

      void applyParameterCorrections(SparseBlockMatrix &normalsMatrix,
                                     LinearAlgebra::Vector &imageSolution);
      void computeMeasureResiduals();
      double vtpvContribution();
      double vtpvMeasureContribution();
      double vtpvRangeContribution();
  };
}

#endif // BundleControlPointVector_h