PointF Class

class Qul :: PlatformInterface ::PointF

The PointF class defines a point in the plane using floating point precision. A point is specified by a x coordinate and an y coordinate which can be accessed using the x () 和 y () functions. The coordinates of the point are specified using floating point numbers for accuracy. The isNull () 函数返回 true if both x and y are set to 0.0. The coordinates can be set (or altered) using the setX () 和 setY () functions, or alternatively the rx () 和 ry () functions which return references to the coordinates (allowing direct manipulation). 更多...

Header: #include <platforminterface/point.h>
Since: Qt Quick Ultralite (Platform) 1.5

This class was introduced in Qt Quick Ultralite (Platform) 1.5.

公共函数

PointF (float xpos , float ypos )
PointF (const Qul::PlatformInterface::Point & point )
PointF ()
bool isNull () const
float manhattanLength () const
float & rx ()
float & ry ()
void setX (float x )
void setY (float y )
Qul::PlatformInterface::Point toPoint () const
float x () const
float y () const
Qul::PlatformInterface::PointF & operator*= (float factor )
Qul::PlatformInterface::PointF & operator+= (const Qul::PlatformInterface::PointF & point )
Qul::PlatformInterface::PointF & operator-= (const Qul::PlatformInterface::PointF & point )
Qul::PlatformInterface::PointF & operator/= (float divisor )

静态公共成员

float dotProduct (const Qul::PlatformInterface::PointF & p1 , const Qul::PlatformInterface::PointF & p2 )

详细描述

A PointF object can also be used as a vector: Addition and subtraction are defined as for vectors (each component is added separately). A PointF object can also be divided or multiplied by an coord_t float . In addition, the PointF class provides a constructor converting a Point object into a PointF object, and a corresponding toPoint () function which returns a Point copy of this point. PointF objects can be compared.

另请参阅 Qul::PlatformInterface::Point .

成员函数文档编制

PointF:: PointF ( float xpos , float ypos )

构造点采用给定坐标 ( xpos , ypos ).

另请参阅 setX () 和 setY ().

PointF:: PointF (const Qul::PlatformInterface::Point & point )

构造副本为给定 point .

另请参阅 toPoint ().

PointF:: PointF ()

构造 null 点,即具有坐标 (0.0, 0.0)

另请参阅 isNull ().

[static] float PointF:: dotProduct (const Qul::PlatformInterface::PointF & p1 , const Qul::PlatformInterface::PointF & p2 )

Returns the dot product of p1 and p2 .

bool PointF:: isNull () const

返回 true if both the x and y coordinates are set to 0.0 (ignoring the sign); otherwise returns false .

float PointF:: manhattanLength () const

Returns the sum of the absolute values of x () 和 y (), traditionally known as the "Manhattan length" of the vector from the origin to the point.

另请参阅 Qul::PlatformInterface::Point::manhattanLength ().

float &PointF:: rx ()

Returns a reference to the x coordinate of this point. Using a reference makes it possible to directly manipulate x.

另请参阅 x () 和 setX ().

float &PointF:: ry ()

Returns a reference to the y coordinate of this point. Using a reference makes it possible to directly manipulate y.

另请参阅 y () 和 setY ().

void PointF:: setX ( float x )

将此点的 x 坐标设为给定 x 坐标。

另请参阅 x () 和 setY ().

void PointF:: setY ( float y )

将此点的 y 坐标设为给定 y 坐标。

另请参阅 y () 和 setX ().

Qul::PlatformInterface::Point PointF:: toPoint () const

Rounds the coordinates of this point to the nearest integer, and returns a Point object with the rounded coordinates.

另请参阅 Qul::PlatformInterface::PointF .

float PointF:: x () const

返回此点的 x 坐标。

另请参阅 setX () 和 rx ().

float PointF:: y () const

返回此点的 y 坐标。

另请参阅 setY () 和 ry ().

Qul::PlatformInterface::PointF &PointF:: operator*= ( float factor )

将此点的坐标乘以给定 factor ,并返回此点的引用。

另请参阅 operator/= ().

Qul::PlatformInterface::PointF &PointF:: operator+= (const Qul::PlatformInterface::PointF & point )

添加给定 point to this point and returns a reference to this point.

另请参阅 operator-= ().

Qul::PlatformInterface::PointF &PointF:: operator-= (const Qul::PlatformInterface::PointF & point )

Subtracts the given point from this point and returns a reference to this point.

另请参阅 operator+= ().

Qul::PlatformInterface::PointF &PointF:: operator/= ( float divisor )

Divides both x and y by the given divisor ,并返回此点的引用。

另请参阅 operator*= ().