C
Qul::PlatformInterface::Point Class
class Qul::PlatformInterface::PointPointクラスは、平面上の点を整数精度で定義する。詳細...
| 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() 関数を使用してアクセスできます。x と y の両方が 0 に設定されている場合、isNull() 関数はtrue を返します。座標の設定(または変更)は、setX() 関数とsetY() 関数、または座標への参照(直接操作が可能)を返すrx() 関数とry() 関数を使用して行います。
Point オブジェクトはベクトルとしても使用できます:加算と減算はベクトルと同様に定義されます(各成分は別々に加算されます)。また、Point オブジェクトは、coord_t やfloat によって分割したり乗算したりすることもできます。
さらに、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) を持つ点を構築する。
[static] Qul::PlatformInterface::coord_t Point::dotProduct(const Qul::PlatformInterface::Point &p1, const Qul::PlatformInterface::Point &p2)
p1 とp2 のドット積を返す。
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 を直接操作できるようになります。
Qul::PlatformInterface::coord_t &Point::ry()
この点のy座標への参照を返します。参照を使用すると、y を直接操作できるようになります。
void Point::setX(Qul::PlatformInterface::coord_t x)
この点の x 座標を、与えられたx 座標に設定します。
void Point::setY(Qul::PlatformInterface::coord_t y)
この点の y 座標を、与えられたy 座標に設定します。
Qul::PlatformInterface::coord_t Point::x() const
この点の x 座標を返します。
Qul::PlatformInterface::coord_t Point::y() const
この点の y 座標を返します。
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 ライセンスの下で利用可能です。
詳細を見る。