Upload
bertram-moody
View
221
Download
0
Tags:
Embed Size (px)
Citation preview
L5 – Curves in GIS
NGEN06 & TEK230: Algorithms in Geographical Information Systems
by: Sadegh Jamali (source: Lecture notes in GIS, Lars Harrie)1
L5- Curves in GIS
2
L5- Curves in GIS
Aim
… to provide a background to how curves can be used to represent line objects in GIS.
Content
1. Overview
2. Interpolation of mathematical functions
3. Piecewise polynomials
4. Hermite interpolation
5. Cubic spline
6. Curves in the plane
7. Curves in Geography Markup Language (GML)
3
L5- Curves in GIS
Overview
Most mapping software handles vector data as line strings (i.e. straight line segments between vertices).
Fig. a line string
Drawback: too angular!
4
L5- Curves in GIS
Overview
Limitation of the solid curve: we can only describe curves with increasing x-values.
Solid: a curve with allowed mathematical functiony=f(x)
Dashed: a general curve in the plane
5
L5- Curves in GIS
Interpolation of mathematical functions
Fitting a polynomial:
In general, a polynomial of degree n can be adapted to pass through n+1 points.
How to compute the unknown parameters ()?
the polynomial must pass through ALL the points.
A polynomial of degree n is written as:
6
L5- Curves in GIS
Example: create a 3rd order polynomial that passes through the 4 points in the table.
𝐴 .𝑋=𝐿
Non-singular system:
Singular system
𝑋=¿
Linear system of equations:
3rd order polynomial
7
L5- Curves in GIS
The fitted polynomial of 3rd degree to the points
The points
8
L5- Curves in GIS
Problems in adapting polynomials of high degrees
Red curve: Runge function
Blue curve: a 5th-order interpolating polynomial (using six equally spaced interpolating points)
Green curve: a 9th-order interpolating polynomial (using ten equally spaced interpolating points).
Example: approximate the Runge’s function (between -1 and +1) using polynomials
Runge’s function
Runge’s fucntion
degree= 9
degree= 5
9
L5- Curves in GIS
Runge’s phenomenon
Error=0; at the interpolating points
Error >>0; between the interpolating points (especially in the region close to the endpoints 1 and −1 for higher-order polynomials.
Problems at the ends of the area or fluctuating severely in the border areas of the interval
10
L5- Curves in GIS
Piecewise polynomials
As seen, if we want the polynomial to pass many points we have to use a polynomial with high degree, but that will provide undesired effects especially in the border areas of the interval.
Solution? using several piecewise polynomials with lower degrees
Figure: a curve constituted of three polynomials (normally degree 3) between each two following points.
1st polynomial
2nd polynomial
3rd polynomial
11
L5- Curves in GIS
The piecewise curves are always continuous within themselves.
But the problem here is how to get good properties at the connection points
between the polynomials.
the curves that guarantee that the first order derivatives(and sometimes also the second order derivatives) are continuous also at the connection points.
Solution? Hermite interpolation and cubic splines:
12
L5- Curves in GIS
Hermite interpolation
… based on interpolation with piecewise polynomials (3rd degree).
Requirements:
1) the interpolated curve must pass through all points (each 2 following points)
2) the first order derivative must be continuous EVERYWHERE.
13
L5- Curves in GIS
Polynomial in Hermite interpolation:
Figure: parameters in Hermite interpolation
14
L5- Curves in GIS
Question: dose this polynomial really satisfy the requirements ?
Requirements:
1) the interpolated curve must pass through all points (each 2 points)
If we apply this to the first polynomial (): we get that at the start point () and at the end point of the first polynomial ().
15
L5- Curves in GIS
Requirements:
2) the first order derivative must be continuous everywhere.
The derivative of with respect to :
This function is continuous within a polynomial. Question: but what happens between the polynomials?
the derivatives at the start and end points:
16
L5- Curves in GIS
Be aware that the result of the derivative with respect of t contain an h factor, which is the scaling factor between t and x. This implies that the derivative with respect to x is equal to k. That is we obtain for the first
polynomial (in the Figure) that the derivative at the start point is k1 and that
the derivative at the end point is k2, which is correct.
So all the constraints are satisfied and, hence, the
equation provides the Hermite interpolation.
L5- Curves in GIS
Example: create Hermite interpolation of the points and first order
derivatives in the given Table
Figure: Hermite interpolation: the solid line is the curve for the first order derivative (der1) and the dashed line is the curve for the first order derivative (der2).
soliddashed
17
L5- Curves in GIS
Calculation of derivatives at the points:
m = the number of points (here m =4). The first and last derivatives are set by using the slope to the nearest point.
Note: the derivatives der2 in the table were derived using the above method.
18
A standard method is to use the following differences:
L5- Curves in GIS
Cubic spline
A piecewise 3rd order polynomial; a type of Hermite interpolation with additional requirements that the second order derivatives are continuous everywhere.
For a curve with m points:m-1 piecewise cubic polynomials 4(m-1) unknown parameterspassing the start and end points in all the intervals 2(m-1) constraints Hermite’s requirement for the first order derivatives m-2 constraints requirement for the second order derivatives m-2 constraints
Degree of freedom: 4(m-1) - ( 2(m-1) + (m-2)+ (m-2)) = 2
19
L5- Curves in GIS
Cubic spline
Ways of setting the two last constraints?
Clamped cubic spline: the first order derivatives at the start and end points of the whole curve are given.
Natural cubic spline: the second order derivatives are zero at the start and end points of the whole curve.
20
L5- Curves in GIS
How to compute natural cubic splines?
1) compute values for the first order derivatives () by solving the following linear system equations.
21
L5- Curves in GIS
2) apply the Hermite interpolation function
22
L5- Curves in GIS
Example: compute the natural cubic splines for the points given in previous example
Note: the curve is smoother than the other Hermite interpolations due to the requirement of continuous second order derivatives
23
Figure: Natural cubic spline interpolation of the points. The first order derivatives at the points are given in the table above.
L5- Curves in GIS
Curves in the planeThis needs a more general expression than interpolations methods because x-values can decrease too
Parametric representation x=x(t) and y=y(t) where t is a local variable. Normally t goes from 0 to 1.
Figure: Parametric representation of a curve in the plane. 24
L5- Curves in GIS
General expressions for the curve the curves in the plane are represented using cubic polynomials
Matrix form:
25
L5- Curves in GIS
Hermite curves All of the properties of the Hermite interpolation are also valid for the Hermite curves.
Hermite curves in Matrix form:
Where Pi are the end pointsRi are the tangent vectors of the same curve
26
L5- Curves in GIS
Figure: Hermite curves in the plane for two end points (dots) but with different tangent vectors (arrows).
Example: Hermite curves in the plane
27
L5- Curves in GIS
Bezier curves … are similar to the Hermite curves but with known directions for the curve at the start and end points.
where P1 and P4 are the end points of the curves, and P2 and P3 are points that show the direction of the curves at the end points
Figure: Bezier curves in the plane. 28
L5- Curves in GIS
Spline curves in the planeThe mathematical description of these curves is complicated!
Figure: Uniform non-rational B-splines in the plane
Uniform non-rational B-splines: …. one example of a spline curve.
29
L5- Curves in GIS
Curves in Geography Markup Language (GML)
GML: defined by Open Geospatial Consortium (OGC) standard is a XML-based grammar for the representation of geospatial data.
A GML Schema allows users and developers to describe geographic
data sets that contain points, lines and polygons and exchange them between
themselves.
30
L5- Curves in GIS
Curves supported by GML:
• Arc • Circle • ArcByCenterPoint • CubicSpline • B-Spline • Bezier
Figure: An arc element specified by three points.
31