testMeasure.cpp

Description of class 'MeasureOfStraightLines'

Aim:

The aim of this class is to compute the measure in the Lebesgues sense of the set of straight lines associated to domains defined as polygons in the (a,b)-parameter space. This parameter space maps the line $ax-y+b=0$ to the point $(a,b)$.

   * @inproceedings{COEURJOLLY:2009:HAL-00432711:1,
   *   title = { {M}easure of {S}traight {L}ines and its {A}pplications in {D}igital {G}eometry},
   *   author = {{C}oeurjolly, {D}avid and {S}ivignon, {I}sabelle},
   *   booktitle = {13th {I}nternational {W}orkshop on {C}ombinatorial {I}mage {A}nalysis 13th {I}nternational {W}orkshop on {C}ombinatorial {I}mage {A}nalysis },
   *   publisher = {{R}esearch {P}ublishing {S}ervices },
   *   pages = {1-12 },
   *   address = {{C}ancun {M}exique },
   *   audience = {internationale },
   *   year = {2009},
   *   URL = {http://hal.archives-ouvertes.fr/hal-00432711/PDF/mesure.pdf},
   * }
   * 
Todo:
Create a vector<Point> interface
#include <cstdio>
#include <cmath>
#include <iostream>
#include <fstream>
#include <vector>
#include "DGtal/base/Common.h"
#include "DGtal/math/MeasureOfStraightLines.h"


using namespace DGtal;
using namespace std;



void testUnitSquare()
{
    vector<double> a;
    vector<double> b;

    a.push_back(0);
    b.push_back(0);
    a.push_back(1);
    b.push_back(0);
    a.push_back(1);
    b.push_back(1);
    a.push_back(0);
    b.push_back(1);

    MeasureOfStraightLines measure;


    trace.info() << "Measure of the Straight of Lines of the unit square = " << measure.computeMeasure(a,b)<< std::endl;
    trace.emphase() <<"Expected value = 0.707107 (sqrt(2)/2)"<<endl;
}


void testUnitSquareCentroid()
{
    vector<double> a;
    vector<double> b;

    a.push_back(0);
    b.push_back(0);
    a.push_back(1);
    b.push_back(0);
    a.push_back(1);
    b.push_back(1);
    a.push_back(0);
    b.push_back(1);

    MeasureOfStraightLines measure;

    trace.info() << "Centroid measure of the unit square = (" << measure.computeCentroidA(a,b)
    << ","<<measure.computeCentroidB(a,b)<<")"<<std::endl;
    trace.emphase() <<"Expected value = (0.4142,0.5)"<<endl;
}


int main(int argc, char **argv)
{

    testUnitSquare();
    testUnitSquareCentroid();
    return 0;
}

Generated on Wed Sep 29 15:53:45 2010 for DGtal by  doxygen 1.6.3