DGtal 1.3.0
Loading...
Searching...
No Matches
geometry/curves/exampleDSLSubsegment.cpp

Example of DSLSubsegment.

#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"
using namespace std;
using namespace DGtal;
int main( )
{
trace.beginBlock ( "Example exampleDSLSubsegment" );
typedef long double Number;
// Define the DSLSubsegment: the first template parameter specifies
// the type of integer used for computations, the second one is the
// type of the input DSL characteristics (Integer in this case).
typedef DSLSubseg::Point Point;
// Define the two endpoints of the subsegment
Point A(1,5);
Point B(6,9);
// Compute the minimal characteristics of the subsegment [AB] of the
// 8-connected DSL of characteristics (2,3,15). The algorithm using
// the Farey fan is used in this case. If the string is set to
// "localCH", the algorithm using local convex hull is used: the
// result is the same but the computation time is a bit longer.
DSLSubseg D1(2,3,15,A,B,"farey");
// Display the result
std::cout << "a=" << D1.getA() << " b=" << D1.getB() << " mu=" << D1.getMu() << std::endl;
// Define a DSL subsegment with floating-point input
// characteristics.
// Same as before, except that the last parameter is the precision used for
// floating-point geometric predicates. The algorithm used is an
// adaptation of the Farey fan algorithm for floating-point input data.
DSLSubsegD D2(0.6666,5,A,B,0.00005);
// Display the result
std::cout << "a=" << D2.getA() << " b=" << D2.getB() << " mu=" << D2.getMu() << std::endl;
trace.endBlock();
return 0;
}
// //
Aim: Given a Digital Straight line and two endpoints A and B on this line, compute the minimal charac...
Definition: DSLSubsegment.h:76
void beginBlock(const std::string &keyword="")
double endBlock()
DGtal is the top-level namespace which contains all DGtal functions and types.
boost::int32_t int32_t
signed 32-bit integer.
Definition: BasicTypes.h:72
STL namespace.
int main()
Definition: testBits.cpp:56
MyPointD Point
Definition: testClone2.cpp:383