OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "../../include/fxcrt/fx_basic.h" | 7 #include "../../include/fxcrt/fx_basic.h" |
8 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 8 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
9 #include <sys/types.h> | 9 #include <sys/types.h> |
10 #include <dirent.h> | 10 #include <dirent.h> |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 #else | 450 #else |
451 return '/'; | 451 return '/'; |
452 #endif | 452 #endif |
453 } | 453 } |
454 | 454 |
455 CFX_Matrix_3by3 CFX_Matrix_3by3::Inverse() | 455 CFX_Matrix_3by3 CFX_Matrix_3by3::Inverse() |
456 { | 456 { |
457 FX_FLOAT det = a*(e*i - f*h) - b*(i*d - f*g) + c*(d*h - e*g); | 457 FX_FLOAT det = a*(e*i - f*h) - b*(i*d - f*g) + c*(d*h - e*g); |
458 if (FXSYS_fabs(det) < 0.0000001) | 458 if (FXSYS_fabs(det) < 0.0000001) |
459 return CFX_Matrix_3by3(); | 459 return CFX_Matrix_3by3(); |
460 else | 460 |
461 return CFX_Matrix_3by3( | 461 return CFX_Matrix_3by3( |
462 (e*i - f*h) / det, | 462 (e*i - f*h) / det, |
463 -(b*i - c*h) / det, | 463 -(b*i - c*h) / det, |
464 (b*f - c*e) / det, | 464 (b*f - c*e) / det, |
465 -(d*i - f*g) / det, | 465 -(d*i - f*g) / det, |
466 (a*i - c*g) / det, | 466 (a*i - c*g) / det, |
467 -(a*f - c*d) / det, | 467 -(a*f - c*d) / det, |
468 (d*h - e*g) / det, | 468 (d*h - e*g) / det, |
469 -(a*h - b*g) / det, | 469 -(a*h - b*g) / det, |
470 (a*e - b*d) / det | 470 (a*e - b*d) / det |
471 ); | 471 ); |
472 } | 472 } |
473 | 473 |
474 CFX_Matrix_3by3 CFX_Matrix_3by3::Multiply(const CFX_Matrix_3by3 &m) | 474 CFX_Matrix_3by3 CFX_Matrix_3by3::Multiply(const CFX_Matrix_3by3 &m) |
475 { | 475 { |
476 return CFX_Matrix_3by3( | 476 return CFX_Matrix_3by3( |
477 a*m.a + b*m.d + c*m.g, | 477 a*m.a + b*m.d + c*m.g, |
478 a*m.b + b*m.e + c*m.h, | 478 a*m.b + b*m.e + c*m.h, |
479 a*m.c + b*m.f + c*m.i, | 479 a*m.c + b*m.f + c*m.i, |
480 d*m.a + e*m.d + f*m.g, | 480 d*m.a + e*m.d + f*m.g, |
481 d*m.b + e*m.e + f*m.h, | 481 d*m.b + e*m.e + f*m.h, |
482 d*m.c + e*m.f + f*m.i, | 482 d*m.c + e*m.f + f*m.i, |
483 g*m.a + h*m.d + i*m.g, | 483 g*m.a + h*m.d + i*m.g, |
484 g*m.b + h*m.e + i*m.h, | 484 g*m.b + h*m.e + i*m.h, |
485 g*m.c + h*m.f + i*m.i | 485 g*m.c + h*m.f + i*m.i |
486 ); | 486 ); |
487 } | 487 } |
488 | 488 |
489 CFX_Vector_3by1 CFX_Matrix_3by3::TransformVector(const CFX_Vector_3by1 &v) | 489 CFX_Vector_3by1 CFX_Matrix_3by3::TransformVector(const CFX_Vector_3by1 &v) |
490 { | 490 { |
491 return CFX_Vector_3by1( | 491 return CFX_Vector_3by1( |
492 a * v.a + b * v.b + c * v.c, | 492 a * v.a + b * v.b + c * v.c, |
493 d * v.a + e * v.b + f * v.c, | 493 d * v.a + e * v.b + f * v.c, |
494 g * v.a + h * v.b + i * v.c | 494 g * v.a + h * v.b + i * v.c |
495 ); | 495 ); |
496 } | 496 } |
OLD | NEW |