# C

# PointF Class

class Qul::PlatformInterface::PointFThe 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() and y() functions. The coordinates of the point are specified using floating point numbers for accuracy. The isNull() function returns `true`

if both x and y are set to 0.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). More...

Header: | #include <platforminterface/point.h> |

Since: | Qt Quick Ultralite (Platform) 1.5 |

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

## Public Functions

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) |

## Static Public Members

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

## Detailed Description

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`

or a `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.

**See also **Qul::PlatformInterface::Point.

## Member Function Documentation

### PointF::PointF(float *xpos*, float *ypos*)

Constructs a point with the given coordinates (*xpos*, *ypos*).

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

Constructs a copy of the given *point*.

**See also **toPoint().

### PointF::PointF()

Constructs a null point, i.e. with coordinates (0.0, 0.0)

**See also **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

Returns `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() and y(), traditionally known as the "Manhattan length" of the vector from the origin to the point.

**See also **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.

### float &PointF::ry()

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

### void PointF::setX(float *x*)

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

### void PointF::setY(float *y*)

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

### 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.

**See also **Qul::PlatformInterface::PointF.

### float PointF::x() const

Returns the x coordinate of this point.

### float PointF::y() const

Returns the y coordinate of this point.

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

Multiplies this point's coordinates by the given *factor*, and returns a reference to this point.

**See also **operator/=().

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

Adds the given *point* to this point and returns a reference to this point.

**See also **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.

**See also **operator+=().

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

Divides both x and y by the given *divisor*, and returns a reference to this point.

**See also **operator*=().

Available under certain Qt licenses.

Find out more.