Implementation of scaling, rotating, and translating vector maps

Source: Internet
Author: User
Basically, each GIS software has map scaling, rotation, and translation operations. In GIS, there are two formats: raster and vector. Each format adopts different processing methods. Here, we only consider vector data, and the raster data will be processed later.

Vector Data operations have a powerful theoretical basis, that is, computer graphics. In computer graphics, translation, rotation, and scaling are collectively referred to as two-dimensional geometric transformations [1].

I. Three Coordinate Systems
World coordinate system, always unchanged, such as geographical coordinate system
The local coordinate system takes the center of the object as the coordinate origin. The rotation, translation, and scaling of the object are all centered around the local coordinate system. When an object is rotated, scaled, or translated, the coordinate system also rotates, scales, and translates accordingly. For example, the plane coordinate system after the map is projected.
The screen coordinate system.

II,Algorithm[2, 3]
The coordinate system is used to realize linear transformation of objects. For example, when translating a point, it is to translate the coordinate system and then redraw the point.

Affine matrix:

M11 M12 0
M21 m22 0
DX dy 1

DX and Dy control horizontal and vertical translation
M11 and m22 control Scaling
M12, m21 control rotation

If the coordinate of a vertex (x, y) transformed by the affine matrix is (x', y '),
X' = M11 * x + m21 * Y + dx
Y' = m22 * Y + M12 * x + dy

Iii. Implementation
To be continued...

References:
1. Donald Hearn, M. Pauline bake computer graphics (second edition) 141-167
2. http://www.qiliang.net/qt/qwmatrix.html qwmatrix class reference
3. Coordinate System in http://www.csdn.net/develop/Article/21/21922.shtm Windows GDI

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.