Struct rute::auto::point::Point

source ·
pub struct Point<'a> { /* private fields */ }
Expand description

Notice these docs are heavy WIP and not very relevent yet

A point is specified by a x coordinate and an y coordinate which can be accessed using the x() and y() functions. The isNull() function returns true if both x and y are set to 0. The coordinates can be set (or altered) using the setX() and setY() functions, or alternatively the rx() and ry() functions which return references to the coordinates (allowing direct manipulation).

Given a point p, the following statements are all equivalent:

A QPoint object can also be used as a vector: Addition and subtraction are defined as for vectors (each component is added separately). A QPoint object can also be divided or multiplied by an int or a qreal.

In addition, the QPoint class provides the manhattanLength() function which gives an inexpensive approximation of the length of the QPoint object interpreted as a vector. Finally, QPoint objects can be streamed as well as compared.

See also: QPointF QPolygon

Licence

The documentation is an adoption of the original Qt Documentation and provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.

Implementations

Returns true if both the x and y coordinates are set to 0, otherwise returns false.

Returns the x coordinate of this point.

See also: setX() rx()

Returns the y coordinate of this point.

See also: setY() ry()

Sets the x coordinate of this point to the given x coordinate.

See also: x() setY()

Sets the y coordinate of this point to the given y coordinate.

See also: y() setX()

Returns the sum of the absolute values of x() and y(), traditionally known as the of the vector from the origin to the point. For example:

This is a useful, and quick to calculate, approximation to the true length:

The tradition of arises because such distances apply to travelers who can only travel on a rectangular grid, like the streets of Manhattan.

Returns a reference to the x coordinate of this point.

Using a reference makes it possible to directly manipulate x. For example:

See also: x() setX()

Returns a reference to the y coordinate of this point.

Using a reference makes it possible to directly manipulate y. For example:

See also: y() setY()

Returns the dot product of p1 and p2.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.