Qt Coordinate System

Source: Internet
Author: User

Coordinate Transformation

world corrdinates

=>

window coordinates

=>

device coordinates

( logical coordinate )

world change

intermediate state coordinate

window view transformation

( physical coordinate )

By default,3Coordinate Systems are consistent.

World change

Functions directly related to world transformations:

Qpainter: setworldmatrixenabled

Enable or disable world Transform

Qpainter: setworldtransform

Set world change

Qpainter: worldtransform

Get current

Qpainter: resettransform

ResetQtransform ()

4Common functions

Qpainter: Translate

Translation

Qpainter: Scale

Zoom

Qpainter: Rotate

Rotate

Qpainter: Shear

Cut

Note: they are directly calledQtransformDirectly modify the world change

Void qpainter: Scale (qreal Sx, qreal SY)
{
...
D-> state-> worldmatrix. Scale (sx, Sy );
...
}

Two world-changing vests:

Qpainter: settransform

Qpainter: Transform

Void qpainter: settransform (const qtransform & transform, bool combine)

{
Setworldtransform (transform, combine );

}

Obsolete Functions(SlaveQt4.3Start,QtransformReplacedQmatrixIs not recommended for the following functions):

Qpainter: setworldmatrix

Qpainter: worldmatrix

...

Window-view Transformation

Direct correlation:

Qpainter: setviewtransformenabled

Enable or disable the view transform function

Qpainter: viewtransformenabled

Returns the status of the viewport transform.

Qpainter: setviewport

Set the viewport (physical coordinates)

Qpainter: setwindow

Set the window (the same rectangle and intermediate state coordinates as the viewport)

This transformation is a simple linear transformation.

Compound Transformation

Combination of window-view transformation and world Transformation:

Qpainter: combinedtransform

Qtransform qpainter: combinedtransform () const

{
Q_d (const qpainter );
Return D-> state-> worldmatrix * D-> viewtransform ();

}

Typical application: converts coordinates from physical coordinatesQpainterRequired logical coordinates

Affine Transformation and transmission Transformation

Qt4.3 (Including)PreviousQmatrixOnly supports Affine Transformation(Affine transformation).

Translation(Translation)

Zoom (Scale)

Rotate (Rotation)

Cut(Shear)

QtransformTransmission transformation supported(Perspective transformation).

M11

M12

M13

M21

M22

M23

M31
DX

M32
Dy

M33

Conversion Relationship:

X' = M11 * x + m21 * Y + dx
Y' = m22 * Y + M12 * x + dy
If (is not affine)

{
W' = M13 * x + M23 * Y + M33
X'/= W'
Y'/= W'

}

 

Related Knowledge:

Projection Geometry, affine geometry, and differential geometry

Reference

Http://doc.qt.nokia.com/4.7/qtransform.html

Http://doc.qt.nokia.com/4.7/qpainter.html

Http://doc.qt.nokia.com/4.7/coordsys.html

 

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.