9#include "matrix/SPoint.h"
13float SPoint::Length(
float dx,
float dy)
15 float mag2 = dx * dx + dy * dy;
16 if (SFloatIsFinite(mag2))
18 return sk_float_sqrt(mag2);
24 return (
float)sqrt(xx * xx + yy * yy);
28void SPoint::iset(int32_t x, int32_t y)
30 fX = SkIntToScalar(x);
31 fY = SkIntToScalar(y);
34void SPoint::iset(
const POINT &p)
36 fX = SkIntToScalar(p.x);
37 fY = SkIntToScalar(p.y);
40POINT SPoint::toPoint()
const
42 POINT pt = { SFloatRoundToInt(fX), SFloatRoundToInt(fY) };
46float SPoint::dot(
const SPoint &vec)
const
48 return DotProduct(*
this, vec);
51float SPoint::DotProduct(
const SPoint &a,
const SPoint &b)
53 return a.fX * b.fX + a.fY * b.fY;