|
constexpr SkScalar | x () const |
| Returns x-axis value of SkPoint or vector. More...
|
|
constexpr SkScalar | y () const |
| Returns y-axis value of SkPoint or vector. More...
|
|
bool | isZero () const |
| Returns true if fX and fY are both zero. More...
|
|
void | set (SkScalar x, SkScalar y) |
| Sets fX to x and fY to y. More...
|
|
void | iset (int32_t x, int32_t y) |
| Sets fX to x and fY to y, promoting integers to SkScalar values. More...
|
|
void | iset (const SkIPoint &p) |
| Sets fX to p.fX and fY to p.fY, promoting integers to SkScalar values. More...
|
|
void | setAbs (const SkPoint &pt) |
| Sets fX to absolute value of pt.fX; and fY to absolute value of pt.fY. More...
|
|
void | offset (SkScalar dx, SkScalar dy) |
| Adds offset (dx, dy) to SkPoint. More...
|
|
SkScalar | length () const |
| Returns the Euclidean distance from origin, computed as: More...
|
|
SkScalar | distanceToOrigin () const |
| Returns the Euclidean distance from origin, computed as: More...
|
|
bool | normalize () |
| Scales (fX, fY) so that length() returns one, while preserving ratio of fX to fY, if possible. More...
|
|
bool | setNormalize (SkScalar x, SkScalar y) |
| Sets vector to (x, y) scaled so length() returns one, and so that (fX, fY) is proportional to (x, y). More...
|
|
bool | setLength (SkScalar length) |
| Scales vector so that distanceToOrigin() returns length, if possible. More...
|
|
bool | setLength (SkScalar x, SkScalar y, SkScalar length) |
| Sets vector to (x, y) scaled to length, if possible. More...
|
|
void | scale (SkScalar scale, SkPoint *dst) const |
| Sets dst to SkPoint times scale. More...
|
|
void | scale (SkScalar value) |
| Scales SkPoint in place by scale. More...
|
|
void | negate () |
| Changes the sign of fX and fY. More...
|
|
SkPoint | operator- () const |
| Returns SkPoint changing the signs of fX and fY. More...
|
|
void | operator+= (const SkVector &v) |
| Adds vector v to SkPoint. More...
|
|
void | operator-= (const SkVector &v) |
| Subtracts vector v from SkPoint. More...
|
|
SkPoint | operator* (SkScalar scale) const |
| Returns SkPoint multiplied by scale. More...
|
|
SkPoint & | operator*= (SkScalar scale) |
| Multiplies SkPoint by scale. More...
|
|
bool | isFinite () const |
| Returns true if both fX and fY are measurable values. More...
|
|
bool | equals (SkScalar x, SkScalar y) const |
| Returns true if SkPoint is equivalent to SkPoint constructed from (x, y). More...
|
|
SkScalar | cross (const SkVector &vec) const |
| Returns the cross product of vector and vec. More...
|
|
SkScalar | dot (const SkVector &vec) const |
| Returns the dot product of vector and vector vec. More...
|
|
|
static constexpr SkPoint | Make (SkScalar x, SkScalar y) |
| Sets fX to x, fY to y. More...
|
|
static void | Offset (SkPoint points[], int count, const SkVector &offset) |
| Adds offset to each SkPoint in points array with count entries. More...
|
|
static void | Offset (SkPoint points[], int count, SkScalar dx, SkScalar dy) |
| Adds offset (dx, dy) to each SkPoint in points array of length count. More...
|
|
static SkScalar | Length (SkScalar x, SkScalar y) |
| Returns the Euclidean distance from origin, computed as: More...
|
|
static SkScalar | Normalize (SkVector *vec) |
| Scales (vec->fX, vec->fY) so that length() returns one, while preserving ratio of vec->fX to vec->fY, if possible. More...
|
|
static SkScalar | Distance (const SkPoint &a, const SkPoint &b) |
| Returns the Euclidean distance between a and b. More...
|
|
static SkScalar | DotProduct (const SkVector &a, const SkVector &b) |
| Returns the dot product of vector a and vector b. More...
|
|
static SkScalar | CrossProduct (const SkVector &a, const SkVector &b) |
| Returns the cross product of vector a and vector b. More...
|
|
SkPoint holds two 32-bit floating point coordinates.
Scales (vec->fX, vec->fY) so that length() returns one, while preserving ratio of vec->fX to vec->fY, if possible.
If original length is nearly zero, sets vec to (0, 0) and returns zero; otherwise, returns length of vec before vec is scaled.
Returned prior length may be SK_ScalarInfinity if it can not be represented by SkScalar.
Note that normalize() is faster if prior length is not required.
- Parameters
-
vec | normalized to unit length |
- Returns
- original vec length
example: https://fiddle.skia.org/c/@Point_Normalize
Sets vector to (x, y) scaled so length() returns one, and so that (fX, fY) is proportional to (x, y).
If (x, y) length is nearly zero, sets vector to (0, 0) and returns false; otherwise returns true.
- Parameters
-
x | proportional value for fX |
y | proportional value for fY |
- Returns
- true if (x, y) length is not zero or nearly zero
example: https://fiddle.skia.org/c/@Point_setNormalize