Home | History | Annotate | Download | only in api
      1 SkPoint Reference
      2 ===
      3 
      4 # <a name="Point"></a> Point
      5 
      6 ## <a name="Overview"></a> Overview
      7 
      8 ## <a name="Subtopics"></a> Subtopics
      9 
     10 | name | description |
     11 | --- | --- |
     12 | <a href="#Constructors">Constructors</a> | functions that construct <a href="SkPoint_Reference#SkPoint">SkPoint</a> |
     13 | <a href="#Member_Functions">Member Functions</a> | static functions and member methods |
     14 | <a href="#Members">Members</a> | member values |
     15 | <a href="#Operators">Operators</a> | operator overloading methods |
     16 
     17 # <a name="SkPoint"></a> Struct SkPoint
     18 
     19 ## <a name="Constructors"></a> Constructors
     20 
     21 | name | description |
     22 | --- | --- |
     23 | <a href="#SkPoint_Make">Make</a> | constructs from <a href="undocumented#SkScalar">SkScalar</a> inputs |
     24 
     25 ## <a name="Operators"></a> Operators
     26 
     27 | name | description |
     28 | --- | --- |
     29 | <a href="#SkPoint_notequal_operator">operator!=(const SkPoint& a, const SkPoint& b)</a> | returns true if <a href="#Point">Point</a> are unequal |
     30 | <a href="#SkPoint_multiply_operator">operator*(SkScalar scale) const</a> | returns <a href="#Point">Point</a> multiplied by scale |
     31 | <a href="#SkPoint_multiplyby_operator">operator*=(SkScalar scale)</a> | multiplies <a href="#Point">Point</a> by scale factor |
     32 | <a href="#SkPoint_add_operator">operator+(const SkPoint& a, const SkVector& b)</a> | returns <a href="#Point">Point</a> offset by <a href="SkPoint_Reference#Vector">Vector</a> |
     33 | <a href="#SkPoint_addto_operator">operator+=(const SkVector& v)</a> | adds <a href="SkPoint_Reference#Vector">Vector</a> to <a href="#Point">Point</a> |
     34 | <a href="#SkPoint_minus_operator">operator-() const</a> | reverses sign of <a href="#Point">Point</a> |
     35 | <a href="#SkPoint_subtract_operator">operator-(const SkPoint& a, const SkPoint& b)</a> | returns <a href="SkPoint_Reference#Vector">Vector</a> between <a href="#Point">Points</a> |
     36 | <a href="#SkPoint_subtractfrom_operator">operator-=(const SkVector& v)</a> | subtracts <a href="SkPoint_Reference#Vector">Vector</a> from <a href="#Point">Point</a> |
     37 | <a href="#SkPoint_equal_operator">operator==(const SkPoint& a, const SkPoint& b)</a> | returns true if <a href="#Point">Point</a> are equal |
     38 
     39 ## <a name="Member_Functions"></a> Member Functions
     40 
     41 | name | description |
     42 | --- | --- |
     43 | <a href="#SkPoint_CrossProduct">CrossProduct</a> | returns cross product |
     44 | <a href="#SkPoint_Distance">Distance</a> | returns straight-line distance between points |
     45 | <a href="#SkPoint_DotProduct">DotProduct</a> | returns dot product |
     46 | <a href="#SkPoint_Length">Length</a> | returns straight-line distance to origin |
     47 | <a href="#SkPoint_Make">Make</a> | constructs from <a href="undocumented#SkScalar">SkScalar</a> inputs |
     48 | <a href="#SkPoint_Normalize">Normalize</a> | sets length to one, and returns prior length |
     49 | <a href="#SkPoint_Offset">Offset</a> | translates <a href="#Point">Point</a> array |
     50 | <a href="#SkPoint_cross">cross</a> | returns cross product |
     51 | <a href="#SkPoint_distanceToOrigin">distanceToOrigin</a> | returns straight-line distance to origin |
     52 | <a href="#SkPoint_dot">dot</a> | returns dot product |
     53 | <a href="#SkPoint_equals">equals</a> | returns true if <a href="#Point">Points</a> are equal |
     54 | <a href="#SkPoint_isFinite">isFinite</a> | returns true if no member is infinite or NaN |
     55 | <a href="#SkPoint_isZero">isZero</a> | returns true if both members equal zero |
     56 | <a href="#SkPoint_iset">iset</a> | sets to integer input |
     57 | <a href="#SkPoint_length">length</a> | returns straight-line distance to origin |
     58 | <a href="#SkPoint_negate">negate</a> | reverses the sign of both members |
     59 | <a href="#SkPoint_normalize">normalize</a> | sets length to one, preserving direction |
     60 | <a href="#SkPoint_offset">offset</a> | translates <a href="#Point">Point</a> |
     61 | <a href="#SkPoint_scale">scale</a> | multiplies <a href="#Point">Point</a> by scale factor |
     62 | <a href="#SkPoint_set">set</a> | sets to <a href="undocumented#SkScalar">SkScalar</a> input |
     63 | <a href="#SkPoint_setAbs">setAbs</a> | sets sign of both members to positive |
     64 | <a href="#SkPoint_setLength">setLength</a> | sets straight-line distance to origin |
     65 | <a href="#SkPoint_setNormalize">setNormalize</a> | sets length to one, in direction of (x, y) |
     66 | <a href="#SkPoint_x">x</a> | returns <a href="#SkPoint_fX">fX</a> |
     67 | <a href="#SkPoint_y">y</a> | returns <a href="#SkPoint_fY">fY</a> |
     68 
     69 ## <a name="Members"></a> Members
     70 
     71 | name | description |
     72 | --- | --- |
     73 | <a href="#SkPoint_fX">fX</a> | x-axis value |
     74 | <a href="#SkPoint_fY">fY</a> | y-axis value |
     75 
     76 <a name="SkPoint_fX"> <code><strong>SkScalar  fX</strong></code> </a>
     77 
     78 x-axis value used by both <a href="#Point">Point</a> and <a href="SkPoint_Reference#Vector">Vector</a>. May contain any value, including
     79 infinities and NaN.
     80 
     81 <a name="SkPoint_fY"> <code><strong>SkScalar  fY</strong></code> </a>
     82 
     83 y-axis value used by both <a href="#Point">Point</a> and <a href="SkPoint_Reference#Vector">Vector</a>. May contain any value, including
     84 infinities and NaN.
     85 
     86 <a name="SkPoint_Make"></a>
     87 ## Make
     88 
     89 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
     90 static constexpr SkPoint Make(SkScalar x, SkScalar y)
     91 </pre>
     92 
     93 Sets <a href="#SkPoint_fX">fX</a> to x, <a href="#SkPoint_fY">fY</a> to y. Used both to set <a href="#Point">Point</a> and <a href="SkPoint_Reference#Vector">Vector</a>.
     94 
     95 ### Parameters
     96 
     97 <table>  <tr>    <td><a name="SkPoint_Make_x"> <code><strong>x </strong></code> </a></td> <td>
     98 <a href="undocumented#SkScalar">SkScalar</a> x-axis value of constructed <a href="#Point">Point</a> or <a href="SkPoint_Reference#Vector">Vector</a></td>
     99   </tr>  <tr>    <td><a name="SkPoint_Make_y"> <code><strong>y </strong></code> </a></td> <td>
    100 <a href="undocumented#SkScalar">SkScalar</a> y-axis value of constructed <a href="#Point">Point</a> or <a href="SkPoint_Reference#Vector">Vector</a></td>
    101   </tr>
    102 </table>
    103 
    104 ### Return Value
    105 
    106 <a href="#Point">Point</a> (x, y)
    107 
    108 ### Example
    109 
    110 <div><fiddle-embed name="d266e70977847001f7c42f8a2513bee7">
    111 
    112 #### Example Output
    113 
    114 ~~~~
    115 all equal
    116 ~~~~
    117 
    118 </fiddle-embed></div>
    119 
    120 ### See Also
    121 
    122 <a href="#SkPoint_set">set</a> <a href="#SkPoint_iset">iset</a><sup><a href="#SkPoint_iset_2">[2]</a></sup> <a href="#SkIPoint_Make">SkIPoint::Make</a>
    123 
    124 ---
    125 
    126 <a name="SkPoint_x"></a>
    127 ## x
    128 
    129 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
    130 SkScalar x() const
    131 </pre>
    132 
    133 Returns x-axis value of <a href="#Point">Point</a> or <a href="SkPoint_Reference#Vector">Vector</a>.
    134 
    135 ### Return Value
    136 
    137 <a href="#SkPoint_fX">fX</a>
    138 
    139 ### Example
    140 
    141 <div><fiddle-embed name="9f3fe446b800ae1d940785d438634941">
    142 
    143 #### Example Output
    144 
    145 ~~~~
    146 pt1.fX == pt1.x()
    147 ~~~~
    148 
    149 </fiddle-embed></div>
    150 
    151 ### See Also
    152 
    153 <a href="#SkPoint_y">y</a> <a href="#SkIPoint_x">SkIPoint::x()</a>
    154 
    155 ---
    156 
    157 <a name="SkPoint_y"></a>
    158 ## y
    159 
    160 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
    161 SkScalar y() const
    162 </pre>
    163 
    164 Returns y-axis value of <a href="#Point">Point</a> or <a href="SkPoint_Reference#Vector">Vector</a>.
    165 
    166 ### Return Value
    167 
    168 <a href="#SkPoint_fY">fY</a>
    169 
    170 ### Example
    171 
    172 <div><fiddle-embed name="4c962850c2dbea4d2325df469400680e">
    173 
    174 #### Example Output
    175 
    176 ~~~~
    177 pt1.fY == pt1.y()
    178 ~~~~
    179 
    180 </fiddle-embed></div>
    181 
    182 ### See Also
    183 
    184 <a href="#SkPoint_x">x</a> <a href="#SkIPoint_y">SkIPoint::y()</a>
    185 
    186 ---
    187 
    188 <a name="SkPoint_isZero"></a>
    189 ## isZero
    190 
    191 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
    192 bool isZero() const
    193 </pre>
    194 
    195 Returns true if <a href="#SkPoint_fX">fX</a> and <a href="#SkPoint_fY">fY</a> are both zero.
    196 
    197 ### Return Value
    198 
    199 true if <a href="#SkPoint_fX">fX</a> is zero and <a href="#SkPoint_fY">fY</a> is zero
    200 
    201 ### Example
    202 
    203 <div><fiddle-embed name="81b9665110b88ef6bcbc20464aed7da1">
    204 
    205 #### Example Output
    206 
    207 ~~~~
    208 pt.fX=+0 pt.fY=-0
    209 pt.isZero() == true
    210 ~~~~
    211 
    212 </fiddle-embed></div>
    213 
    214 ### See Also
    215 
    216 <a href="#SkPoint_isFinite">isFinite</a> <a href="#SkIPoint_isZero">SkIPoint::isZero</a>
    217 
    218 ---
    219 
    220 <a name="SkPoint_set"></a>
    221 ## set
    222 
    223 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
    224 void set(SkScalar x, SkScalar y)
    225 </pre>
    226 
    227 Sets <a href="#SkPoint_fX">fX</a> to x and <a href="#SkPoint_fY">fY</a> to y.
    228 
    229 ### Parameters
    230 
    231 <table>  <tr>    <td><a name="SkPoint_set_x"> <code><strong>x </strong></code> </a></td> <td>
    232 new value for <a href="#SkPoint_fX">fX</a></td>
    233   </tr>  <tr>    <td><a name="SkPoint_set_y"> <code><strong>y </strong></code> </a></td> <td>
    234 new value for <a href="#SkPoint_fY">fY</a></td>
    235   </tr>
    236 </table>
    237 
    238 ### Example
    239 
    240 <div><fiddle-embed name="d08d1e7dafcad4342d1619fdbb2f5781">
    241 
    242 #### Example Output
    243 
    244 ~~~~
    245 pt1 == pt2
    246 ~~~~
    247 
    248 </fiddle-embed></div>
    249 
    250 ### See Also
    251 
    252 <a href="#SkPoint_iset">iset</a><sup><a href="#SkPoint_iset_2">[2]</a></sup> <a href="#SkPoint_Make">Make</a>
    253 
    254 ---
    255 
    256 <a name="SkPoint_iset"></a>
    257 ## iset
    258 
    259 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
    260 void iset(int32_t x, int32_t y)
    261 </pre>
    262 
    263 Sets <a href="#SkPoint_fX">fX</a> to x and <a href="#SkPoint_fY">fY</a> to y, promoting integers to <a href="undocumented#SkScalar">SkScalar</a> values.
    264 
    265 Assigning a large integer value directly to <a href="#SkPoint_fX">fX</a> or <a href="#SkPoint_fY">fY</a> may cause a compiler
    266 error, triggered by narrowing conversion of int to <a href="undocumented#SkScalar">SkScalar</a>. This safely
    267 casts x and y to avoid the error.
    268 
    269 ### Parameters
    270 
    271 <table>  <tr>    <td><a name="SkPoint_iset_x"> <code><strong>x </strong></code> </a></td> <td>
    272 new value for <a href="#SkPoint_fX">fX</a></td>
    273   </tr>  <tr>    <td><a name="SkPoint_iset_y"> <code><strong>y </strong></code> </a></td> <td>
    274 new value for <a href="#SkPoint_fY">fY</a></td>
    275   </tr>
    276 </table>
    277 
    278 ### Example
    279 
    280 <div><fiddle-embed name="0d9e8ed734981b5b113f22c7bfde5357"></fiddle-embed></div>
    281 
    282 ### See Also
    283 
    284 <a href="#SkPoint_set">set</a> <a href="#SkPoint_Make">Make</a> <a href="#SkIPoint_set">SkIPoint::set</a>
    285 
    286 ---
    287 
    288 <a name="SkPoint_iset_2"></a>
    289 
    290 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
    291 void iset(const SkIPoint& p)
    292 </pre>
    293 
    294 Sets <a href="#SkPoint_fX">fX</a> to <a href="#SkPoint_iset_2_p">p</a>.<a href="#SkPoint_fX">fX</a> and <a href="#SkPoint_fY">fY</a> to <a href="#SkPoint_iset_2_p">p</a>.<a href="#SkPoint_fY">fY</a>, promoting integers to <a href="undocumented#SkScalar">SkScalar</a> values.
    295 
    296 Assigning an <a href="SkIPoint_Reference#IPoint">IPoint</a> containing a large integer value directly to <a href="#SkPoint_fX">fX</a> or <a href="#SkPoint_fY">fY</a> may
    297 cause a compiler error, triggered by narrowing conversion of int to <a href="undocumented#SkScalar">SkScalar</a>.
    298 This safely casts <a href="#SkPoint_iset_2_p">p</a>.<a href="#SkPoint_fX">fX</a> and <a href="#SkPoint_iset_2_p">p</a>.<a href="#SkPoint_fY">fY</a> to avoid the error.
    299 
    300 ### Parameters
    301 
    302 <table>  <tr>    <td><a name="SkPoint_iset_2_p"> <code><strong>p </strong></code> </a></td> <td>
    303 <a href="SkIPoint_Reference#IPoint">IPoint</a> members promoted to <a href="undocumented#SkScalar">SkScalar</a></td>
    304   </tr>
    305 </table>
    306 
    307 ### Example
    308 
    309 <div><fiddle-embed name="12b7164a769e232bb772f19c59600ee7">
    310 
    311 #### Example Output
    312 
    313 ~~~~
    314 iPt: -2147483647, 2147483647
    315 fPt: -2.14748e+09, 2.14748e+09
    316 ~~~~
    317 
    318 </fiddle-embed></div>
    319 
    320 ### See Also
    321 
    322 <a href="#SkPoint_set">set</a> <a href="#SkPoint_Make">Make</a> <a href="#SkIPoint_set">SkIPoint::set</a>
    323 
    324 ---
    325 
    326 <a name="SkPoint_setAbs"></a>
    327 ## setAbs
    328 
    329 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
    330 void setAbs(const SkPoint& pt)
    331 </pre>
    332 
    333 Sets <a href="#SkPoint_fX">fX</a> to absolute value of <a href="#SkPoint_setAbs_pt">pt</a>.<a href="#SkPoint_fX">fX</a>; and <a href="#SkPoint_fY">fY</a> to absolute value of <a href="#SkPoint_setAbs_pt">pt</a>.<a href="#SkPoint_fY">fY</a>.
    334 
    335 ### Parameters
    336 
    337 <table>  <tr>    <td><a name="SkPoint_setAbs_pt"> <code><strong>pt </strong></code> </a></td> <td>
    338 members providing magnitude for <a href="#SkPoint_fX">fX</a> and <a href="#SkPoint_fY">fY</a></td>
    339   </tr>
    340 </table>
    341 
    342 ### Example
    343 
    344 <div><fiddle-embed name="7f70860e820b67a347cff03c00488426">
    345 
    346 #### Example Output
    347 
    348 ~~~~
    349 pt: 0, -0  abs: 0, 0
    350 pt: -1, -2  abs: 1, 2
    351 pt: inf, -inf  abs: inf, inf
    352 pt: nan, -nan  abs: nan, nan
    353 ~~~~
    354 
    355 </fiddle-embed></div>
    356 
    357 ### See Also
    358 
    359 <a href="#SkPoint_set">set</a> <a href="#SkPoint_Make">Make</a> <a href="#SkPoint_negate">negate</a>
    360 
    361 ---
    362 
    363 <a name="SkPoint_Offset"></a>
    364 ## Offset
    365 
    366 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
    367 static void Offset(SkPoint points[], int count, const SkVector& offset)
    368 </pre>
    369 
    370 Adds offset to each <a href="#Point">Point</a> in <a href="#SkPoint_Offset_points">points</a> array with <a href="#SkPoint_Offset_count">count</a> entries.
    371 
    372 ### Parameters
    373 
    374 <table>  <tr>    <td><a name="SkPoint_Offset_points"> <code><strong>points </strong></code> </a></td> <td>
    375 <a href="#Point">Point</a> array</td>
    376   </tr>  <tr>    <td><a name="SkPoint_Offset_count"> <code><strong>count </strong></code> </a></td> <td>
    377 entries in array</td>
    378   </tr>  <tr>    <td><a name="SkPoint_Offset_offset"> <code><strong>offset </strong></code> </a></td> <td>
    379 <a href="SkPoint_Reference#Vector">Vector</a> added to <a href="#SkPoint_Offset_points">points</a></td>
    380   </tr>
    381 </table>
    382 
    383 ### Example
    384 
    385 <div><fiddle-embed name="f0f24726df78a5d797bcf311e694a0a3"></fiddle-embed></div>
    386 
    387 ### See Also
    388 
    389 <a href="#SkPoint_offset">offset</a> <a href="#SkPoint_addto_operator">operator+=(const SkVector& v)</a>
    390 
    391 ---
    392 
    393 <a name="SkPoint_Offset_2"></a>
    394 
    395 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
    396 static void Offset(SkPoint points[], int count, SkScalar dx, SkScalar dy)
    397 </pre>
    398 
    399 Adds offset (<a href="#SkPoint_Offset_2_dx">dx</a>, <a href="#SkPoint_Offset_2_dy">dy</a>) to each <a href="#Point">Point</a> in <a href="#SkPoint_Offset_2_points">points</a> array of length <a href="#SkPoint_Offset_2_count">count</a>.
    400 
    401 ### Parameters
    402 
    403 <table>  <tr>    <td><a name="SkPoint_Offset_2_points"> <code><strong>points </strong></code> </a></td> <td>
    404 <a href="#Point">Point</a> array</td>
    405   </tr>  <tr>    <td><a name="SkPoint_Offset_2_count"> <code><strong>count </strong></code> </a></td> <td>
    406 entries in array</td>
    407   </tr>  <tr>    <td><a name="SkPoint_Offset_2_dx"> <code><strong>dx </strong></code> </a></td> <td>
    408 added to <a href="#SkPoint_fX">fX</a> in <a href="#SkPoint_Offset_2_points">points</a></td>
    409   </tr>  <tr>    <td><a name="SkPoint_Offset_2_dy"> <code><strong>dy </strong></code> </a></td> <td>
    410 added to <a href="#SkPoint_fY">fY</a> in <a href="#SkPoint_Offset_2_points">points</a></td>
    411   </tr>
    412 </table>
    413 
    414 ### Example
    415 
    416 <div><fiddle-embed name="532849faa838de885b86d3ebffae3712"></fiddle-embed></div>
    417 
    418 ### See Also
    419 
    420 <a href="#SkPoint_offset">offset</a> <a href="#SkPoint_addto_operator">operator+=(const SkVector& v)</a>
    421 
    422 ---
    423 
    424 <a name="SkPoint_offset"></a>
    425 ## offset
    426 
    427 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
    428 void offset(SkScalar dx, SkScalar dy)
    429 </pre>
    430 
    431 Adds offset (<a href="#SkPoint_offset_dx">dx</a>, <a href="#SkPoint_offset_dy">dy</a>) to <a href="#Point">Point</a>.
    432 
    433 ### Parameters
    434 
    435 <table>  <tr>    <td><a name="SkPoint_offset_dx"> <code><strong>dx </strong></code> </a></td> <td>
    436 added to <a href="#SkPoint_fX">fX</a></td>
    437   </tr>  <tr>    <td><a name="SkPoint_offset_dy"> <code><strong>dy </strong></code> </a></td> <td>
    438 added to <a href="#SkPoint_fY">fY</a></td>
    439   </tr>
    440 </table>
    441 
    442 ### Example
    443 
    444 <div><fiddle-embed name="02750ceaa874f956e6e6544ef6b858ee"></fiddle-embed></div>
    445 
    446 ### See Also
    447 
    448 <a href="#SkPoint_Offset">Offset</a><sup><a href="#SkPoint_Offset_2">[2]</a></sup> <a href="#SkPoint_addto_operator">operator+=(const SkVector& v)</a>
    449 
    450 ---
    451 
    452 <a name="SkPoint_length"></a>
    453 ## length
    454 
    455 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
    456 SkScalar length() const
    457 </pre>
    458 
    459 Returns the Euclidean_Distance from origin, computed as:
    460 
    461 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
    462 sqrt(fX * fX + fY * fY)</pre>
    463 
    464 .
    465 
    466 ### Return Value
    467 
    468 straight-line distance to origin
    469 
    470 ### Example
    471 
    472 <div><fiddle-embed name="8363ab179447ee4b827679e20d3d81eb"></fiddle-embed></div>
    473 
    474 ### See Also
    475 
    476 <a href="#SkPoint_distanceToOrigin">distanceToOrigin</a> <a href="#SkPoint_Length">Length</a> <a href="#SkPoint_setLength">setLength</a><sup><a href="#SkPoint_setLength_2">[2]</a></sup> <a href="#SkPoint_Distance">Distance</a>
    477 
    478 ---
    479 
    480 <a name="SkPoint_distanceToOrigin"></a>
    481 ## distanceToOrigin
    482 
    483 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
    484 SkScalar distanceToOrigin() const
    485 </pre>
    486 
    487 Returns the Euclidean_Distance from origin, computed as:
    488 
    489 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
    490 sqrt(fX * fX + fY * fY)</pre>
    491 
    492 .
    493 
    494 ### Return Value
    495 
    496 straight-line distance to origin
    497 
    498 ### Example
    499 
    500 <div><fiddle-embed name="812cf26d91b1cdcd2c6b9438a8172518"></fiddle-embed></div>
    501 
    502 ### See Also
    503 
    504 <a href="#SkPoint_length">length</a> <a href="#SkPoint_Length">Length</a> <a href="#SkPoint_setLength">setLength</a><sup><a href="#SkPoint_setLength_2">[2]</a></sup> <a href="#SkPoint_Distance">Distance</a>
    505 
    506 ---
    507 
    508 <a name="SkPoint_normalize"></a>
    509 ## normalize
    510 
    511 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
    512 bool normalize()
    513 </pre>
    514 
    515 Scales (<a href="#SkPoint_fX">fX</a>, <a href="#SkPoint_fY">fY</a>) so that <a href="#SkPoint_length">length</a> returns one, while preserving ratio of <a href="#SkPoint_fX">fX</a> to <a href="#SkPoint_fY">fY</a>,
    516 if possible. If prior length is nearly zero, sets <a href="SkPoint_Reference#Vector">Vector</a> to (0, 0) and returns
    517 false; otherwise returns true.
    518 
    519 ### Return Value
    520 
    521 true if former length is not zero or nearly zero
    522 
    523 ### Example
    524 
    525 <div><fiddle-embed name="d84fce292d86c7d9ef37ae2d179c03c7"></fiddle-embed></div>
    526 
    527 ### See Also
    528 
    529 <a href="#SkPoint_Normalize">Normalize</a> <a href="#SkPoint_setLength">setLength</a><sup><a href="#SkPoint_setLength_2">[2]</a></sup> <a href="#SkPoint_length">length</a> <a href="#SkPoint_Length">Length</a>
    530 
    531 ---
    532 
    533 <a name="SkPoint_setNormalize"></a>
    534 ## setNormalize
    535 
    536 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
    537 bool setNormalize(SkScalar x, SkScalar y)
    538 </pre>
    539 
    540 Sets <a href="SkPoint_Reference#Vector">Vector</a> to (x, y) scaled so <a href="#SkPoint_length">length</a> returns one, and so that
    541 (<a href="#SkPoint_fX">fX</a>, <a href="#SkPoint_fY">fY</a>) is proportional to (x, y).  If (x, y) length is nearly zero,
    542 sets <a href="SkPoint_Reference#Vector">Vector</a> to (0, 0) and returns false; otherwise returns true.
    543 
    544 ### Parameters
    545 
    546 <table>  <tr>    <td><a name="SkPoint_setNormalize_x"> <code><strong>x </strong></code> </a></td> <td>
    547 proportional value for <a href="#SkPoint_fX">fX</a></td>
    548   </tr>  <tr>    <td><a name="SkPoint_setNormalize_y"> <code><strong>y </strong></code> </a></td> <td>
    549 proportional value for <a href="#SkPoint_fY">fY</a></td>
    550   </tr>
    551 </table>
    552 
    553 ### Return Value
    554 
    555 true if (x, y) length is not zero or nearly zero
    556 
    557 ### Example
    558 
    559 <div><fiddle-embed name="3e4f147d143a388802484bf0d26534c2"></fiddle-embed></div>
    560 
    561 ### See Also
    562 
    563 <a href="#SkPoint_normalize">normalize</a> <a href="#SkPoint_setLength">setLength</a><sup><a href="#SkPoint_setLength_2">[2]</a></sup>
    564 
    565 ---
    566 
    567 <a name="SkPoint_setLength"></a>
    568 ## setLength
    569 
    570 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
    571 bool setLength(SkScalar length)
    572 </pre>
    573 
    574 Scales <a href="SkPoint_Reference#Vector">Vector</a> so that <a href="#SkPoint_distanceToOrigin">distanceToOrigin</a> returns length, if possible. If former
    575 length is nearly zero, sets <a href="SkPoint_Reference#Vector">Vector</a> to (0, 0) and return false; otherwise returns
    576 true.
    577 
    578 ### Parameters
    579 
    580 <table>  <tr>    <td><a name="SkPoint_setLength_length"> <code><strong>length </strong></code> </a></td> <td>
    581 straight-line distance to origin</td>
    582   </tr>
    583 </table>
    584 
    585 ### Return Value
    586 
    587 true if former length is not zero or nearly zero
    588 
    589 ### Example
    590 
    591 <div><fiddle-embed name="cbe7db206ece825aa3b9b7c3256aeaf0"></fiddle-embed></div>
    592 
    593 ### See Also
    594 
    595 <a href="#SkPoint_length">length</a> <a href="#SkPoint_Length">Length</a> <a href="#SkPoint_setNormalize">setNormalize</a> <a href="#SkPoint_setAbs">setAbs</a>
    596 
    597 ---
    598 
    599 <a name="SkPoint_setLength_2"></a>
    600 
    601 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
    602 bool setLength(SkScalar x, SkScalar y, SkScalar length)
    603 </pre>
    604 
    605 Sets <a href="SkPoint_Reference#Vector">Vector</a> to (x, y) scaled to length, if possible. If former
    606 length is nearly zero, sets <a href="SkPoint_Reference#Vector">Vector</a> to (0, 0) and return false; otherwise returns
    607 true.
    608 
    609 ### Parameters
    610 
    611 <table>  <tr>    <td><a name="SkPoint_setLength_2_x"> <code><strong>x </strong></code> </a></td> <td>
    612 proportional value for <a href="#SkPoint_fX">fX</a></td>
    613   </tr>  <tr>    <td><a name="SkPoint_setLength_2_y"> <code><strong>y </strong></code> </a></td> <td>
    614 proportional value for <a href="#SkPoint_fY">fY</a></td>
    615   </tr>  <tr>    <td><a name="SkPoint_setLength_2_length"> <code><strong>length </strong></code> </a></td> <td>
    616 straight-line distance to origin</td>
    617   </tr>
    618 </table>
    619 
    620 ### Return Value
    621 
    622 true if (x, y) length is not zero or nearly zero
    623 
    624 ### Example
    625 
    626 <div><fiddle-embed name="3cc0662b6fbbee1fe3442a0acfece22c"></fiddle-embed></div>
    627 
    628 ### See Also
    629 
    630 <a href="#SkPoint_length">length</a> <a href="#SkPoint_Length">Length</a> <a href="#SkPoint_setNormalize">setNormalize</a> <a href="#SkPoint_setAbs">setAbs</a>
    631 
    632 ---
    633 
    634 <a name="SkPoint_scale"></a>
    635 ## scale
    636 
    637 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
    638 void scale(SkScalar scale, SkPoint* dst) const
    639 </pre>
    640 
    641 Sets <a href="#SkPoint_scale_dst">dst</a> to <a href="#Point">Point</a> times scale. <a href="#SkPoint_scale_dst">dst</a> may be <a href="#Point">Point</a> to modify <a href="#Point">Point</a> in place.
    642 
    643 ### Parameters
    644 
    645 <table>  <tr>    <td><a name="SkPoint_scale_scale"> <code><strong>scale </strong></code> </a></td> <td>
    646 factor to multiply <a href="#Point">Point</a> by</td>
    647   </tr>  <tr>    <td><a name="SkPoint_scale_dst"> <code><strong>dst </strong></code> </a></td> <td>
    648 storage for scaled <a href="#Point">Point</a></td>
    649   </tr>
    650 </table>
    651 
    652 ### Example
    653 
    654 <div><fiddle-embed name="972e4e230806281adb928e068bcd8551"></fiddle-embed></div>
    655 
    656 ### See Also
    657 
    658 <a href="#SkPoint_multiply_operator">operator*(SkScalar scale) const</a> <a href="#SkPoint_multiplyby_operator">operator*=(SkScalar scale)</a> <a href="#SkPoint_setLength">setLength</a><sup><a href="#SkPoint_setLength_2">[2]</a></sup>
    659 
    660 ---
    661 
    662 <a name="SkPoint_scale_2"></a>
    663 
    664 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
    665 void scale(SkScalar value)
    666 </pre>
    667 
    668 Scales <a href="#Point">Point</a> in place by scale.
    669 
    670 ### Parameters
    671 
    672 <table>  <tr>    <td><a name="SkPoint_scale_2_value"> <code><strong>value </strong></code> </a></td> <td>
    673 factor to multiply <a href="#Point">Point</a> by</td>
    674   </tr>
    675 </table>
    676 
    677 ### Example
    678 
    679 <div><fiddle-embed name="1060a4f27d8ef29519e6ac006ce90f2b"></fiddle-embed></div>
    680 
    681 ### See Also
    682 
    683 <a href="#SkPoint_multiply_operator">operator*(SkScalar scale) const</a> <a href="#SkPoint_multiplyby_operator">operator*=(SkScalar scale)</a> <a href="#SkPoint_setLength">setLength</a><sup><a href="#SkPoint_setLength_2">[2]</a></sup>
    684 
    685 ---
    686 
    687 <a name="SkPoint_negate"></a>
    688 ## negate
    689 
    690 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
    691 void negate()
    692 </pre>
    693 
    694 Changes the sign of <a href="#SkPoint_fX">fX</a> and <a href="#SkPoint_fY">fY</a>.
    695 
    696 ### Example
    697 
    698 <div><fiddle-embed name="312c0c8065ab5d0adfda80cccf2d11e6">
    699 
    700 #### Example Output
    701 
    702 ~~~~
    703 pt: 0, -0  negate: -0, 0
    704 pt: -1, -2  negate: 1, 2
    705 pt: inf, -inf  negate: -inf, inf
    706 pt: nan, -nan  negate: -nan, nan
    707 ~~~~
    708 
    709 </fiddle-embed></div>
    710 
    711 ### See Also
    712 
    713 <a href="#SkPoint_minus_operator">operator-() const</a> <a href="#SkPoint_setAbs">setAbs</a>
    714 
    715 ---
    716 
    717 <a name="SkPoint_minus_operator"></a>
    718 ## operator-
    719 
    720 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
    721 SkPoint operator-() _const
    722 </pre>
    723 
    724 Returns <a href="#Point">Point</a> changing the signs of <a href="#SkPoint_fX">fX</a> and <a href="#SkPoint_fY">fY</a>.
    725 
    726 ### Return Value
    727 
    728 <a href="#Point">Point</a> as (-<a href="#SkPoint_fX">fX</a>, -<a href="#SkPoint_fY">fY</a>)
    729 
    730 ### Example
    731 
    732 <div><fiddle-embed name="9baf247cfcd8272c0ddf6ce93f676b37">
    733 
    734 #### Example Output
    735 
    736 ~~~~
    737 pt: 0, -0  negate: -0, 0
    738 pt: -1, -2  negate: 1, 2
    739 pt: inf, -inf  negate: -inf, inf
    740 pt: nan, -nan  negate: -nan, nan
    741 ~~~~
    742 
    743 </fiddle-embed></div>
    744 
    745 ### See Also
    746 
    747 <a href="#SkPoint_negate">negate</a> <a href="#SkPoint_subtract_operator">operator-(const SkPoint& a, const SkPoint& b)</a> <a href="#SkPoint_subtractfrom_operator">operator-=(const SkVector& v)</a> <a href="#SkIPoint_minus_operator">SkIPoint::operator-() const</a>
    748 
    749 ---
    750 
    751 <a name="SkPoint_addto_operator"></a>
    752 ## operator+=
    753 
    754 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
    755 void operator+=(const SkVector& v)
    756 </pre>
    757 
    758 Adds <a href="SkPoint_Reference#Vector">Vector</a> <a href="#SkPoint_addto_operator_v">v</a> to <a href="#Point">Point</a>. Sets <a href="#Point">Point</a> to:
    759 (<a href="#SkPoint_fX">fX</a> + <a href="#SkPoint_addto_operator_v">v</a>.<a href="#SkPoint_fX">fX</a>, <a href="#SkPoint_fY">fY</a> + <a href="#SkPoint_addto_operator_v">v</a>.<a href="#SkPoint_fY">fY</a>).
    760 
    761 ### Parameters
    762 
    763 <table>  <tr>    <td><a name="SkPoint_addto_operator_v"> <code><strong>v </strong></code> </a></td> <td>
    764 <a href="SkPoint_Reference#Vector">Vector</a> to add</td>
    765   </tr>
    766 </table>
    767 
    768 ### Example
    769 
    770 <div><fiddle-embed name="8b4e79109e2381345258cb744881b20c"></fiddle-embed></div>
    771 
    772 ### See Also
    773 
    774 <a href="#SkPoint_offset">offset</a> <a href="#SkPoint_add_operator">operator+(const SkPoint& a, const SkVector& b)</a> <a href="#SkIPoint_addto_operator">SkIPoint::operator+=(const SkIVector& v)</a>
    775 
    776 ---
    777 
    778 <a name="SkPoint_subtractfrom_operator"></a>
    779 ## operator-=
    780 
    781 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
    782 void operator-=(const SkVector& v)
    783 </pre>
    784 
    785 Subtracts <a href="SkPoint_Reference#Vector">Vector</a> <a href="#SkPoint_subtractfrom_operator_v">v</a> from <a href="#Point">Point</a>. Sets <a href="#Point">Point</a> to:
    786 (<a href="#SkPoint_fX">fX</a> - <a href="#SkPoint_subtractfrom_operator_v">v</a>.<a href="#SkPoint_fX">fX</a>, <a href="#SkPoint_fY">fY</a> - <a href="#SkPoint_subtractfrom_operator_v">v</a>.<a href="#SkPoint_fY">fY</a>).
    787 
    788 ### Parameters
    789 
    790 <table>  <tr>    <td><a name="SkPoint_subtractfrom_operator_v"> <code><strong>v </strong></code> </a></td> <td>
    791 <a href="SkPoint_Reference#Vector">Vector</a> to subtract</td>
    792   </tr>
    793 </table>
    794 
    795 ### Example
    796 
    797 <div><fiddle-embed name="86c0399704d8dff4091bf87b8d87d40b"></fiddle-embed></div>
    798 
    799 ### See Also
    800 
    801 <a href="#SkPoint_offset">offset</a> <a href="#SkPoint_subtract_operator">operator-(const SkPoint& a, const SkPoint& b)</a> <a href="#SkIPoint_subtractfrom_operator">SkIPoint::operator-=(const SkIVector& v)</a>
    802 
    803 ---
    804 
    805 <a name="SkPoint_multiply_operator"></a>
    806 ## operator*
    807 
    808 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
    809 SkPoint operator*(SkScalar scale) _const
    810 </pre>
    811 
    812 Returns <a href="#Point">Point</a> multiplied by scale.
    813 
    814 ### Parameters
    815 
    816 <table>  <tr>    <td><a name="SkPoint_multiply_operator_scale"> <code><strong>scale </strong></code> </a></td> <td>
    817 <a href="#Scalar">Scalar</a> to multiply by</td>
    818   </tr>
    819 </table>
    820 
    821 ### Return Value
    822 
    823 <a href="#Point">Point</a> as (<a href="#SkPoint_fX">fX</a> * scale, <a href="#SkPoint_fY">fY</a> * scale)
    824 
    825 ### Example
    826 
    827 <div><fiddle-embed name="35b3bc675779de043706ae4817ee950c"></fiddle-embed></div>
    828 
    829 ### See Also
    830 
    831 <a href="#SkPoint_multiplyby_operator">operator*=(SkScalar scale)</a> <a href="#SkPoint_scale">scale</a><sup><a href="#SkPoint_scale_2">[2]</a></sup> <a href="#SkPoint_setLength">setLength</a><sup><a href="#SkPoint_setLength_2">[2]</a></sup> <a href="#SkPoint_setNormalize">setNormalize</a>
    832 
    833 ---
    834 
    835 <a name="SkPoint_multiplyby_operator"></a>
    836 ## operator*=
    837 
    838 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
    839 SkPoint& operator*=(SkScalar scale)
    840 </pre>
    841 
    842 Multiplies <a href="#Point">Point</a> by scale. Sets <a href="#Point">Point</a> to:
    843 (<a href="#SkPoint_fX">fX</a> * scale, <a href="#SkPoint_fY">fY</a> * scale)
    844 
    845 ### Parameters
    846 
    847 <table>  <tr>    <td><a name="SkPoint_multiplyby_operator_scale"> <code><strong>scale </strong></code> </a></td> <td>
    848 <a href="#Scalar">Scalar</a> to multiply by</td>
    849   </tr>
    850 </table>
    851 
    852 ### Return Value
    853 
    854 reference to <a href="#Point">Point</a>
    855 
    856 ### Example
    857 
    858 <div><fiddle-embed name="3ce3db36235d80dbac4d39504cf756da"></fiddle-embed></div>
    859 
    860 ### See Also
    861 
    862 <a href="#SkPoint_multiply_operator">operator*(SkScalar scale) const</a> <a href="#SkPoint_scale">scale</a><sup><a href="#SkPoint_scale_2">[2]</a></sup> <a href="#SkPoint_setLength">setLength</a><sup><a href="#SkPoint_setLength_2">[2]</a></sup> <a href="#SkPoint_setNormalize">setNormalize</a>
    863 
    864 ---
    865 
    866 <a name="SkPoint_isFinite"></a>
    867 ## isFinite
    868 
    869 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
    870 bool isFinite() const
    871 </pre>
    872 
    873 Returns true if both <a href="#SkPoint_fX">fX</a> and <a href="#SkPoint_fY">fY</a> are measurable values.
    874 
    875 ### Return Value
    876 
    877 true for values other than infinities and NaN
    878 
    879 ### Example
    880 
    881 <div><fiddle-embed name="937cc166cc0e220f33fb82501141d0b3">
    882 
    883 #### Example Output
    884 
    885 ~~~~
    886 pt: 0, -0  finite: true
    887 pt: -1, -2  finite: true
    888 pt: inf, 1  finite: false
    889 pt: nan, -1  finite: false
    890 ~~~~
    891 
    892 </fiddle-embed></div>
    893 
    894 ### See Also
    895 
    896 <a href="#SkRect_isFinite">SkRect::isFinite</a> <a href="#SkPath_isFinite">SkPath::isFinite</a>
    897 
    898 ---
    899 
    900 <a name="SkPoint_equals"></a>
    901 ## equals
    902 
    903 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
    904 bool equals(SkScalar x, SkScalar y) const
    905 </pre>
    906 
    907 Returns true if <a href="#Point">Point</a> is equivalent to <a href="#Point">Point</a> constructed from (x, y).
    908 
    909 ### Parameters
    910 
    911 <table>  <tr>    <td><a name="SkPoint_equals_x"> <code><strong>x </strong></code> </a></td> <td>
    912 value compared with <a href="#SkPoint_fX">fX</a></td>
    913   </tr>  <tr>    <td><a name="SkPoint_equals_y"> <code><strong>y </strong></code> </a></td> <td>
    914 value compared with <a href="#SkPoint_fY">fY</a></td>
    915   </tr>
    916 </table>
    917 
    918 ### Return Value
    919 
    920 true if <a href="#Point">Point</a> equals (x, y)
    921 
    922 ### Example
    923 
    924 <div><fiddle-embed name="4cecb878c8b66beffda051f26c00f817">
    925 
    926 #### Example Output
    927 
    928 ~~~~
    929 pt: 0, -0  == pt
    930 pt: -1, -2  == pt
    931 pt: inf, 1  == pt
    932 pt: nan, -1  != pt
    933 ~~~~
    934 
    935 </fiddle-embed></div>
    936 
    937 ### See Also
    938 
    939 <a href="#SkPoint_equal_operator">operator==(const SkPoint& a, const SkPoint& b)</a>
    940 
    941 ---
    942 
    943 <a name="SkPoint_equal_operator"></a>
    944 ## operator==
    945 
    946 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
    947 bool operator==(const SkPoint& a, const SkPoint& b)
    948 </pre>
    949 
    950 Returns true if <a href="#SkPoint_equal_operator_a">a</a> is equivalent to <a href="#SkPoint_equal_operator_b">b</a>.
    951 
    952 ### Parameters
    953 
    954 <table>  <tr>    <td><a name="SkPoint_equal_operator_a"> <code><strong>a </strong></code> </a></td> <td>
    955 <a href="#Point">Point</a> to compare</td>
    956   </tr>  <tr>    <td><a name="SkPoint_equal_operator_b"> <code><strong>b </strong></code> </a></td> <td>
    957 <a href="#Point">Point</a> to compare</td>
    958   </tr>
    959 </table>
    960 
    961 ### Return Value
    962 
    963 true if <a href="#SkPoint_equal_operator_a">a</a>.<a href="#SkPoint_fX">fX</a> == <a href="#SkPoint_equal_operator_b">b</a>.<a href="#SkPoint_fX">fX</a> and <a href="#SkPoint_equal_operator_a">a</a>.<a href="#SkPoint_fY">fY</a> == <a href="#SkPoint_equal_operator_b">b</a>.<a href="#SkPoint_fY">fY</a>
    964 
    965 ### Example
    966 
    967 <div><fiddle-embed name="741f793334a48a35dadf4310d7ea52cb">
    968 
    969 #### Example Output
    970 
    971 ~~~~
    972 pt: 0, -0  == pt
    973 pt: -1, -2  == pt
    974 pt: inf, 1  == pt
    975 pt: nan, -1  != pt
    976 ~~~~
    977 
    978 </fiddle-embed></div>
    979 
    980 ### See Also
    981 
    982 <a href="#SkPoint_equals">equals</a> <a href="#SkPoint_notequal_operator">operator!=(const SkPoint& a, const SkPoint& b)</a>
    983 
    984 ---
    985 
    986 <a name="SkPoint_notequal_operator"></a>
    987 ## operator!=
    988 
    989 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
    990 bool operator!=(const SkPoint& a, const SkPoint& b)
    991 </pre>
    992 
    993 Returns true if <a href="#SkPoint_notequal_operator_a">a</a> is not equivalent to <a href="#SkPoint_notequal_operator_b">b</a>.
    994 
    995 ### Parameters
    996 
    997 <table>  <tr>    <td><a name="SkPoint_notequal_operator_a"> <code><strong>a </strong></code> </a></td> <td>
    998 <a href="#Point">Point</a> to compare</td>
    999   </tr>  <tr>    <td><a name="SkPoint_notequal_operator_b"> <code><strong>b </strong></code> </a></td> <td>
   1000 <a href="#Point">Point</a> to compare</td>
   1001   </tr>
   1002 </table>
   1003 
   1004 ### Return Value
   1005 
   1006 true if <a href="#SkPoint_notequal_operator_a">a</a>.<a href="#SkPoint_fX">fX</a> != <a href="#SkPoint_notequal_operator_b">b</a>.<a href="#SkPoint_fX">fX</a> or <a href="#SkPoint_notequal_operator_a">a</a>.<a href="#SkPoint_fY">fY</a> != <a href="#SkPoint_notequal_operator_b">b</a>.<a href="#SkPoint_fY">fY</a>
   1007 
   1008 ### Example
   1009 
   1010 <div><fiddle-embed name="8fe8572685eaa617f25a5a6767a874dc">
   1011 
   1012 #### Example Output
   1013 
   1014 ~~~~
   1015 pt: 0, -0  == pt
   1016 pt: -1, -2  == pt
   1017 pt: inf, 1  == pt
   1018 pt: nan, -1  != pt
   1019 ~~~~
   1020 
   1021 </fiddle-embed></div>
   1022 
   1023 ### See Also
   1024 
   1025 <a href="#SkPoint_equal_operator">operator==(const SkPoint& a, const SkPoint& b)</a> <a href="#SkPoint_equals">equals</a>
   1026 
   1027 ---
   1028 
   1029 <a name="SkPoint_subtract_operator"></a>
   1030 ## operator-
   1031 
   1032 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
   1033 SkVector operator-(const SkPoint& a, const SkPoint& b)
   1034 </pre>
   1035 
   1036 Returns <a href="SkPoint_Reference#Vector">Vector</a> from <a href="#SkPoint_subtract_operator_b">b</a> to <a href="#SkPoint_subtract_operator_a">a</a>, computed as(<a href="#SkPoint_subtract_operator_a">a</a>.<a href="#SkPoint_fX">fX</a> - <a href="#SkPoint_subtract_operator_b">b</a>.<a href="#SkPoint_fX">fX</a>, <a href="#SkPoint_subtract_operator_a">a</a>.<a href="#SkPoint_fY">fY</a> - <a href="#SkPoint_subtract_operator_b">b</a>.<a href="#SkPoint_fY">fY</a>).
   1037 
   1038 Can also be used to subtract <a href="SkPoint_Reference#Vector">Vector</a> from <a href="#Point">Point</a>, returning <a href="#Point">Point</a>.
   1039 Can also be used to subtract <a href="SkPoint_Reference#Vector">Vector</a> from <a href="SkPoint_Reference#Vector">Vector</a>, returning <a href="SkPoint_Reference#Vector">Vector</a>.
   1040 
   1041 ### Parameters
   1042 
   1043 <table>  <tr>    <td><a name="SkPoint_subtract_operator_a"> <code><strong>a </strong></code> </a></td> <td>
   1044 <a href="#Point">Point</a> to subtract from</td>
   1045   </tr>  <tr>    <td><a name="SkPoint_subtract_operator_b"> <code><strong>b </strong></code> </a></td> <td>
   1046 <a href="#Point">Point</a> to subtract</td>
   1047   </tr>
   1048 </table>
   1049 
   1050 ### Return Value
   1051 
   1052 <a href="SkPoint_Reference#Vector">Vector</a> from <a href="#SkPoint_subtract_operator_b">b</a> to <a href="#SkPoint_subtract_operator_a">a</a>
   1053 
   1054 ### Example
   1055 
   1056 <div><fiddle-embed name="b6c4943ecd0b2dccf9d220b8944009e0"></fiddle-embed></div>
   1057 
   1058 ### See Also
   1059 
   1060 <a href="#SkPoint_subtractfrom_operator">operator-=(const SkVector& v)</a> <a href="#SkPoint_offset">offset</a>
   1061 
   1062 ---
   1063 
   1064 <a name="SkPoint_add_operator"></a>
   1065 ## operator+
   1066 
   1067 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
   1068 SkPoint operator+(const SkPoint& a, const SkVector& b)
   1069 </pre>
   1070 
   1071 Returns <a href="#Point">Point</a> resulting from <a href="#Point">Point</a> <a href="#SkPoint_add_operator_a">a</a> offset by <a href="SkPoint_Reference#Vector">Vector</a> <a href="#SkPoint_add_operator_b">b</a>, computed as:
   1072 (<a href="#SkPoint_add_operator_a">a</a>.<a href="#SkPoint_fX">fX</a> + <a href="#SkPoint_add_operator_b">b</a>.<a href="#SkPoint_fX">fX</a>, <a href="#SkPoint_add_operator_a">a</a>.<a href="#SkPoint_fY">fY</a> + <a href="#SkPoint_add_operator_b">b</a>.<a href="#SkPoint_fY">fY</a>).
   1073 
   1074 Can also be used to offset <a href="#Point">Point</a> <a href="#SkPoint_add_operator_b">b</a> by <a href="SkPoint_Reference#Vector">Vector</a> <a href="#SkPoint_add_operator_a">a</a>, returning <a href="#Point">Point</a>.
   1075 Can also be used to add <a href="SkPoint_Reference#Vector">Vector</a> to <a href="SkPoint_Reference#Vector">Vector</a>, returning <a href="SkPoint_Reference#Vector">Vector</a>.
   1076 
   1077 ### Parameters
   1078 
   1079 <table>  <tr>    <td><a name="SkPoint_add_operator_a"> <code><strong>a </strong></code> </a></td> <td>
   1080 <a href="#Point">Point</a> or <a href="SkPoint_Reference#Vector">Vector</a> to add to</td>
   1081   </tr>  <tr>    <td><a name="SkPoint_add_operator_b"> <code><strong>b </strong></code> </a></td> <td>
   1082 <a href="#Point">Point</a> or <a href="SkPoint_Reference#Vector">Vector</a> to add</td>
   1083   </tr>
   1084 </table>
   1085 
   1086 ### Return Value
   1087 
   1088 <a href="#Point">Point</a> equal to <a href="#SkPoint_add_operator_a">a</a> offset by <a href="#SkPoint_add_operator_b">b</a>
   1089 
   1090 ### Example
   1091 
   1092 <div><fiddle-embed name="911a84253dfec4dabf94dbe3c71766f0"></fiddle-embed></div>
   1093 
   1094 ### See Also
   1095 
   1096 <a href="#SkPoint_addto_operator">operator+=(const SkVector& v)</a> <a href="#SkPoint_offset">offset</a>
   1097 
   1098 ---
   1099 
   1100 <a name="SkPoint_Length"></a>
   1101 ## Length
   1102 
   1103 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
   1104 static SkScalar Length(SkScalar x, SkScalar y)
   1105 </pre>
   1106 
   1107 Returns the Euclidean_Distance from origin, computed as:
   1108 
   1109 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
   1110 sqrt(x * x + y * y)</pre>
   1111 
   1112 .
   1113 
   1114 ### Parameters
   1115 
   1116 <table>  <tr>    <td><a name="SkPoint_Length_x"> <code><strong>x </strong></code> </a></td> <td>
   1117 component of length</td>
   1118   </tr>  <tr>    <td><a name="SkPoint_Length_y"> <code><strong>y </strong></code> </a></td> <td>
   1119 component of length</td>
   1120   </tr>
   1121 </table>
   1122 
   1123 ### Return Value
   1124 
   1125 straight-line distance to origin
   1126 
   1127 ### Example
   1128 
   1129 <div><fiddle-embed name="c98773d8b4509969d78cb8121e4b77f6"></fiddle-embed></div>
   1130 
   1131 ### See Also
   1132 
   1133 <a href="#SkPoint_length">length</a> <a href="#SkPoint_Distance">Distance</a> <a href="#SkPoint_setLength">setLength</a><sup><a href="#SkPoint_setLength_2">[2]</a></sup>
   1134 
   1135 ---
   1136 
   1137 <a name="SkPoint_Normalize"></a>
   1138 ## Normalize
   1139 
   1140 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
   1141 static SkScalar Normalize(SkVector* vec)
   1142 </pre>
   1143 
   1144 Scales (<a href="#SkPoint_Normalize_vec">vec</a>-><a href="#SkPoint_fX">fX</a>, <a href="#SkPoint_Normalize_vec">vec</a>-><a href="#SkPoint_fY">fY</a>) so that <a href="#SkPoint_length">length</a> returns one, while preserving ratio of <a href="#SkPoint_Normalize_vec">vec</a>-><a href="#SkPoint_fX">fX</a> to <a href="#SkPoint_Normalize_vec">vec</a>-><a href="#SkPoint_fY">fY</a>,
   1145 if possible. If original length is nearly zero, sets <a href="#SkPoint_Normalize_vec">vec</a> to (0, 0) and returns zero;
   1146 otherwise, returns length of <a href="#SkPoint_Normalize_vec">vec</a> before <a href="#SkPoint_Normalize_vec">vec</a> is scaled.
   1147 
   1148 Returned prior length may be <a href="undocumented#SK_ScalarInfinity">SK ScalarInfinity</a> if it can not be represented by <a href="undocumented#SkScalar">SkScalar</a>.
   1149 
   1150 Note that <a href="#SkPoint_normalize">normalize</a> is faster if prior length is not required.
   1151 
   1152 ### Parameters
   1153 
   1154 <table>  <tr>    <td><a name="SkPoint_Normalize_vec"> <code><strong>vec </strong></code> </a></td> <td>
   1155 normalized to unit length</td>
   1156   </tr>
   1157 </table>
   1158 
   1159 ### Return Value
   1160 
   1161 original <a href="#SkPoint_Normalize_vec">vec</a> length
   1162 
   1163 ### Example
   1164 
   1165 <div><fiddle-embed name="60a08f3ce75374fc815384616d114df7"></fiddle-embed></div>
   1166 
   1167 ### See Also
   1168 
   1169 <a href="#SkPoint_normalize">normalize</a> <a href="#SkPoint_setLength">setLength</a><sup><a href="#SkPoint_setLength_2">[2]</a></sup> <a href="#SkPoint_Length">Length</a>
   1170 
   1171 ---
   1172 
   1173 <a name="SkPoint_Distance"></a>
   1174 ## Distance
   1175 
   1176 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
   1177 static SkScalar Distance(const SkPoint& a, const SkPoint& b)
   1178 </pre>
   1179 
   1180 Returns the Euclidean_Distance between <a href="#SkPoint_Distance_a">a</a> and <a href="#SkPoint_Distance_b">b</a>.
   1181 
   1182 ### Parameters
   1183 
   1184 <table>  <tr>    <td><a name="SkPoint_Distance_a"> <code><strong>a </strong></code> </a></td> <td>
   1185 line end point</td>
   1186   </tr>  <tr>    <td><a name="SkPoint_Distance_b"> <code><strong>b </strong></code> </a></td> <td>
   1187 line end point</td>
   1188   </tr>
   1189 </table>
   1190 
   1191 ### Return Value
   1192 
   1193 straight-line distance from <a href="#SkPoint_Distance_a">a</a> to <a href="#SkPoint_Distance_b">b</a>
   1194 
   1195 ### Example
   1196 
   1197 <div><fiddle-embed name="9e0a2de2eb94dba4521d733e73f2bda5"></fiddle-embed></div>
   1198 
   1199 ### See Also
   1200 
   1201 <a href="#SkPoint_length">length</a> <a href="#SkPoint_setLength">setLength</a><sup><a href="#SkPoint_setLength_2">[2]</a></sup>
   1202 
   1203 ---
   1204 
   1205 <a name="SkPoint_DotProduct"></a>
   1206 ## DotProduct
   1207 
   1208 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
   1209 static SkScalar DotProduct(const SkVector& a, const SkVector& b)
   1210 </pre>
   1211 
   1212 Returns the dot product of <a href="SkPoint_Reference#Vector">Vector</a> <a href="#SkPoint_DotProduct_a">a</a> and <a href="SkPoint_Reference#Vector">Vector</a> <a href="#SkPoint_DotProduct_b">b</a>.
   1213 
   1214 ### Parameters
   1215 
   1216 <table>  <tr>    <td><a name="SkPoint_DotProduct_a"> <code><strong>a </strong></code> </a></td> <td>
   1217 left side of dot product</td>
   1218   </tr>  <tr>    <td><a name="SkPoint_DotProduct_b"> <code><strong>b </strong></code> </a></td> <td>
   1219 right side of dot product</td>
   1220   </tr>
   1221 </table>
   1222 
   1223 ### Return Value
   1224 
   1225 product of input magnitudes and cosine of the angle between them
   1226 
   1227 ### Example
   1228 
   1229 <div><fiddle-embed name="496db0131a003162faba7d7f98b30340"></fiddle-embed></div>
   1230 
   1231 ### See Also
   1232 
   1233 <a href="#SkPoint_dot">dot</a> <a href="#SkPoint_CrossProduct">CrossProduct</a>
   1234 
   1235 ---
   1236 
   1237 <a name="SkPoint_CrossProduct"></a>
   1238 ## CrossProduct
   1239 
   1240 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
   1241 static SkScalar CrossProduct(const SkVector& a, const SkVector& b)
   1242 </pre>
   1243 
   1244 Returns the cross product of <a href="SkPoint_Reference#Vector">Vector</a> <a href="#SkPoint_CrossProduct_a">a</a> and <a href="SkPoint_Reference#Vector">Vector</a> <a href="#SkPoint_CrossProduct_b">b</a>.
   1245 
   1246 <a href="#SkPoint_CrossProduct_a">a</a> and <a href="#SkPoint_CrossProduct_b">b</a> form three-dimensional vectors with z equal to zero. The cross product
   1247 is <a href="#SkPoint_CrossProduct_a">a</a> three-dimensional vector with x and y equal to zero. The cross product z
   1248 term equals the returned value.
   1249 
   1250 ### Parameters
   1251 
   1252 <table>  <tr>    <td><a name="SkPoint_CrossProduct_a"> <code><strong>a </strong></code> </a></td> <td>
   1253 left side of cross product</td>
   1254   </tr>  <tr>    <td><a name="SkPoint_CrossProduct_b"> <code><strong>b </strong></code> </a></td> <td>
   1255 right side of cross product</td>
   1256   </tr>
   1257 </table>
   1258 
   1259 ### Return Value
   1260 
   1261 area spanned by <a href="#Vector">Vectors</a> signed by angle direction
   1262 
   1263 ### Example
   1264 
   1265 <div><fiddle-embed name="8b8a4cd8a29d22bb9c5e63b70357bd65"></fiddle-embed></div>
   1266 
   1267 ### See Also
   1268 
   1269 <a href="#SkPoint_cross">cross</a> <a href="#SkPoint_DotProduct">DotProduct</a>
   1270 
   1271 ---
   1272 
   1273 <a name="SkPoint_cross"></a>
   1274 ## cross
   1275 
   1276 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
   1277 SkScalar cross(const SkVector& vec) const
   1278 </pre>
   1279 
   1280 Returns the cross product of <a href="SkPoint_Reference#Vector">Vector</a> and <a href="#SkPoint_cross_vec">vec</a>.
   1281 
   1282 <a href="SkPoint_Reference#Vector">Vector</a> and <a href="#SkPoint_cross_vec">vec</a> form three-dimensional vectors with z equal to zero. The
   1283 cross product is a three-dimensional vector with x and y equal to zero.
   1284 The cross product z term equals the returned value.
   1285 
   1286 ### Parameters
   1287 
   1288 <table>  <tr>    <td><a name="SkPoint_cross_vec"> <code><strong>vec </strong></code> </a></td> <td>
   1289 right side of cross product</td>
   1290   </tr>
   1291 </table>
   1292 
   1293 ### Return Value
   1294 
   1295 area spanned by <a href="#Vector">Vectors</a> signed by angle direction
   1296 
   1297 ### Example
   1298 
   1299 <div><fiddle-embed name="0bc7b3997357e499817278b78bdfbf1d"></fiddle-embed></div>
   1300 
   1301 ### See Also
   1302 
   1303 <a href="#SkPoint_CrossProduct">CrossProduct</a> <a href="#SkPoint_dot">dot</a>
   1304 
   1305 ---
   1306 
   1307 <a name="SkPoint_dot"></a>
   1308 ## dot
   1309 
   1310 <pre style="padding: 1em 1em 1em 1em;width: 62.5em; background-color: #f0f0f0">
   1311 SkScalar dot(const SkVector& vec) const
   1312 </pre>
   1313 
   1314 Returns the dot product of <a href="SkPoint_Reference#Vector">Vector</a> and <a href="SkPoint_Reference#Vector">Vector</a> <a href="#SkPoint_dot_vec">vec</a>.
   1315 
   1316 ### Parameters
   1317 
   1318 <table>  <tr>    <td><a name="SkPoint_dot_vec"> <code><strong>vec </strong></code> </a></td> <td>
   1319 right side of dot product</td>
   1320   </tr>
   1321 </table>
   1322 
   1323 ### Return Value
   1324 
   1325 product of input magnitudes and cosine of the angle between them
   1326 
   1327 ### Example
   1328 
   1329 <div><fiddle-embed name="56d01ccfedd71d3c504b09afa2875d38"></fiddle-embed></div>
   1330 
   1331 ### See Also
   1332 
   1333 <a href="#SkPoint_DotProduct">DotProduct</a> <a href="#SkPoint_cross">cross</a>
   1334 
   1335 ---
   1336 
   1337 # <a name="Vector"></a> Vector
   1338