DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
Pattern.h
1
16
17
#pragma once
18
30
31
#if defined(Pattern_RECURSES)
32
#error Recursive header files inclusion detected in Pattern.h
33
#else
// defined(Pattern_RECURSES)
35
#define Pattern_RECURSES
36
37
#if !defined Pattern_h
39
#define Pattern_h
40
42
// Inclusions
43
#include <iostream>
44
#include <string>
45
#include "DGtal/base/Common.h"
46
#include "DGtal/arithmetic/CPositiveIrreducibleFraction.h"
47
#include "DGtal/arithmetic/IntegerComputer.h"
48
#include "DGtal/arithmetic/SternBrocot.h"
50
51
namespace
DGtal
52
{
53
55
// template class Pattern
77
template
<
typename
TFraction>
78
class
Pattern
79
{
80
public
:
81
typedef
TFraction
Fraction
;
82
BOOST_CONCEPT_ASSERT
((
concepts::CPositiveIrreducibleFraction< Fraction >
));
83
84
typedef
Pattern<TFraction>
Self
;
85
typedef
typename
Fraction::Integer
Integer
;
86
typedef
typename
Fraction::Quotient
Quotient
;
87
88
// BOOST_CONCEPT_ASSERT(( CInteger< Quotient > ));
89
90
// ----------------------- associated types ------------------------------
91
public
:
92
93
typedef
IntegerComputer<Integer>
IC
;
94
typedef
typename
IC::Point2I
Point2I
;
95
typedef
typename
IC::Vector2I
Vector2I
;
96
97
// ----------------------- Standard services ------------------------------
98
public
:
99
103
~Pattern
();
104
109
Pattern
(
Fraction
f =
Fraction
( 0 ) );
110
116
Pattern
(
Integer
p,
Integer
q );
117
122
Pattern
(
const
Pattern
& other );
123
129
Pattern
&
operator=
(
const
Pattern
& other );
130
131
// ----------------------- Pattern services -------------------------------
132
public
:
133
136
std::string
rE
()
const
;
137
141
std::string
rEs
(
const
std::string & seps =
"(|)"
)
const
;
142
144
Fraction
slope
()
const
;
145
147
Integer
length
()
const
;
148
151
Integer
posU
(
Quotient
k )
const
;
152
155
Integer
posL
(
Quotient
k )
const
;
156
159
Point2I
U
(
Quotient
k )
const
;
160
163
Point2I
L
(
Quotient
k )
const
;
164
168
Vector2I
bezout
()
const
;
170
Vector2I
v
()
const
;
171
173
Pattern
previousPattern
()
const
;
174
175
203
bool
204
getSmallestCoveringSubpattern
(
Pattern
& subpattern,
205
Quotient
& nb,
206
Vector2I
& startPos,
207
Integer
posA,
Integer
posB,
208
bool
reversed =
false
)
const
;
209
237
bool
238
getGreatestIncludedSubpattern
(
Pattern
& subpattern,
239
Quotient
& nb,
240
Vector2I
& startPos,
241
Integer
posA,
Integer
posB,
242
bool
reversed =
false
)
const
;
243
244
// ----------------------- Interface --------------------------------------
245
public
:
246
251
void
selfDisplay
( std::ostream & out )
const
;
252
257
bool
isValid
()
const
;
258
259
// ------------------------- Protected Data ------------------------------
260
private
:
261
// ------------------------- Private Data --------------------------------
262
private
:
263
265
Fraction
mySlope
;
266
267
// ------------------------- Hidden services ------------------------------
268
protected
:
269
270
// ------------------------- Internals ------------------------------------
271
private
:
272
273
};
// end of class Pattern
274
275
282
template
<
typename
TFraction>
283
std::ostream&
284
operator<<
( std::ostream & out,
const
Pattern<TFraction>
&
object
);
285
286
}
// namespace DGtal
287
288
290
// Includes inline functions.
291
#include "DGtal/arithmetic/Pattern.ih"
292
293
// //
295
296
#endif
// !defined Pattern_h
297
298
#undef Pattern_RECURSES
299
#endif
// else defined(Pattern_RECURSES)
DGtal::IntegerComputer
Aim: This class gathers several types and methods to make computation with integers.
Definition
IntegerComputer.h:83
DGtal::IntegerComputer< Integer >::Vector2I
SpaceND< 2, Integer >::Vector Vector2I
Definition
IntegerComputer.h:94
DGtal::IntegerComputer< Integer >::Point2I
SpaceND< 2, Integer >::Point Point2I
Definition
IntegerComputer.h:93
DGtal::Pattern
Aim: This class represents a pattern, i.e. the path between two consecutive upper leaning points on a...
Definition
Pattern.h:79
DGtal::Pattern::posL
Integer posL(Quotient k) const
DGtal::Pattern::length
Integer length() const
DGtal::Pattern::mySlope
Fraction mySlope
The fraction that characterizes the slope of the pattern.
Definition
Pattern.h:265
DGtal::Pattern::slope
Fraction slope() const
DGtal::Pattern::previousPattern
Pattern previousPattern() const
DGtal::Pattern::Fraction
TFraction Fraction
Definition
Pattern.h:81
DGtal::Pattern::Quotient
Fraction::Quotient Quotient
Definition
Pattern.h:86
DGtal::Pattern::isValid
bool isValid() const
DGtal::Pattern::Point2I
IC::Point2I Point2I
Definition
Pattern.h:94
DGtal::Pattern::v
Vector2I v() const
DGtal::Pattern::operator=
Pattern & operator=(const Pattern &other)
DGtal::Pattern::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CPositiveIrreducibleFraction< Fraction >))
DGtal::Pattern::Integer
Fraction::Integer Integer
Definition
Pattern.h:85
DGtal::Pattern::rE
std::string rE() const
DGtal::Pattern::U
Point2I U(Quotient k) const
DGtal::Pattern::Pattern
Pattern(Fraction f=Fraction(0))
DGtal::Pattern::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::Pattern::getGreatestIncludedSubpattern
bool getGreatestIncludedSubpattern(Pattern &subpattern, Quotient &nb, Vector2I &startPos, Integer posA, Integer posB, bool reversed=false) const
DGtal::Pattern::bezout
Vector2I bezout() const
DGtal::Pattern::Vector2I
IC::Vector2I Vector2I
Definition
Pattern.h:95
DGtal::Pattern::rEs
std::string rEs(const std::string &seps="(|)") const
DGtal::Pattern::IC
IntegerComputer< Integer > IC
Definition
Pattern.h:93
DGtal::Pattern::Pattern
Pattern(const Pattern &other)
DGtal::Pattern::posU
Integer posU(Quotient k) const
DGtal::Pattern::L
Point2I L(Quotient k) const
DGtal::Pattern::getSmallestCoveringSubpattern
bool getSmallestCoveringSubpattern(Pattern &subpattern, Quotient &nb, Vector2I &startPos, Integer posA, Integer posB, bool reversed=false) const
DGtal::Pattern::Self
Pattern< TFraction > Self
Definition
Pattern.h:84
DGtal::Pattern::Pattern
Pattern(Integer p, Integer q)
DGtal::Pattern::~Pattern
~Pattern()
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
DGtal::concepts::CPositiveIrreducibleFraction
Aim: Defines positive irreducible fractions, i.e. fraction p/q, p and q non-negative integers,...
Definition
CPositiveIrreducibleFraction.h:164
src
DGtal
arithmetic
Pattern.h
Generated on
for DGtal by
1.18.0