Unravel Engine C++ Reference
Loading...
Searching...
No Matches
parametric_path.cpp
Go to the documentation of this file.
1
#include "
parametric_path.hpp
"
2
3
using namespace
generator
;
4
5
parametric_path_t::edges_t::edges_t(
const
parametric_path_t
& path) : path_{&path}, i_{0}
6
{
7
}
8
9
edge_t
parametric_path_t::edges_t::generate
()
const
10
{
11
if
(
done
())
12
throw
std::out_of_range(
"Done!"
);
13
return
edge_t
{{i_, i_ + 1}};
14
}
15
16
bool
parametric_path_t::edges_t::done
() const noexcept
17
{
18
return
i_ == path_->segments_;
19
}
20
21
void
parametric_path_t::edges_t::next
()
22
{
23
if
(done())
24
throw
std::out_of_range(
"Done!"
);
25
++i_;
26
}
27
28
parametric_path_t::vertices_t::vertices_t(
const
parametric_path_t
& path) : path_{&path}, i_{0}
29
{
30
}
31
32
path_vertex_t
parametric_path_t::vertices_t::generate
()
const
33
{
34
if
(done())
35
throw
std::out_of_range(
"Done!"
);
36
37
return
path_->eval_(i_ * path_->delta_);
38
}
39
40
bool
parametric_path_t::vertices_t::done
() const noexcept
41
{
42
if
(path_->segments_ == 0)
43
return
true
;
44
return
i_ == path_->segments_ + 1;
45
}
46
47
void
parametric_path_t::vertices_t::next
()
48
{
49
if
(done())
50
throw
std::out_of_range(
"Done!"
);
51
++i_;
52
}
53
54
parametric_path_t::parametric_path_t
(
const
std::function<
path_vertex_t
(
double
)>& eval,
int
segments
) noexcept
55
: eval_{std::move(eval)}
56
, segments_{
segments
}
57
, delta_{1.0 /
segments
}
58
{
59
}
60
61
parametric_path_t::edges_t
parametric_path_t::edges
() const noexcept
62
{
63
return
edges_t
{*
this
};
64
}
65
66
parametric_path_t::vertices_t
parametric_path_t::vertices
() const noexcept
67
{
68
return
vertices_t
{*
this
};
69
}
generator::edge_t
Definition
edge.hpp:10
generator::parametric_path_t::edges_t
Definition
parametric_path.hpp:17
generator::parametric_path_t::edges_t::generate
edge_t generate() const
Definition
parametric_path.cpp:9
generator::parametric_path_t::edges_t::next
void next()
Definition
parametric_path.cpp:21
generator::parametric_path_t::edges_t::done
bool done() const noexcept
Definition
parametric_path.cpp:16
generator::parametric_path_t::vertices_t
Definition
parametric_path.hpp:34
generator::parametric_path_t::vertices_t::done
bool done() const noexcept
Definition
parametric_path.cpp:40
generator::parametric_path_t::vertices_t::generate
path_vertex_t generate() const
Definition
parametric_path.cpp:32
generator::parametric_path_t::vertices_t::next
void next()
Definition
parametric_path.cpp:47
generator::parametric_path_t
Path generated by evaluating callback functions at even intervals.
Definition
parametric_path.hpp:14
generator::parametric_path_t::edges
edges_t edges() const noexcept
Definition
parametric_path.cpp:61
generator::parametric_path_t::vertices
vertices_t vertices() const noexcept
Definition
parametric_path.cpp:66
generator::parametric_path_t::parametric_path_t
parametric_path_t(const std::function< path_vertex_t(double)> &eval, int segments=16) noexcept
Definition
parametric_path.cpp:54
generator::path_vertex_t
Definition
path_vertex.hpp:10
generator
Definition
any_generator.hpp:7
parametric_path.hpp
segments
const segment_list * segments
Definition
text_component.cpp:442
UnravelEngine
UnravelEngine
engine
engine
rendering
generator
parametric_path.cpp
Generated by
1.12.0