chapter 2 theoretical foundations of cac
DESCRIPTION
Chapter 2 Theoretical foundations of CAC. Contents :. 2.1 Primary geometry and algorithm 2.2 graph theory 2.3 computational geometry 2.4 basic approaches of image processing 2.5 digital earth model. 2.1 primary geometry and algorithm. Relations between CAC geometry elements :. 点. 点. - PowerPoint PPT PresentationTRANSCRIPT
Chapter 2 Theoretical foundations of CAC
Contents :2.1 Primary geometry and algorithm
2.2 graph theory
2.3 computational geometry
2.4 basic approaches of image processing
2.5 digital earth model
2.1 primary geometry and algorithm
Relations between CAC geometry elements :
点
线
面
点
线
面
1. Relationship of point and lineTopology relationship between point and line
Point on the line
Point off the line
Research emphasis : relationship between point and line segment, judge approach for the topology relationship between point and line, the calculation of distance between point and line
Given a straight line, Its formula is , Then for Function ,select any point in the space, it has:
1.1 The relationship judgment between point and line
0 CByAxCByAxyxf ),(
),( 00 yxm
The importance of judging the relationship between point and line
1.2 The judge approach for point and line relationship
One purpose of judging point and line relationship is to decide whether a point is on a line
Figure 2-1 judgment of point and line relationship(dot line is projection rectangle)
A
p1
P2
P3
P4
P5
P6
B
1.3 The distance between point and line
A
p1
p2
( a )
Ap1
p2
( b )
Figure 2-2 Two situations of the minimal distance between point and line segment
The distance between point and line segment may be the distance between the point and one end of the line. It may be the vertical distance between the point and the line segment.
p1
P2P3
P4
P5
D
A最远距离
最近距离
Figure 2-3 The maximum and minimal distance between point and line segment
2. line-line relationship
相离 共位 相交
The foundation of line-line relationship judgment : intersection
figure2-4 monotonic links segmentation and its projection
rectangle
l1
l2
l3
l4
l5
l6
k1
k2
k3
LK
The judgment of intersection of two 折线
The first step : generate monotonic links
The second step : calculate minimal projection rectangle for every monotonic link
The third step : comparison
3.Point and plane relationship
Figure 2-5: point and triangle position
relationship
1111 ),( cybxayxf
2222 ),( cybxayxf
3333 ),( cybxayxf
0),(),(
0),(),(
0),(),(
33
22
11
PPBB
PPAA
PPCC
yxfyxf
yxfyxf
yxfyxf
If satisfy :
The point P locates inside the triangle, or the point P locates outside the triangle.
ABBCCA
3.Relationship between triangle and point
void CTView::OnLButtonUp(UINT nFlags, CPoint point) {
// TODO: Add your message handler code here and/or call default
//CView::OnLButtonUp(nFlags, point);if(m_DrawCurrent==2){
float F1=f1(PointXyz[2].x,PointXyz[2].y);float F2=f2(PointXyz[0].x,PointXyz[0].y);float F3=f3(PointXyz[1].x,PointXyz[1].y);float F4=f1(float(mPointOrign.x),float(mPointOrign.y));float F5=f2(float(mPointOrign.x),float(mPointOrign.y));float F6=f3(float(mPointOrign.x),float(mPointOrign.y));if(F1*F4>0 && F2*F5>0 && F3*F6>0)
MessageBox(" 点在三角形内! ");else MessageBox(" 点在三角形外! ");
ReleaseCapture();}
}
3.2 position relationship between line and polygon
summation algorithm of judging point and polygon position relationship
Given a simple n polygon, its vertices can be represented as Pi(xi,yi) , i=1,2…,n.In addition, there are independent point A. Link point A to every vertices of the polygon and calculate the summation of 夹角 . Given that clockwise angle is positive and counter-clockwise angle is negative ,then
在多边形外点
在多边形内点A0
A21
1
11
PPPPPP n
n
iii
Figure 2-8
P1
P2
P4
P5
P6
P
P2
Figu 2-9
P3
P4
P5
P
P3
P6
P1
judging position relationship between point and polygon
Basic idea: Draw vertical line from judge point. Judge whether the point is in the polygon according to the number of the intersection points between the vertical line and the polyon. If the number is odd, then the point is in the polyon. If the number is even, then the point is out of the polygon
A1
A2
P1
P2
P3
P4
P5
Figure 2-11 judge the containing relationship between point and polygon
according to the number of the intersection points.
Is there any special case?
( a)
Figure 2-12: the intersection between the vertical line and polyon is vertex
( b)
A
AP1
P2
P3
P4
P1
P2
P3
P4
( a)
( b)
Figure 2-13 The vertical line overlaps one
side of the polygon
P1
P2
P3
P4
P5
P6
A
P1 P2 A
P3
P4P5
部分源代码:
void CDraw1View::judge2(float x, float y){ float xmax=PointXyz[0].x; float xmin=PointXyz[0].x; float ymin=PointXyz[0].y; float fy; //fy 为待判断点与直线方程的交点的纵坐标 int num=0; // 记录待判断点与直线方程的交点的数目 PointXyz[a].x=PointXyz[0].x; PointXyz[a].y=PointXyz[0].y; PointXyz[a+1].x=PointXyz[1].x;PointXyz[a+1].y=PointXyz[1].y; PointXyz[a+2].x=PointXyz[2].x; PointXyz[a+2].y=PointXyz[2].y; PointXyz[a+3].x=PointXyz[3].x; PointXyz[a+3].y=PointXyz[3].y;
for(int j=0;j<a;j++) { fy=(((x-PointXyz[j].x)*(PointXyz[j+1].y-PointXyz[j].y))/(PointXyz[j+1].x-PointXyz[j].x))+PointXyz[j].y; if(fy>=y&&((PointXyz[j].x<x&&x<PointXyz[j+1].x)||(PointXyz[j+1].x<x&&x<PointXyz[j].x))) // 纵坐标越往下,值越大
{num=num+1; continue;}
else if(x==PointXyz[j+1].x&&fy==PointXyz[j+1].y) // 交于多边形顶点时 { if(((PointXyz[j].x<x&&x<PointXyz[j+2].x)||(PointXyz[j+2].x<x&&x<PointXyz[j].x))&&Point
Xyz[j+2].y>y) // 若前后相邻的两顶点在该顶点所做铅垂线分得异侧,则 num++ num=num+1; else if(x==PointXyz[j+1].x&&x==PointXyz[j+2].x&&PointXyz[j+2].y>y)
// 若铅垂线与边部分重合 { if((PointXyz[j+3].x<x&&x<PointXyz[j].x)||(PointXyz[j].x<x&&x<PointXyz[j+3].x)) num=num+1; } }
} if(num%2==1) { MessageBox(" 点在多边形内! ");} else if(num%2==0) { MessageBox(" 点在多边形外! ");}}
4. Line and plane relationship The key problem of line and plane relationship
is to find the intersection of line and plane.
The algorithm of the intersection of line segment and polygon :
Step 1 , calculate the minimal projection rectangle of the polygon.Step 2 , judge whether any end of the line segment is in the minimal projection rectangle. If no end is in the minimal projection rectangle, the conclusion is that “line is outside the polygon”, algorithm terminates. Otherwise, go to step 3.
Step 3, judge whether there is intersection point between the line segment and each side of the polygon. If there exist intersect point, calculate and save the coordinate of the intersection point.
Step 4, sort the intersection points. Calculate the distance between each intersection point and one end of the line segment. Then sort the intersection points ordered from the small distances to large distances.
Step 5, link each intersection points and obtain the intersection line inside the polygon
p1
p6
p3
p4
p5
Figure 2-14: the rules of the intersection between line and polygon
p2
p7
p8
p9
p10
p11
p12p13
p14
Qq1
q2
q4q3 q5
q6q8
q7 q9
q10
Kk2 k3k1
H
M
5. plane-plane relationship The foundation of the calculation of the intersection between any two polygons is the algorithm that calculate intersection, differ and union of two simple polygon.
p1
p2
p3
p4p5
p6
q1
q2
q3
q4
q5
q6
q7
k1
k8
k2
k4
k5
k6
Figure 2-15 The intersection of simple polygons
k3
k7
Figure 2-17 The intersection of two complex polygons
PQ
Q0
Q1
P1
P0
P2
2.2 Graph Theory
1 、图论的起源与发展 The foundation of graph theory : The Seven Bridges of Konigsberg
Figure 2-18 The seven bridges problem
A
B C
D
question :“ can you pass each bridge one and only one time and return to the start point?”
2. 图的概念
Figure 2-19 Directed Graph
v1
v2 v3
e3e1
e2
directed edge
extreme point
Start point
End point
v1
v2 v3
e3e1
e2
Graph
Association Adjacent
v3
v1
v2 v4
v5
v6
e1
e2
e3
e4
e5
e7
e8
e6
Figure 2-20 non-simple directed graph
Circle
Parallel Edge
Symmetric Edge
Isolated Vertex
Graph containing no circle is calle forest ; connected graph not containing circle is called tree
3. Matrix representation of graph
The matrix representation of graph bridges the matrix theory and graph theory
Adjacent matrix is a effective representation approach for graph. Graph is often stored as adjacent matrix in the computer. The so-called adjacent matrix is referred to as vv order matrix.
The so called incidence matrix refers to ve order matrix
v1 v2 v3 v4 e1 e2 e3 e4 e5 e6 e7
v1 1 1 0 1 v1 1 1 2 0 0 0 0
v2 1 0 2 1 v2 1 0 0 1 0 1 1
v3 0 2 0 1 v3 0 0 0 0 1 1 1
v4 1 1 1 0 v4 0 1 0 1 1 0 0
Adjacent matrix A(G)
Incidence matrix M(G)
v1
v2v3
v4
e1
e2
e3e4
e5
e6
e7
Undirected graph matrix
v1 v2 v3 v4 e1 e2 e3 e4 e5 e6 e7
v1 1 1 0 1 v1 1 1 1 0 0 0 0
v2 0 0 2 1 v2 -1 0 0 1 0 1 1
v3 0 0 0 0 v3 0 0 0 0 -1 -1 -1
v4 0 0 1 0 v4 0 -1 0 -1 1 0 0
Adjacent matrix A(D)
Incidence matrix M(D)
v1
v2v3
v4
e1
e2
e3e4
e5
e6
e7
Directed graph matrix
( a)
7
94
5
3
2
24
3
( b)
-7
94
5
-3
2
-24
3
Figure 2-23 weighted graph. ( a ) undirected weighted graph ; ( b ) directed weighted graph
2.3 Computational Geometry
Computational Geometry is a interdisciplinary that is composed of function approximation theory, algebra geometry and computational mathematics. It study computational representation of geometry information, analysis and synthesis.
Computational geometry has significant applications in many fields such as CAD, CAM,CAC,graphics,robert technique,VLSI design.
1. Curve fitting
definition
Finding a curve that strictly go through a set of given points is a interpolation problem.
Finding a curve that approximately go through a set of given points is approximation problem.
Spatial interpolation techniques can be classified into global fitting (trend-surface analysis) and local f
itting (spline function).
Spatial interpolation can be classified into continuous Spatial interpolation can be classified into continuous spatial interpolation and discrete spatial interpolation.spatial interpolation and discrete spatial interpolation.
Interpolation methods include linear interpolation, bilinear polynomial interpolation, double cubic polynomial (spline function) interpolation, least square trend surface, Fourier series, Kriging moving average method.
2. Convex Hull
Convex Hull of Plane point set S refers to minimal convex set that contains S. Normally it is represented as CH(S).
Judging from geometry intuition, Convex Hull of S shows that the line segment linking any point in the S is completely in the convex hull. Boundary convex hull of Plane point set S BCH(S) is a convex polygon, whose vertices are in S.
Convex Hull is the most common and fundamental structure in computational geometry.
Definition :
Diameter of Convex Polygon
is also called diameter of plane point set or diameter of plane point set convex hull. It is the distance of furthest vertex pair of convex polygon.
2.1 Algorithm that finds convex hull of plane point set
Figure 2-26 Gramham Algorithm
x
Figure 2-27 Angle sequence algorithm
2.2 Algorithm that calculate diameter of convex polygon.
3.Voronoi 图 3.1 Voronoi diagram definition
Figure 2-28 Voronoi diagram of two points on the plane
L
p jp i
p 1 p 2
L 1 L r
V (p 1) V (p 2)
Given two points P1 , P2 on the plane, L is perpendicular bisector of P1P2 , L divides the plane into two parts Lr and Ll 。points in Ll has property: d(Pi , P1)<d(Pi , P2) , where d(Pi , P
l) is Euclidean distance between Pi , Pl 。
Points in Ll is closer to Pl than any other points in the plane. In the other word , points in Ll is the trajectory of points that are closer to Pl than any other points in the plane and is indicated as V(P1) 。 Similarly , points in Lr is the trajectory of points that are closer to P2 than any other points and is indicated as V(P2) 。
Nature of Voronoi Diagram
Voronoi Diagram can be understood as a space partition method(distance from any point A in a Voronoi polygon to the center of the polygon is less than the distances from the point A to the centers of other Voronoi polygon). It also can be understood as a spatial interpolation method ( the value of any unknown point in the space can be substituted by the value of the closest point i.e. sample point)
4. Delaunay 三角网
4.1 Definition of Delaunay triangular mesh
Voronoi polygons with common border are called adjacent Voronoi polygons. Triangular mesh that are generated by connecting the center of all adjacent Voronoi polygons is called Delaunay triangular mesh
4.2 Properties of Delaunay Triangular Mesh
( 1 ) It is unqiue ;( 2 ) The outside boundary of triangular form the convex hull of point group( 3 ) The circumcircle of triangular contains no other points-circumcircle rule( 4 ) triangular keeps balance as much as possible to avoid long-narrow triangular mesh – maximum minimal angular rule.( 5 ) Delaunay triangular mesh is planar graph. It follows euler theorem of plane graphic.( 6 ) Delaunay triangular mesh mostly has 3n-6 edges and 2n-5 triangular. Here n is the number of points ;( 7 ) Delaunay triangular mesh and Voronoi diagram is a dual. Getting one can easily lead to getting the other.
4.3 Common algorithms for Delaunay triangular mesh
Static algorithm Dynamic algorithm
Radial sweepRecursive sPlitDivided-and-conquerSteP-by-stePModified hierarchical
IncrementalIncremental delete-and-build
2.4 basic image processing approaches.
1. Grey value transformation
45º
partition
Non-linear
linear
piecewise
Threshold operation
Original grey value
New grey value
inverse
255
255
100
100
200
200
Figure 2-32 different transform function curves of grey value tranformation
Figure 2-33 threshold operation on grey value 10
2. 两个栅格图像的算术组合运算
3. 扩张
2.5 digital terrain model
2.5.1 DEM summary
2.5.2 DEM construction
DEM data acquisition
DEM building approach
2.5.3 DEM application
2.5.1 DEM 概述DEM (Digital elevation model) is an important compone
nt of national basic spatial data.it represent limited sequ
ence of 3D vector of terrain on ground region, that is ele
vation set on ground cells. Its mathematic representatio
n is z=f(x,y) 。
DTM: when z is continuous geographical features on oth
er 2D surfaces, such as ground temperature, precipitatio
n, earth magnetic force, gravity, land utilization, soil typ
e etc. Under these condition,the DEM becomes DTM (Di
gital Terrain Models).
Summary : Differences of DEM and DTM
● Digital Elevation Model , DEM : s
tudy terrain relief 。●Digital Terrain Model , DTM :contains terrain relief and properties (e.
g. slope, aspect etc.) two meanings. It is
further analysis of DEM.
Summary : DEM representation approach
Summary : DEM ray mode representation
●Contour that describes elevation curve.
●Digitalizing current contour map results in DEM that has
worse qualities than the DEM resulted from aerial photogra
mmetry.
● Digitalized cotour is not very suitable for slope computati
on or pictomap generation.
Summary : Contour pattern
DEM Point model representation
Elevation matrix (same as raster map)
● representation method: partition region into raster and record elevation of each cell.
● Transformation from line model to elevation matrix.
◆advantages : it is convenient for computer to process raster-based matrix, This makes elevation matrix the most common DEM.
◆Disadvantages: In flat area, there are tremendous data redundancy; if size of grid isn’t changed, different terrain conditions cannot be adapted to; In sight line calculation, the grid axis is overly relied on.
Summary : GRID model
Grid method represents DEM as elevation matrix. DEM is derived from direct regular rectangle grid sampling point or irregular discrete
data point interpolation.
Its structure is simple. It is convenient for computer to process matrix. Therefore elevation matrix is the most general form of DEM.
Elevation matrix is especially useful for various applications.
Summary : Disadvantages of GRID model
1 、 Regions with simple terrain contain tremendous redundant data.
2 、 If grid size is not changed, it cannot be applied to different regions with different relief intensity.
3 、 for some special computation such as sight line computation, axis orientation of grid is exaggerated.
4 、 since raster is too rude, it cannot precisely represent key features of terrain such as peaks, ridges.
Summary : triangulated irregular network (TIN)
TIN solves the data redundancy of elevation matrix. It can be TIN solves the data redundancy of elevation matrix. It can be more effectively applied to various DTM-based computation. But more effectively applied to various DTM-based computation. But its structure is complex.its structure is complex.
TIN utilizes all sampling point to obtain discrete data. According to optimized combination principle, the discrete points (vertices of every triangular) is connected to form triangular planes that are continuous to each other.
Because TIN is able to determine the density of sampling point according complexity of terrain, it reduces the data redundancy of flat areas.
Summary : Triangulation of TIN
Summary : Storage Mode of TIN Model
No X Y Z
1 90.0 10.0 43.5
2 50.7 10.0 67.3
3 67.2 23.9 62.6
: : : :
10 10.0 90.0 81.0
概述: TIN 模型的表现
Summary : TIN Conclusion●Representation method : partition the region into adjacent triangular network. Any point in the region falls into vertices, line and triangular.
●Generation method : Derived from irregular point, rectangle grid or contour transformation
●TIN can collect abundant information in the areas with complex terrain and collect little information in simple areas to avoid data redundancy.
●TIN is more effective for some kinds of computation (e.g. slope, aspect computation) than digital contour based systems.
DEM data source
Data source includesData source includes ::
(( 11 )) aerial or aerospace remote sensing images aerial or aerospace remote sensing images
(( 22 )) terrain map terrain map
(( 33 )) ground measured recordground measured record
(( 44 )) other data sources other data sources
●●data source determines collection method. Sampling dendata source determines collection method. Sampling density of data points and selection of sampling points detersity of data points and selection of sampling points determine the precision of DEM.mine the precision of DEM.
Sampling point selection for digital photogrammetry
●Contour sampling
●Grid sampling
●Progressive Sampling
●Selection sampling
●Mixed sampling
2.5.2 DEM 的生成
方法:
1 、 artificial grid
2 、 triangular net method
3 、 stereo image method
4 、 surface fitting
5 、 contour interpolation
Artificial grid
●Cover map with grid, read elevation value from center
and intersection of each cell
Triangular net methodFor finite discrete point, connect every three adjacent points to form triangular. Every triangular represents a local plane. Then compute elevation of every grid to generate DEM according to every plane equation.
for building Requirement triangular network.
Make every triangle acute triangle or equilateral triangle and avoid overly large
obtuse angle or overly small acute angle.
C1C2C3
Determine the first triangle
iCC max 则 C 为该三角形第三顶点
ii
iii ba
cbaC
2cos
222
ii
iii ba
cbaC
2cos
222
A B
Illustration of network buiding
与 A 点距离最近的
点
哪个内角最大
ii
iii ba
cbaC
2cos
222
异则判断0))(())((),( 1212112 YYXXXXYYYXF
0),(),( 33 YXFYXF 0),(),( 33 YXFYXFp3 p2
If the coordinate of the candidate point P is ( X , Y )
Duplication and intersection test: any edge mostly can be common edge of two triangles.
p1
立体像对法
资料来源于张超主编的《地理信息系统教程》所配光盘
Surface fitting
Contour Interpolation
2.5.3 DEM application
1 、 DEM-based information extraction
2 、 contour drawing
3 、 DEM-based visualization analysis
1 、 three dimensional landscape
2 、 digital city and virtual reality
3 、 applications of DEM in engineering.
Application summary :
Application algorithm
3D landscape
Digital city and visual realityCity Model
DOM DEM DLG
Attribute RDB
Digital shengzheng
3D building
DEM+DOM+DLG
Digital road(交通部公路勘测设计院)(交通部公路勘测设计院)
DEM-based earthwork computation
Slope computation
Y
ZZZZX
ZZZZ
Y
X
22tan
22tan
10001101
01001110
1sintantan RO
QO
QO
PO
RO
POX
12 costansintantan SO
QO
QO
PO
SO
POY
222 tantantan YX
andand ::
thusthus ::
2
y
x1
(1,0)(0,0)
(1,1)
Z10
Z11
Z01
P
O
Q
R
S
T
Aspect angle computation
aspect angle T between QO and X axis is aspect angle
2
y
x1
(1,0)(0,0)
(1,1)
Z10
Z11
Z01
P
O
Q
R
S
T
XY tgtgRO
PO
SO
PO
SO
ROtgatgT //2
Build aspect map and slope map
Normally, move 3*3 window through DEM data matrix to complete the map
Thanks