View
29
Download
0
Category
Preview:
DESCRIPTION
Softwareprojekt über Anwendungen effizienter Algorithmen, WS 2012/2013 Prof . Dr . Günter Rote. Kurvenapproximation. Team 3: Stefan Behrendt, Ralf Öchsner, Ying Wei. SWP Anwendungen von AlgorithmenTeam 3 . Outline. Our task Technique Technologies Flow of process - PowerPoint PPT Presentation
Citation preview
1
Softwareprojekt über Anwendungen effizienter Algorithmen, WS 2012/2013
Prof. Dr. Günter Rote
Kurvenapproximation
SWP Anwendungen von Algorithmen Team 3
Team 3: Stefan Behrendt, Ralf Öchsner, Ying Wei
2SWP Anwendungen von Algorithmen Team 3
Our task Technique
• Technologies• Flow of process
Preparations for Greedy approach Greedy approach Analysis Demo
….
Outline
3SWP Anwendungen von Algorithmen Team 3
Our task Approximation of point sequences by spline
Input : The points with an order A predefined tolerance error
Output : A Curve, which goes through the selected points from original given points and can sufficiently good approximate the original point sequence
4
Technologies : C++, Lua, IPE QT Cubic Hermite spline, Cubic Bezier spline, Interpolation Greedy Algorithm
SWP Anwendungen von Algorithmen Team 3
Technique
5
Technique
SWP Anwendungen von Algorithmen Team 3
Flow of process
Calculate all Tangents of original given Points
1) Convert Selected Hermite Points & Tangents to Bezier control points
2) Then draw curve again by Bezier cubic spline
1) Convert given points and computed Tangents to Bezier control points in order to prepare with Greedy
2) Select points & Tangents using Greedy
Add spline into IPE for display
6SWP Anwendungen von Algorithmen Team 3
Tangents Calculation i is index of given points (points[i]), n is the size of given points
for (i=0; i <n; i++) if (i==0) thenelse if (i==n-1) thenelseend if
T(n)=n
7SWP Anwendungen von Algorithmen Team 3
Preparations for Greedy Approach
n=size of given points; T(n)=nis defined as maximal error from beginning to the current position :
m=size of cPoints; T(n)=n, , is defined as minimal distance between points[i] and cubic Bezier interpolating points:
, where
: cubic Bezier Curve. T(n)=1Let , interpolating could be realized.
8SWP Anwendungen von Algorithmen Team 3
Greedy Approach1). Add points[0] and its tangent into hermitePoint[0] and tangents[0]
2). for (i=1 to (size of given points -1), i++)
2.1) Add points[i] and its tangent into hermitePoint[i] and tangents[i]
2.2) Convert hermite points and tangents to cubic Bezier control points i=0;
for(j=1 to (size of hermitePoints -1), j++)
i++;
9SWP Anwendungen von Algorithmen Team 3
Greedy Approach2.3) select points and tangents2.3.1) if the error in the position i ≤ tolerance error ε , and i isn’t end position
( errorUntil(i) < maxError && i != (size of points -1) )
then a.) Adjust the length of tangent
, where
b.) Remove this point from hermitePoints[end];
Remove its tangents from tangents[end];
10
2.3.2) else if at the end, and the error >maxError
(i==(size of points-1) && (errorUntil(i)>Error)) then insert points[i-1] into hermite[end-1];
insert tangent[i-1] into tangents[end-1];2.3.3) else (when the error > maxError),
insert points[i-1] into hermitePoints[end-1];insert tangent[i-1] into tangents[end-1];
3) Convert the selected hermitePoints to cPoints again. Method is the same with 2.2) T(n)=n
4) add bezier spline to IPE
Greedy Approach
SWP Anwendungen von Algorithmen Team 3
11SWP Anwendungen von Algorithmen Team 3
Analysis Runtime:
n is the size of inputs• Tangents Calculation : O(n)• Greedy approach : O(n*n)• Convert selected hermitePoints to cPoints : O(n)
Memory requirements := In worse case, memory requirements :=
12SWP Anwendungen von Algorithmen Team 3
Demo
DEMO…
13
Thanks For Attention!
Questions and Suggestions for improvement?
SWP Anwendungen von Algorithmen Team 3
Recommended