Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Jason Chemin
curves
Commits
ea8ac10c
Commit
ea8ac10c
authored
Aug 09, 2019
by
JasonChmn
Committed by
Pierre Fernbach
Sep 03, 2019
Browse files
[Indentation] Reindentation of all the code - 2
parent
13089d03
Changes
7
Hide whitespace changes
Inline
Side-by-side
include/curves/bezier_curve.h
View file @
ea8ac10c
...
...
@@ -31,8 +31,8 @@ namespace curves
/// For degree lesser than 4, the evaluation is analitycal. Otherwise
/// the bernstein polynoms are used to evaluate the spline at a given location.
///
template
<
typename
Time
=
double
,
typename
Numeric
=
Time
,
std
::
size_t
Dim
=
3
,
bool
Safe
=
false
,
typename
Point
=
Eigen
::
Matrix
<
Numeric
,
Eigen
::
Dynamic
,
1
>
>
template
<
typename
Time
=
double
,
typename
Numeric
=
Time
,
std
::
size_t
Dim
=
3
,
bool
Safe
=
false
,
typename
Point
=
Eigen
::
Matrix
<
Numeric
,
Eigen
::
Dynamic
,
1
>
>
struct
bezier_curve
:
public
curve_abc
<
Time
,
Numeric
,
Safe
,
Point
>
,
public
serialization
::
Serializable
<
bezier_curve
<
Time
,
Numeric
,
Dim
,
Safe
,
Point
>
>
{
...
...
include/curves/cubic_hermite_spline.h
View file @
ea8ac10c
...
...
@@ -35,8 +35,7 @@ namespace curves
///
template
<
typename
Time
=
double
,
typename
Numeric
=
Time
,
std
::
size_t
Dim
=
3
,
bool
Safe
=
false
,
typename
Point
=
Eigen
::
Matrix
<
Numeric
,
Eigen
::
Dynamic
,
1
>,
typename
Tangent
=
Eigen
::
Matrix
<
Numeric
,
Eigen
::
Dynamic
,
1
>
>
typename
Tangent
=
Eigen
::
Matrix
<
Numeric
,
Eigen
::
Dynamic
,
1
>
>
struct
cubic_hermite_spline
:
public
curve_abc
<
Time
,
Numeric
,
Safe
,
Point
>
,
public
serialization
::
Serializable
<
cubic_hermite_spline
<
Time
,
Numeric
,
Dim
,
Safe
,
Point
,
Tangent
>
>
{
...
...
include/curves/cubic_spline.h
View file @
ea8ac10c
...
...
@@ -22,27 +22,27 @@
namespace
curves
{
/// \brief Creates coefficient vector of a cubic spline defined on the interval
/// \f$[t_{min}, t_{max}]\f$. It follows the equation : <br>
/// \f$ x(t) = a + b(t - t_{min}) + c(t - t_{min})^2 + d(t - t_{min})^3 \f$ where \f$ t \in [t_{min}, t_{max}] \f$
/// with a, b, c and d the control points.
///
template
<
typename
Point
,
typename
T_Point
>
T_Point
make_cubic_vector
(
Point
const
&
a
,
Point
const
&
b
,
Point
const
&
c
,
Point
const
&
d
)
{
T_Point
res
;
res
.
push_back
(
a
);
res
.
push_back
(
b
);
res
.
push_back
(
c
);
res
.
push_back
(
d
);
return
res
;
}
template
<
typename
Time
,
typename
Numeric
,
std
::
size_t
Dim
,
bool
Safe
,
typename
Point
,
typename
T_Point
>
polynomial
<
Time
,
Numeric
,
Dim
,
Safe
,
Point
,
T_Point
>
create_cubic
(
Point
const
&
a
,
Point
const
&
b
,
Point
const
&
c
,
Point
const
&
d
,
const
Time
t_min
,
const
Time
t_max
)
{
T_Point
coeffs
=
make_cubic_vector
<
Point
,
T_Point
>
(
a
,
b
,
c
,
d
);
return
polynomial
<
Time
,
Numeric
,
Dim
,
Safe
,
Point
,
T_Point
>
(
coeffs
.
begin
(),
coeffs
.
end
(),
t_min
,
t_max
);
}
/// \brief Creates coefficient vector of a cubic spline defined on the interval
/// \f$[t_{min}, t_{max}]\f$. It follows the equation : <br>
/// \f$ x(t) = a + b(t - t_{min}) + c(t - t_{min})^2 + d(t - t_{min})^3 \f$ where \f$ t \in [t_{min}, t_{max}] \f$
/// with a, b, c and d the control points.
///
template
<
typename
Point
,
typename
T_Point
>
T_Point
make_cubic_vector
(
Point
const
&
a
,
Point
const
&
b
,
Point
const
&
c
,
Point
const
&
d
)
{
T_Point
res
;
res
.
push_back
(
a
);
res
.
push_back
(
b
);
res
.
push_back
(
c
);
res
.
push_back
(
d
);
return
res
;
}
template
<
typename
Time
,
typename
Numeric
,
std
::
size_t
Dim
,
bool
Safe
,
typename
Point
,
typename
T_Point
>
polynomial
<
Time
,
Numeric
,
Dim
,
Safe
,
Point
,
T_Point
>
create_cubic
(
Point
const
&
a
,
Point
const
&
b
,
Point
const
&
c
,
Point
const
&
d
,
const
Time
t_min
,
const
Time
t_max
)
{
T_Point
coeffs
=
make_cubic_vector
<
Point
,
T_Point
>
(
a
,
b
,
c
,
d
);
return
polynomial
<
Time
,
Numeric
,
Dim
,
Safe
,
Point
,
T_Point
>
(
coeffs
.
begin
(),
coeffs
.
end
(),
t_min
,
t_max
);
}
}
// namespace curves
#endif //_STRUCT_CUBICSPLINE
include/curves/curve_constraint.h
View file @
ea8ac10c
...
...
@@ -19,19 +19,19 @@
namespace
curves
{
template
<
typename
Point
,
std
::
size_t
Dim
=
3
>
struct
curve_constraints
{
typedef
Point
point_t
;
curve_constraints
()
:
init_vel
(
point_t
::
Zero
(
Dim
)),
init_acc
(
init_vel
),
end_vel
(
init_vel
),
end_acc
(
init_vel
){}
template
<
typename
Point
,
std
::
size_t
Dim
=
3
>
struct
curve_constraints
{
typedef
Point
point_t
;
curve_constraints
()
:
init_vel
(
point_t
::
Zero
(
Dim
)),
init_acc
(
init_vel
),
end_vel
(
init_vel
),
end_acc
(
init_vel
){}
~
curve_constraints
(){}
~
curve_constraints
(){}
point_t
init_vel
;
point_t
init_acc
;
point_t
end_vel
;
point_t
end_acc
;
};
point_t
init_vel
;
point_t
init_acc
;
point_t
end_vel
;
point_t
end_acc
;
};
}
// namespace curves
#endif //_CLASS_CUBICZEROVELACC
include/curves/polynomial.h
View file @
ea8ac10c
...
...
@@ -39,10 +39,10 @@ namespace curves
struct
polynomial
:
public
curve_abc
<
Time
,
Numeric
,
Safe
,
Point
>
,
public
serialization
::
Serializable
<
polynomial
<
Time
,
Numeric
,
Dim
,
Safe
,
Point
,
T_Point
>
>
{
typedef
Point
point_t
;
typedef
Point
point_t
;
typedef
T_Point
t_point_t
;
typedef
Time
time_t
;
typedef
Numeric
num_t
;
typedef
Time
time_t
;
typedef
Numeric
num_t
;
typedef
curve_abc
<
Time
,
Numeric
,
Safe
,
Point
>
curve_abc_t
;
typedef
Eigen
::
Matrix
<
double
,
Dim
,
Eigen
::
Dynamic
>
coeff_t
;
typedef
Eigen
::
Ref
<
coeff_t
>
coeff_t_ref
;
...
...
include/curves/quintic_spline.h
View file @
ea8ac10c
...
...
@@ -22,28 +22,28 @@
namespace
curves
{
/// \brief Creates coefficient vector of a quintic spline defined on the interval
/// \f$[t_{min}, t_{max}]\f$. It follows the equation :<br>
/// \f$ x(t) = a + b(t - t_{min}) + c(t - t_{min})^2 + d(t - t_{min})^3 + e(t - t_{min})^4 + f(t - t_{min})^5 \f$ <br>
/// where \f$ t \in [t_{min}, t_{max}] \f$.
///
template
<
typename
Point
,
typename
T_Point
>
T_Point
make_quintic_vector
(
Point
const
&
a
,
Point
const
&
b
,
Point
const
&
c
,
Point
const
&
d
,
Point
const
&
e
,
Point
const
&
f
)
{
T_Point
res
;
res
.
push_back
(
a
);
res
.
push_back
(
b
);
res
.
push_back
(
c
);
res
.
push_back
(
d
);
res
.
push_back
(
e
);
res
.
push_back
(
f
);
return
res
;
}
template
<
typename
Time
,
typename
Numeric
,
std
::
size_t
Dim
,
bool
Safe
,
typename
Point
,
typename
T_Point
>
polynomial
<
Time
,
Numeric
,
Dim
,
Safe
,
Point
,
T_Point
>
create_quintic
(
Point
const
&
a
,
Point
const
&
b
,
Point
const
&
c
,
Point
const
&
d
,
Point
const
&
e
,
Point
const
&
f
,
const
Time
t_min
,
const
Time
t_max
)
{
T_Point
coeffs
=
make_quintic_vector
<
Point
,
T_Point
>
(
a
,
b
,
c
,
d
,
e
,
f
);
return
polynomial
<
Time
,
Numeric
,
Dim
,
Safe
,
Point
,
T_Point
>
(
coeffs
.
begin
(),
coeffs
.
end
(),
t_min
,
t_max
);
}
/// \brief Creates coefficient vector of a quintic spline defined on the interval
/// \f$[t_{min}, t_{max}]\f$. It follows the equation :<br>
/// \f$ x(t) = a + b(t - t_{min}) + c(t - t_{min})^2 + d(t - t_{min})^3 + e(t - t_{min})^4 + f(t - t_{min})^5 \f$ <br>
/// where \f$ t \in [t_{min}, t_{max}] \f$.
///
template
<
typename
Point
,
typename
T_Point
>
T_Point
make_quintic_vector
(
Point
const
&
a
,
Point
const
&
b
,
Point
const
&
c
,
Point
const
&
d
,
Point
const
&
e
,
Point
const
&
f
)
{
T_Point
res
;
res
.
push_back
(
a
);
res
.
push_back
(
b
);
res
.
push_back
(
c
);
res
.
push_back
(
d
);
res
.
push_back
(
e
);
res
.
push_back
(
f
);
return
res
;
}
template
<
typename
Time
,
typename
Numeric
,
std
::
size_t
Dim
,
bool
Safe
,
typename
Point
,
typename
T_Point
>
polynomial
<
Time
,
Numeric
,
Dim
,
Safe
,
Point
,
T_Point
>
create_quintic
(
Point
const
&
a
,
Point
const
&
b
,
Point
const
&
c
,
Point
const
&
d
,
Point
const
&
e
,
Point
const
&
f
,
const
Time
t_min
,
const
Time
t_max
)
{
T_Point
coeffs
=
make_quintic_vector
<
Point
,
T_Point
>
(
a
,
b
,
c
,
d
,
e
,
f
);
return
polynomial
<
Time
,
Numeric
,
Dim
,
Safe
,
Point
,
T_Point
>
(
coeffs
.
begin
(),
coeffs
.
end
(),
t_min
,
t_max
);
}
}
// namespace curves
#endif //_STRUCT_QUINTIC_SPLINE
python/python_definitions.h
View file @
ea8ac10c
...
...
@@ -8,33 +8,33 @@
namespace
curves
{
typedef
double
real
;
typedef
Eigen
::
Vector3d
point_t
;
typedef
Eigen
::
Vector3d
tangent_t
;
typedef
Eigen
::
VectorXd
vectorX_t
;
typedef
std
::
pair
<
point_t
,
tangent_t
>
pair_point_tangent_t
;
typedef
Eigen
::
Matrix
<
double
,
6
,
1
,
0
,
6
,
1
>
point6_t
;
typedef
Eigen
::
Matrix
<
double
,
3
,
1
,
0
,
3
,
1
>
ret_point_t
;
typedef
Eigen
::
Matrix
<
double
,
6
,
1
,
0
,
6
,
1
>
ret_point6_t
;
typedef
Eigen
::
VectorXd
time_waypoints_t
;
typedef
Eigen
::
Matrix
<
real
,
3
,
Eigen
::
Dynamic
>
point_list_t
;
typedef
Eigen
::
Matrix
<
real
,
6
,
Eigen
::
Dynamic
>
point_list6_t
;
typedef
std
::
vector
<
point_t
,
Eigen
::
aligned_allocator
<
point_t
>
>
t_point_t
;
typedef
std
::
vector
<
point6_t
,
Eigen
::
aligned_allocator
<
point6_t
>
>
t_point6_t
;
typedef
std
::
pair
<
real
,
point_t
>
Waypoint
;
typedef
std
::
vector
<
Waypoint
>
T_Waypoint
;
typedef
std
::
pair
<
real
,
point6_t
>
Waypoint6
;
typedef
std
::
vector
<
Waypoint6
>
T_Waypoint6
;
typedef
double
real
;
typedef
Eigen
::
Vector3d
point_t
;
typedef
Eigen
::
Vector3d
tangent_t
;
typedef
Eigen
::
VectorXd
vectorX_t
;
typedef
std
::
pair
<
point_t
,
tangent_t
>
pair_point_tangent_t
;
typedef
Eigen
::
Matrix
<
double
,
6
,
1
,
0
,
6
,
1
>
point6_t
;
typedef
Eigen
::
Matrix
<
double
,
3
,
1
,
0
,
3
,
1
>
ret_point_t
;
typedef
Eigen
::
Matrix
<
double
,
6
,
1
,
0
,
6
,
1
>
ret_point6_t
;
typedef
Eigen
::
VectorXd
time_waypoints_t
;
typedef
Eigen
::
Matrix
<
real
,
3
,
Eigen
::
Dynamic
>
point_list_t
;
typedef
Eigen
::
Matrix
<
real
,
6
,
Eigen
::
Dynamic
>
point_list6_t
;
typedef
std
::
vector
<
point_t
,
Eigen
::
aligned_allocator
<
point_t
>
>
t_point_t
;
typedef
std
::
vector
<
point6_t
,
Eigen
::
aligned_allocator
<
point6_t
>
>
t_point6_t
;
typedef
std
::
pair
<
real
,
point_t
>
Waypoint
;
typedef
std
::
vector
<
Waypoint
>
T_Waypoint
;
typedef
std
::
pair
<
real
,
point6_t
>
Waypoint6
;
typedef
std
::
vector
<
Waypoint6
>
T_Waypoint6
;
template
<
typename
PointList
,
typename
T_Point
>
T_Point
vectorFromEigenArray
(
const
PointList
&
array
)
{
T_Point
res
;
for
(
int
i
=
0
;
i
<
array
.
cols
();
++
i
)
{
res
.
push_back
(
array
.
col
(
i
));
}
return
res
;
}
template
<
typename
PointList
,
typename
T_Point
>
T_Point
vectorFromEigenArray
(
const
PointList
&
array
)
{
T_Point
res
;
for
(
int
i
=
0
;
i
<
array
.
cols
();
++
i
)
{
res
.
push_back
(
array
.
col
(
i
));
}
return
res
;
}
}
//namespace curves
#endif //_DEFINITION_PYTHON_BINDINGS
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment