name | description |
---|---|
Constructor | functions that construct SkPoint |
Member Function | static functions and member methods |
Member | member values |
Operator | operator overloading methods |
Related Function | similar methods grouped together |
SkPoint holds two 32 bit floating point coordinates.
name | description |
---|---|
Offset | moves sides |
Property | member values |
Set | replaces all values |
name | description |
---|---|
CrossProduct | returns cross product |
Distance | returns straight-line distance between points |
DotProduct | returns dot product |
Length | returns straight-line distance to origin |
Make | constructs from SkScalar inputs |
Normalize | sets length to one, and returns prior length |
Offset | translates Point array |
cross | returns cross product |
distanceToOrigin | returns straight-line distance to origin |
dot | returns dot product |
equals | returns true if Points are equal |
isFinite | returns true if no member is infinite or NaN |
isZero | returns true if both members equal zero |
iset | sets to integer input |
length | returns straight-line distance to origin |
negate | reverses the sign of both members |
normalize | sets length to one, preserving direction |
offset | translates Point |
scale | multiplies Point by scale factor |
set | sets to SkScalar input |
setAbs | sets sign of both members to positive |
setLength | sets straight-line distance to origin |
setNormalize | sets length to one, in direction of (x, y) |
x | returns fX |
y | returns fY |
name | description |
---|---|
fX | x-axis value |
fY | y-axis value |
SkScalar fX
x-axis value used by both Point and Vector. May contain any value, including infinities and NaN.
SkScalar fY
y-axis value used by both Point and Vector. May contain any value, including infinities and NaN.
name | description |
---|---|
Make | constructs from SkScalar inputs |
Sets fX to x, fY to y. Used both to set Point and Vector.
Point (x, y)
all equal
set iset[2] SkIPoint::Make
name | description |
---|---|
Distance | returns straight-line distance between points |
Length | returns straight-line distance to origin |
distanceToOrigin | returns straight-line distance to origin |
isFinite | returns true if no member is infinite or NaN |
isZero | returns true if both members equal zero |
length | returns straight-line distance to origin |
x | returns fX |
y | returns fY |
Returns x-axis value of Point or Vector.
fX
pt1.fX == pt1.x()
y SkIPoint::x()
Returns y-axis value of Point or Vector.
fY
pt1.fY == pt1.y()
x SkIPoint::y()
Returns true if fX and fY are both zero.
true if fX is zero and fY is zero
pt.fX=+0 pt.fY=-0 pt.isZero() == true
isFinite SkIPoint::isZero
name | description |
---|---|
iset | sets to integer input |
iset(int32 t x, int32 t y) | |
iset(const SkIPoint& p) | |
normalize | sets length to one, preserving direction |
set | sets to SkScalar input |
setAbs | sets sign of both members to positive |
setLength | sets straight-line distance to origin |
setLength(SkScalar length) | |
setLength(SkScalar x, SkScalar y, SkScalar length) | |
setNormalize | sets length to one, in direction of (x, y) |
Sets fX to x and fY to y.
pt1 == pt2
iset[2] Make
Sets fX to x and fY to y, promoting integers to SkScalar values.
Assigning a large integer value directly to fX or fY may cause a compiler error, triggered by narrowing conversion of int to SkScalar. This safely casts x and y to avoid the error.
set Make SkIPoint::set
Sets fX to p.fX and fY to p.fY, promoting integers to SkScalar values.
Assigning an IPoint containing a large integer value directly to fX or fY may cause a compiler error, triggered by narrowing conversion of int to SkScalar. This safely casts p.fX and p.fY to avoid the error.
iPt: -2147483647, 2147483647 fPt: -2.14748e+09, 2.14748e+09
set Make SkIPoint::set
Sets fX to absolute value of pt.fX; and fY to absolute value of pt.fY.
pt: 0, -0 abs: 0, 0 pt: -1, -2 abs: 1, 2 pt: inf, -inf abs: inf, inf pt: nan, -nan abs: nan, nan
set Make negate
name | description |
---|---|
Normalize | sets length to one, and returns prior length |
Offset | translates Point array |
Offset(SkPoint points[], int count, const SkVector& offset) | |
Offset(SkPoint points[], int count, SkScalar dx, SkScalar dy) | |
offset | translates Point |
scale | multiplies Point by scale factor |
scale(SkScalar scale, SkPoint* dst) const | |
scale(SkScalar value) |
Adds offset to each Point in points array with count entries.
offset operator+=(const SkVector& v)
Adds offset (dx, dy) to each Point in points array of length count.
offset operator+=(const SkVector& v)
Adds offset (dx, dy) to Point.
Offset[2] operator+=(const SkVector& v)
Returns the Euclidean_Distance from origin, computed as:
.
straight-line distance to origin
distanceToOrigin Length setLength[2] Distance
Returns the Euclidean_Distance from origin, computed as:
.
straight-line distance to origin
length Length setLength[2] Distance
Scales (fX, fY) so that length returns one, while preserving ratio of fX to fY, if possible. If prior length is nearly zero, sets Vector to (0, 0) and returns false; otherwise returns true.
true if former length is not zero or nearly zero
Normalize setLength[2] length Length
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.
true if (x, y) length is not zero or nearly zero
normalize setLength[2]
Scales Vector so that distanceToOrigin returns length, if possible. If former length is nearly zero, sets Vector to (0, 0) and return false; otherwise returns true.
true if former length is not zero or nearly zero
length Length setNormalize setAbs
Sets Vector to (x, y) scaled to length, if possible. If former length is nearly zero, sets Vector to (0, 0) and return false; otherwise returns true.
true if (x, y) length is not zero or nearly zero
length Length setNormalize setAbs
name | description |
---|---|
CrossProduct | returns cross product |
DotProduct | returns dot product |
cross | returns cross product |
dot | returns dot product |
equals | returns true if Points are equal |
negate | reverses the sign of both members |
operator!=(const SkPoint& a, const SkPoint& b) | returns true if Point are unequal |
operator*(SkScalar scale) const | returns Point multiplied by scale |
operator*=(SkScalar scale) | multiplies Point by scale factor |
operator+(const SkPoint& a, const SkVector& b) | returns Point offset by Vector |
operator+=(const SkVector& v) | adds Vector to Point |
operator-() const | reverses sign of Point |
operator-(const SkPoint& a, const SkPoint& b) | returns Vector between Points |
operator-=(const SkVector& v) | subtracts Vector from Point |
operator==(const SkPoint& a, const SkPoint& b) | returns true if Point are equal |
Sets dst to Point times scale. dst may be Point to modify Point in place.
operator*(SkScalar scale) const operator*=(SkScalar scale) setLength[2]
Scales Point in place by scale.
operator*(SkScalar scale) const operator*=(SkScalar scale) setLength[2]
Changes the sign of fX and fY.
pt: 0, -0 negate: -0, 0 pt: -1, -2 negate: 1, 2 pt: inf, -inf negate: -inf, inf pt: nan, -nan negate: -nan, nan
operator-() const setAbs
Returns Point changing the signs of fX and fY.
Point as (-fX, -fY)
pt: 0, -0 negate: -0, 0 pt: -1, -2 negate: 1, 2 pt: inf, -inf negate: -inf, inf pt: nan, -nan negate: -nan, nan
negate operator-(const SkPoint& a, const SkPoint& b) operator-=(const SkVector& v) SkIPoint::operator-() const
Adds Vector v to Point. Sets Point to: (fX + v.fX, fY + v.fY).
offset operator+(const SkPoint& a, const SkVector& b) SkIPoint::operator+=(const SkIVector& v)
Subtracts Vector v from Point. Sets Point to: (fX - v.fX, fY - v.fY).
offset operator-(const SkPoint& a, const SkPoint& b) SkIPoint::operator-=(const SkIVector& v)
Returns Point multiplied by scale.
Point as (fX * scale, fY * scale)
operator*=(SkScalar scale) scale[2] setLength[2] setNormalize
Multiplies Point by scale. Sets Point to: (fX * scale, fY * scale)
reference to Point
operator*(SkScalar scale) const scale[2] setLength[2] setNormalize
Returns true if both fX and fY are measurable values.
true for values other than infinities and NaN
pt: 0, -0 finite: true pt: -1, -2 finite: true pt: inf, 1 finite: false pt: nan, -1 finite: false
SkRect::isFinite SkPath::isFinite
Returns true if Point is equivalent to Point constructed from (x, y).
true if Point equals (x, y)
pt: 0, -0 == pt pt: -1, -2 == pt pt: inf, 1 == pt pt: nan, -1 != pt
operator==(const SkPoint& a, const SkPoint& b)
Returns true if a is equivalent to b.
true if a.fX == b.fX and a.fY == b.fY
pt: 0, -0 == pt pt: -1, -2 == pt pt: inf, 1 == pt pt: nan, -1 != pt
equals operator!=(const SkPoint& a, const SkPoint& b)
Returns true if a is not equivalent to b.
true if a.fX != b.fX or a.fY != b.fY
pt: 0, -0 == pt pt: -1, -2 == pt pt: inf, 1 == pt pt: nan, -1 != pt
operator==(const SkPoint& a, const SkPoint& b) equals
Returns Vector from b to a, computed as(a.fX - b.fX, a.fY - b.fY).
Can also be used to subtract Vector from Point, returning Point. Can also be used to subtract Vector from Vector, returning Vector.
Vector from b to a
operator-=(const SkVector& v) offset
Returns Point resulting from Point a offset by Vector b, computed as: (a.fX + b.fX, a.fY + b.fY).
Can also be used to offset Point b by Vector a, returning Point. Can also be used to add Vector to Vector, returning Vector.
Point equal to a offset by b
operator+=(const SkVector& v) offset
Returns the Euclidean_Distance from origin, computed as:
.
straight-line distance to origin
length Distance setLength[2]
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.
original vec length
normalize setLength[2] Length
Returns the Euclidean_Distance between a and b.
straight-line distance from a to b
length setLength[2]
Returns the dot product of Vector a and Vector b.
product of input magnitudes and cosine of the angle between them
dot CrossProduct
Returns the cross product of Vector a and Vector b.
a and b form three-dimensional vectors with z-axis value equal to zero. The cross product is a three-dimensional vector with x-axis and y-axis values equal to zero. The cross product z-axis component is returned.
area spanned by Vectors signed by angle direction
cross DotProduct
Returns the cross product of Vector and vec.
Vector and vec form three-dimensional vectors with z-axis value equal to zero. The cross product is a three-dimensional vector with x-axis and y-axis values equal to zero. The cross product z-axis component is returned.
area spanned by Vectors signed by angle direction
CrossProduct dot
Returns the dot product of Vector and Vector vec.
product of input magnitudes and cosine of the angle between them
DotProduct cross