Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Institute of Technical Acoustics (ITA)
ITABase
Commits
8af234d1
Commit
8af234d1
authored
Aug 13, 2020
by
Philipp Schäfer
Browse files
Math::CubicSpline
- fixed input parameter checks and exception messages
parent
4c7fe97b
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/ITABase/Math/Spline.cpp
View file @
8af234d1
...
...
@@ -19,18 +19,18 @@ CPiecewisePolynomial Math::CubicSpline(const std::vector<float>& vdSupportingPoi
if
(
vdSupportingPoints
.
size
()
!=
vdDataPoints
.
size
())
ITA_EXCEPT_INVALID_PARAMETER
(
"vdSupportingPoints and vdDataPoints need to have the same size"
);
if
(
vdSupportingPoints
.
size
()
<
2
)
ITA_EXCEPT_INVALID_PARAMETER
(
"vdSupportingPoints and vdDataPoints need to contain at least
3
elements"
);
if
(
vdSupportingPoints
.
size
()
<
4
)
ITA_EXCEPT_INVALID_PARAMETER
(
"vdSupportingPoints and vdDataPoints need to contain at least
4
elements"
);
//Calculate h_i, formular 1.27b
int
iPolynomialOrder
=
3
;
int
iPoints
=
vdSupportingPoints
.
size
();
const
int
iPolynomialOrder
=
3
;
const
int
iPoints
=
vdSupportingPoints
.
size
();
std
::
vector
<
float
>
vdH
(
iPoints
-
1
);
for
(
int
i
=
0
;
i
<
iPoints
-
1
;
i
++
)
{
vdH
[
i
]
=
vdSupportingPoints
[
i
+
1
]
-
vdSupportingPoints
[
i
];
if
(
vdH
[
i
]
<
0
)
{
ITA_EXCEPT_INVALID_PARAMETER
(
"vdSupportingPoints needs to be sorted in ascending order"
);
if
(
vdH
[
i
]
<
=
0
)
{
ITA_EXCEPT_INVALID_PARAMETER
(
"vdSupportingPoints needs to be sorted in ascending order
and not be duplicates
"
);
}
}
...
...
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