| 585 | } |
| 586 | |
| 587 | bool MatrixOpData::hasAlpha() const |
| 588 | { |
| 589 | const ArrayDouble & a = getArray(); |
| 590 | const ArrayDouble::Values & m = a.getValues(); |
| 591 | |
| 592 | // Now check the diagonal elements. |
| 593 | |
| 594 | static constexpr double maxDiff = 1e-6; |
| 595 | |
| 596 | return |
| 597 | |
| 598 | // Last column. |
| 599 | (m[3] != 0.0) || // Strict comparison intended |
| 600 | (m[7] != 0.0) || |
| 601 | (m[11] != 0.0) || |
| 602 | |
| 603 | // Diagonal. |
| 604 | !EqualWithAbsError(m[15], 1.0, maxDiff) || |
| 605 | |
| 606 | // Bottom row. |
| 607 | (m[12] != 0.0) || // Strict comparison intended |
| 608 | (m[13] != 0.0) || |
| 609 | (m[14] != 0.0) || |
| 610 | |
| 611 | // Alpha offset |
| 612 | (m_offsets[3] != 0.0); |
| 613 | |
| 614 | } |
| 615 | |
| 616 | MatrixOpDataRcPtr MatrixOpData::CreateDiagonalMatrix(double diagValue) |
| 617 | { |