このページでは

C

Qul::PlatformInterface::Point Class

class Qul::PlatformInterface::Point

Point クラスは、整数精度を用いて平面上の点を定義します。詳細...

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

パブリック関数

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

静的パブリックメンバー

Qul::PlatformInterface::coord_t dotProduct(const Qul::PlatformInterface::Point &p1, const Qul::PlatformInterface::Point &p2)

詳細な説明

点は x 座標と y 座標によって指定され、これらはx() およびy() 関数を使用してアクセスできます。isNull() 関数は、x と y の両方が 0 に設定されている場合、true を返します。座標は、setX() およびsetY() 関数、あるいは座標への参照を返す (直接操作を可能にする)rx() およびry() 関数を使用して設定 (または変更) できます。

Pointオブジェクトはベクトルとしても使用できます。加算と減算はベクトルと同様に定義されています(各成分が個別に加算されます)。また、Pointオブジェクトはcoord_tfloat で除算または乗算を行うこともできます。

さらに、PointクラスはmanhattanLength()関数を提供しており、ベクトルとして解釈されたPointオブジェクトの長さを低コストで近似します。Pointオブジェクトは比較可能です。

Qul::PlatformInterface::PointF」も参照してください

メンバ関数のドキュメント

Point::Point()

原点、すなわち座標 (0, 0) を持つ点を生成します

isNull()も参照してください

Point::Point(Qul::PlatformInterface::coord_t xpos, Qul::PlatformInterface::coord_t ypos)

指定された座標 (xpos,ypos) を持つ点を生成します。

setX() およびsetY()も参照してください

[static] Qul::PlatformInterface::coord_t Point::dotProduct(const Qul::PlatformInterface::Point &p1, const Qul::PlatformInterface::Point &p2)

p1p2 の内積を返します。

bool Point::isNull() const

x座標とy座標の両方が0に設定されている場合はtrue を返し、それ以外の場合はfalse を返します。

Qul::PlatformInterface::coord_t Point::manhattanLength() const

x() およびy() の絶対値の和を返します。これは、従来、原点からその点までのベクトルの「マンハッタン距離」として知られています。これは、実際の長さに対する有用かつ計算が迅速な近似値です。 「マンハッタン距離」という呼び方が定着したのは、マンハッタンの街路のように、長方形のグリッド上しか移動できない旅行者に適用される距離であるためです。

Qul::PlatformInterface::coord_t &Point::rx()

この点の x 座標への参照を返します。参照を使用することで、x を直接操作できるようになります。

x() およびsetX()も参照してください

Qul::PlatformInterface::coord_t &Point::ry()

この点の y 座標への参照を返します。参照を使用することで、y を直接操作できるようになります。

y() およびsetY()も参照してください

void Point::setX(Qul::PlatformInterface::coord_t x)

この点のx座標を、指定されたx 座標に設定します。

x() およびsetY()も参照してください

void Point::setY(Qul::PlatformInterface::coord_t y)

この点の y 座標を、指定されたy の座標に設定します。

y() およびsetX()も参照してください

Qul::PlatformInterface::coord_t Point::x() const

この点の x 座標を返します。

setX() およびrx()も参照してください

Qul::PlatformInterface::coord_t Point::y() const

この点の y 座標を返します。

setY() およびry()も参照してください

Qul::PlatformInterface::Point &Point::operator*=(Qul::PlatformInterface::coord_t factor)

この点の座標に、指定されたfactor を乗算し、この点への参照を返します。

これはオーバーロードされた関数です。

operator/=()も参照してください

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

この点の座標に指定されたfactor を乗算し、この点への参照を返します。点は整数として保持されるため、結果は最も近い整数に丸められることに注意してください。浮動小数点精度が必要な場合は、PointF を使用してください。

これはオーバーロードされた関数です。

operator/=()も参照してください

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

指定されたpoint をこのポイントに追加し、このポイントへの参照を返します。

operator-=()も参照してください

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

指定されたpoint をこの点から差し引き、この点への参照を返します。

operator+=()も参照してください

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

x と y の両方を指定されたdivisor で割り、この座標への参照を返します。座標は整数として保持されるため、結果は最も近い整数に丸められることに注意してください。浮動小数点精度が必要な場合は、PointF を使用してください。

operator*=()も参照してください

特定のQtライセンスの下で利用可能です。
詳細はこちら。