Afficher : Delphi
C++
Préférences d'affichage
System.Types.TSmallPoint
De XE2 API Documentation
Delphi
TSmallPoint = record x: SmallInt; y: SmallInt; public constructor Create(P : TSmallPoint); overload; constructor Create(const X, Y : Word); overload; constructor Create(const X, Y : SmallInt); overload; class operator Equal(const Lhs, Rhs : TSmallPoint) : Boolean; class operator NotEqual(const Lhs, Rhs : TSmallPoint): Boolean; class operator Add(const Lhs, Rhs : TSmallPoint): TSmallPoint; class operator Subtract(const Lhs, Rhs : TSmallPoint): TSmallPoint; function Add(const Point: TSmallPoint): TSmallPoint; function Distance(const P2 : TSmallPoint) : Double; function IsZero : Boolean; function Subtract(const Point: TSmallPoint): TSmallPoint; end;
C++
struct TSmallPoint {short x; short y; static TSmallPoint Create(const short x, const short y) { TSmallPoint sp; sp.x = x; sp.y = y; return sp; } TSmallPoint& init(short ix, short iy) { x = ix; y = iy; return *this; } bool operator ==(const TSmallPoint& sp) const { return x == sp.x && y == sp.y; } bool operator !=(const TSmallPoint& sp) const { return !(*this == sp ); } TSmallPoint operator +(const TSmallPoint& sp) const { TSmallPoint res; return res.init((short)(this->x + sp.x), (short)(this->y + sp.y)); } TSmallPoint operator -(const TSmallPoint& sp) const { TSmallPoint res; return res.init((short)(this->x - sp.x), (short)(this->y - sp.y)); } TSmallPoint& operator +=(const TSmallPoint& rhs) { this->x += rhs.x; this->y += rhs.y; return *this; } TSmallPoint& operator -=(const TSmallPoint& rhs) { this->x -= rhs.x; this->y -= rhs.y; return *this; } bool IsZero() const { return !x && !y; } double Distance(const TSmallPoint& p2) const { return hypot(p2.x - this->x, p2.y - this->y); } };
Propriétés
| Type | Visibilité | Source | Unité | Parent |
|---|---|---|---|---|
struct class |
public | System.Types.pas System.Types.hpp |
System.Types | System.Types |
Description
Le type TSmallPoint définit un point avec deux coordonnées de 16 bits.
Le type TSmallPoint définit un point avec deux coordonnées de 16 bits. x spécifie la coordonnée horizontale du point et y la coordonnée verticale.