------------------------------------------------------------------------
| 334 | |
| 335 | //------------------------------------------------------------------------ |
| 336 | inline bool trans_perspective::invert() |
| 337 | { |
| 338 | double d0 = sy * w2 - w1 * ty; |
| 339 | double d1 = w0 * ty - shy * w2; |
| 340 | double d2 = shy * w1 - w0 * sy; |
| 341 | double d = sx * d0 + shx * d1 + tx * d2; |
| 342 | if(d == 0.0) |
| 343 | { |
| 344 | sx = shy = w0 = shx = sy = w1 = tx = ty = w2 = 0.0; |
| 345 | return false; |
| 346 | } |
| 347 | d = 1.0 / d; |
| 348 | trans_perspective a = *this; |
| 349 | sx = d * d0; |
| 350 | shy = d * d1; |
| 351 | w0 = d * d2; |
| 352 | shx = d * (a.w1 *a.tx - a.shx*a.w2); |
| 353 | sy = d * (a.sx *a.w2 - a.w0 *a.tx); |
| 354 | w1 = d * (a.w0 *a.shx - a.sx *a.w1); |
| 355 | tx = d * (a.shx*a.ty - a.sy *a.tx); |
| 356 | ty = d * (a.shy*a.tx - a.sx *a.ty); |
| 357 | w2 = d * (a.sx *a.sy - a.shy*a.shx); |
| 358 | return true; |
| 359 | } |
| 360 | |
| 361 | //------------------------------------------------------------------------ |
| 362 | inline bool trans_perspective::quad_to_square(const double* q) |
no outgoing calls
no test coverage detected