DGtal  0.9.3
Functions
exampleDSLSubsegment.cpp File Reference
#include <iostream>
#include "ConfigExamples.h"
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/base/Common.h"
#include <map>
#include "DGtal/geometry/curves/DSLSubsegment.h"
#include "DGtal/kernel/CPointPredicate.h"
#include "DGtal/arithmetic/IntegerComputer.h"
Include dependency graph for exampleDSLSubsegment.cpp:

Go to the source code of this file.

Functions

int main ()
 

Detailed Description

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Author
Isabelle Sivignon (isabe.nosp@m.lle..nosp@m.sivig.nosp@m.non@.nosp@m.gipsa.nosp@m.-lab.nosp@m..gren.nosp@m.oble.nosp@m.-inp..nosp@m.fr ) gipsa-lab Grenoble Images Parole Signal Automatique (CNRS, UMR 5216), CNRS, France
Date
2013/07/10

An example file named exampleDSLSubsegment.

This file is part of the DGtal library.

Definition in file exampleDSLSubsegment.cpp.

Function Documentation

◆ main()

int main ( )

Definition at line 57 of file exampleDSLSubsegment.cpp.

References DGtal::Trace::beginBlock(), DGtal::Trace::endBlock(), and DGtal::trace.

58 {
59  trace.beginBlock ( "Example exampleDSLSubsegment" );
60 
61 
62  typedef DGtal::int32_t Integer;
63  typedef long double Number;
64 
65  // Define the DSLSubsegment: the first template parameter specifies
66  // the type of integer used for computations, the second one is the
67  // type of the input DSL characteristics (Integer in this case).
68  typedef DGtal::DSLSubsegment<Integer,Integer> DSLSubseg;
69 
70  typedef DSLSubseg::Point Point;
71 
72  // Define the two endpoints of the subsegment
73  Point A(1,5);
74  Point B(6,9);
75 
76  // Compute the minimal characteristics of the subsegment [AB] of the
77  // 8-connected DSL of characteristics (2,3,15). The algorithm using
78  // the Farey fan is used in this case. If the string is set to
79  // "localCH", the algorithm using local convex hull is used: the
80  // result is the same but the computation time is a bit longer.
81  DSLSubseg D1(2,3,15,A,B,"farey");
82 
83  // Display the result
84  std::cout << "a=" << D1.getA() << " b=" << D1.getB() << " mu=" << D1.getMu() << std::endl;
85 
86  // Define a DSL subsegment with floating-point input
87  // characteristics.
88  typedef DGtal::DSLSubsegment<Integer,Number> DSLSubsegD;
89 
90  // Same as before, except that the last parameter is the precision used for
91  // floating-point geometric predicates. The algorithm used is an
92  // adaptation of the Farey fan algorithm for floating-point input data.
93  DSLSubsegD D2(0.6666,5,A,B,0.00005);
94 
95  // Display the result
96  std::cout << "a=" << D2.getA() << " b=" << D2.getB() << " mu=" << D2.getMu() << std::endl;
97 
98 
99 
100  trace.endBlock();
101  return 0;
102 }
void beginBlock(const std::string &keyword="")
DGtal::int32_t Integer
Definition: StdDefs.h:74
Trace trace
Definition: Common.h:137
double endBlock()
Aim: Given a Digital Straight line and two endpoints A and B on this line, compute the minimal charac...
Definition: DSLSubsegment.h:75
MyPointD Point
Definition: testClone2.cpp:383
boost::int32_t int32_t
signed 32-bit integer.
Definition: BasicTypes.h:72