System.Types.TSmallPoint

De RAD Studio API Documentation
Aller à : navigation, rechercher

Delphi

TSmallPoint = record

C++

struct TSmallPoint {
  short x;
  short y;
  static TSmallPoint Create(const short x, const short y) _ALWAYS_INLINE {
    TSmallPoint sp;
    sp.x = x;
    sp.y = y;
    return sp;
  }
  TSmallPoint& init(short ix, short iy) _ALWAYS_INLINE {
    x = ix;
    y = iy;
    return *this;
  }
  bool operator ==(const TSmallPoint& sp) const _ALWAYS_INLINE {
    return x == sp.x && y == sp.y;
  }
  bool operator !=(const TSmallPoint& sp) const _ALWAYS_INLINE {
    return !(*this == sp );
  }
  TSmallPoint operator +(const TSmallPoint& sp) const _ALWAYS_INLINE {
    TSmallPoint res;
    return res.init((short)(this->x + sp.x), (short)(this->y + sp.y));
  }
  TSmallPoint operator -(const TSmallPoint& sp) const _ALWAYS_INLINE {
    TSmallPoint res;
    return res.init((short)(this->x - sp.x), (short)(this->y - sp.y));
  }
  TSmallPoint& operator +=(const TSmallPoint& rhs) _ALWAYS_INLINE {
    this->x += rhs.x;
    this->y += rhs.y;
    return *this;
  }
  TSmallPoint& operator -=(const TSmallPoint& rhs) _ALWAYS_INLINE {
    this->x -= rhs.x;
    this->y -= rhs.y;
    return *this;
  }
  bool IsZero() const _ALWAYS_INLINE {
    return !x && !y;
  }
  double Distance(const TSmallPoint& p2) const _ALWAYS_INLINE {
    return hypot(static_cast<double>(p2.x - this->x), static_cast<double>(p2.y - this->y));
  }
};

Propriétés

Type Visibilité  Source Unité  Parent
record
struct
public
System.Types.pas
SystemTypes.h
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.

Voir aussi