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
Guilhem Saurel
ndcurves
Commits
841fbabf
Commit
841fbabf
authored
Jan 23, 2020
by
Pierre Fernbach
Committed by
Pierre Fernbach
Feb 10, 2020
Browse files
[Python] piecewise::curve_at_index do not return reference anymore, update Python bindings
parent
d763f604
Changes
2
Hide whitespace changes
Inline
Side-by-side
include/curves/piecewise_curve.h
View file @
841fbabf
...
...
@@ -212,9 +212,9 @@ struct piecewise_curve : public curve_abc<Time, Numeric, Safe, Point, Point_deri
std
::
size_t
num_curves
()
const
{
return
curves_
.
size
();
}
const
curve_ptr_t
&
curve_at_time
(
const
time_t
t
)
const
{
return
curves_
[
find_interval
(
t
)];
}
curve_ptr_t
curve_at_time
(
const
time_t
t
)
const
{
return
curves_
[
find_interval
(
t
)];
}
const
curve_ptr_t
&
curve_at_index
(
const
std
::
size_t
idx
)
const
{
curve_ptr_t
curve_at_index
(
const
std
::
size_t
idx
)
const
{
if
(
Safe
&&
idx
>=
num_curves
())
{
throw
std
::
length_error
(
"curve_at_index: requested index greater than number of curves in piecewise_curve instance"
);
...
...
python/curves/curves_python.cpp
View file @
841fbabf
...
...
@@ -239,6 +239,14 @@ static piecewise_t discretPointToPolynomialC2(const pointX_list_t& points, const
points_list
,
points_derivative_list
,
points_second_derivative_list
,
time_points_list
);
}
curve_abc_t
*
getCurveAtIndex
(
piecewise_t
&
self
,
const
std
::
size_t
idx
){
return
self
.
curve_at_index
(
idx
).
get
();
}
curve_abc_t
*
getCurveAtTime
(
piecewise_t
&
self
,
const
time_t
t
){
return
self
.
curve_at_time
(
t
).
get
();
}
void
addFinalPointC0
(
piecewise_t
&
self
,
const
pointX_t
&
end
,
const
real
time
)
{
if
(
self
.
num_curves
()
==
0
)
throw
std
::
runtime_error
(
...
...
@@ -741,8 +749,8 @@ BOOST_PYTHON_MODULE(curves) {
.
def
(
"convert_piecewise_curve_to_cubic_hermite"
,
&
piecewise_t
::
convert_piecewise_curve_to_cubic_hermite
<
cubic_hermite_spline_t
>
,
"Convert a piecewise curve to to a piecewise cubic hermite spline"
)
.
def
(
"curve_at_index"
,
&
piecewise_t
::
curve_at_index
,
return_value_policy
<
copy_const
_reference
>
())
.
def
(
"curve_at_time"
,
&
piecewise_t
::
curve_at_time
,
return_value_policy
<
copy_const
_reference
>
())
.
def
(
"curve_at_index"
,
&
getCurveAtIndex
,
return_internal
_reference
<
>
())
.
def
(
"curve_at_time"
,
&
getCurveAtTime
,
return_internal
_reference
<
>
())
.
def
(
"num_curves"
,
&
piecewise_t
::
num_curves
)
.
def
(
"saveAsText"
,
&
piecewise_t
::
saveAsText
<
piecewise_t
>
,
bp
::
args
(
"filename"
),
"Saves *this inside a text file."
)
...
...
@@ -769,8 +777,8 @@ BOOST_PYTHON_MODULE(curves) {
"where T_{min} is equal toT_{max} of the actual piecewise curve."
)
.
def
(
"is_continuous"
,
&
piecewise_bezier_t
::
is_continuous
,
"Check if the curve is continuous at the given order."
,
args
(
"self,order"
))
.
def
(
"curve_at_index"
,
&
piecewise_bezier_t
::
curve_at_index
,
return_value_policy
<
copy_const
_reference
>
())
.
def
(
"curve_at_time"
,
&
piecewise_bezier_t
::
curve_at_time
,
return_value_policy
<
copy_const
_reference
>
())
.
def
(
"curve_at_index"
,
&
getCurveAtIndex
,
return_internal
_reference
<
>
())
.
def
(
"curve_at_time"
,
&
getCurveAtTime
,
return_internal
_reference
<
>
())
.
def
(
"num_curves"
,
&
piecewise_bezier_t
::
num_curves
)
.
def
(
"saveAsText"
,
&
piecewise_bezier_t
::
saveAsText
<
piecewise_bezier_t
>
,
bp
::
args
(
"filename"
),
"Saves *this inside a text file."
)
...
...
@@ -797,8 +805,8 @@ BOOST_PYTHON_MODULE(curves) {
"where T_{min} is equal toT_{max} of the actual piecewise curve."
)
.
def
(
"is_continuous"
,
&
piecewise_linear_bezier_t
::
is_continuous
,
"Check if the curve is continuous at the given order."
,
args
(
"self,order"
))
.
def
(
"curve_at_index"
,
&
piecewise_linear_bezier_t
::
curve_at_index
,
return_value_policy
<
copy_const
_reference
>
())
.
def
(
"curve_at_time"
,
&
piecewise_linear_bezier_t
::
curve_at_time
,
return_value_policy
<
copy_const
_reference
>
())
.
def
(
"curve_at_index"
,
&
getCurveAtIndex
,
return_internal
_reference
<
>
())
.
def
(
"curve_at_time"
,
&
getCurveAtTime
,
return_internal
_reference
<
>
())
.
def
(
"num_curves"
,
&
piecewise_linear_bezier_t
::
num_curves
)
.
def
(
"saveAsText"
,
&
piecewise_linear_bezier_t
::
saveAsText
<
piecewise_linear_bezier_t
>
,
bp
::
args
(
"filename"
),
"Saves *this inside a text file."
)
...
...
@@ -825,8 +833,8 @@ BOOST_PYTHON_MODULE(curves) {
args
(
"self,curve"
))
.
def
(
"is_continuous"
,
&
piecewise_SE3_t
::
is_continuous
,
"Check if the curve is continuous at the given order."
,
args
(
"self,order"
))
.
def
(
"curve_at_index"
,
&
piecewise_SE3_t
::
curve_at_index
,
return_value_policy
<
copy_const
_reference
>
())
.
def
(
"curve_at_time"
,
&
piecewise_SE3_t
::
curve_at_time
,
return_value_policy
<
copy_const
_reference
>
())
.
def
(
"curve_at_index"
,
&
getCurveAtIndex
,
return_internal
_reference
<
>
())
.
def
(
"curve_at_time"
,
&
getCurveAtTime
,
return_internal
_reference
<
>
())
.
def
(
"num_curves"
,
&
piecewise_SE3_t
::
num_curves
)
.
def
(
"append"
,
&
addFinalTransform
,
"Append a new linear SE3 curve at the end of the piecewise curve, defined between self.max() "
...
...
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