MCPcopy Create free account
hub / github.com/GilesBathgate/RapCAD / evaluate

Method evaluate

src/module/multmatrixmodule.cpp:31–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31Node* 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}

Callers

nothing calls this directly

Calls 6

getInputNodesMethod · 0.80
getNumberMethod · 0.80
setMatrixMethod · 0.80
setChildrenMethod · 0.45
getElementsMethod · 0.45
setValueMethod · 0.45

Tested by

no test coverage detected