cgv
Loading...
Searching...
No Matches
hermite.h
1
#pragma once
2
3
#include "fvec.h"
4
#include "fmat.h"
5
#include "interpolate.h"
6
#include "parametric_curve.h"
7
8
namespace
cgv
{
9
namespace
math {
10
11
template
<
typename
T>
12
struct
hermite_node
{
13
T val;
// the point value (e.g. position)
14
T tan;
// the tangent
15
};
16
17
template
<
typename
Po
int
T>
18
struct
cubic_hermite_curve
:
public
parametric_curve
<cubic_hermite_curve<PointT>> {
20
hermite_node<PointT>
n0
;
22
hermite_node<PointT>
n1
;
23
24
cubic_hermite_curve
() {}
25
cubic_hermite_curve
(
const
PointT& p0,
const
PointT& m0,
const
PointT& p1,
const
PointT& m1) :
n0
{ p1, m0 },
n1
{ p1, m1 } {}
26
cubic_hermite_curve(
const
hermite_node<PointT>&
n0
,
const
hermite_node<PointT>&
n1
) :
n0
(
n0
),
n1
(
n1
) {}
27
28
template
<
typename
ParamT =
float
>
29
PointT evaluate(ParamT t)
const
{
30
return
interpolate_cubic_hermite(
n0
.val,
n0
.tan,
n1
.val,
n1
.tan, t);
31
}
32
};
33
34
}
// namespace math
35
}
// namespace cgv
cgv::math::parametric_curve
CRTP base class for parametric curves.
Definition
parametric_curve.h:52
cgv
the cgv namespace
Definition
print.h:11
cgv::math::cubic_hermite_curve
Definition
hermite.h:18
cgv::math::cubic_hermite_curve::n0
hermite_node< PointT > n0
the start node
Definition
hermite.h:20
cgv::math::cubic_hermite_curve::n1
hermite_node< PointT > n1
the end node
Definition
hermite.h:22
cgv::math::hermite_node
Definition
hermite.h:12
cgv
math
hermite.h
Generated by
1.9.8