| 29 | } |
| 30 | |
| 31 | Node* MultMatrixModule::evaluate(const Context& ctx) const |
| 32 | { |
| 33 | auto* matrixVec=dynamic_cast<VectorValue*>(getParameterArgument(ctx,0)); |
| 34 | |
| 35 | auto* n=new TransformationNode(); |
| 36 | n->setChildren(ctx.getInputNodes()); |
| 37 | |
| 38 | if(!matrixVec) |
| 39 | return n; |
| 40 | |
| 41 | auto* matrix=new TransformMatrix(); |
| 42 | |
| 43 | int i=0; |
| 44 | int j=0; |
| 45 | for(Value* rowVal: matrixVec->getElements()) { |
| 46 | auto* row=dynamic_cast<VectorValue*>(rowVal); |
| 47 | if(!row) continue; |
| 48 | j=0; |
| 49 | for(Value* colVal: row->getElements()) { |
| 50 | auto* col=dynamic_cast<NumberValue*>(colVal); |
| 51 | if(!col) continue; |
| 52 | matrix->setValue(i,j,col->getNumber()); |
| 53 | if(++j >= 4) break; |
| 54 | } |
| 55 | if(++i >= 4) break; |
| 56 | } |
| 57 | |
| 58 | n->setMatrix(matrix); |
| 59 | return n; |
| 60 | } |
nothing calls this directly
no test coverage detected