| 30 | } |
| 31 | |
| 32 | Node* DatumModule::evaluate(const Context& ctx) const |
| 33 | { |
| 34 | auto* xVal=dynamic_cast<NumberValue*>(ctx.getArgument(0,"x")); |
| 35 | auto* yVal=dynamic_cast<NumberValue*>(ctx.getArgument(0,"y")); |
| 36 | auto* zVal=dynamic_cast<NumberValue*>(ctx.getArgument(0,"z")); |
| 37 | |
| 38 | auto* n=new TransformationNode(); |
| 39 | n->setChildren(ctx.getInputNodes()); |
| 40 | |
| 41 | if(!xVal&&!yVal&&!zVal) |
| 42 | return n; |
| 43 | |
| 44 | decimal x=0.0; |
| 45 | if(xVal) { |
| 46 | x=xVal->getNumber(); |
| 47 | n->setDatumAxis(TransformationNode::Axis::X); |
| 48 | } |
| 49 | |
| 50 | decimal y=0.0; |
| 51 | if(yVal) { |
| 52 | y=yVal->getNumber(); |
| 53 | n->setDatumAxis(TransformationNode::Axis::Y); |
| 54 | } |
| 55 | |
| 56 | decimal z=0.0; |
| 57 | if(zVal) { |
| 58 | z=zVal->getNumber(); |
| 59 | n->setDatumAxis(TransformationNode::Axis::Z); |
| 60 | } |
| 61 | |
| 62 | auto* m = new TransformMatrix( |
| 63 | 1.0,0.0,0.0,x, |
| 64 | 0.0,1.0,0.0,y, |
| 65 | 0.0,0.0,1.0,z, |
| 66 | 0.0,0.0,0.0,1.0 |
| 67 | ); |
| 68 | m->setType(TransformType::Translation); |
| 69 | |
| 70 | n->setMatrix(m); |
| 71 | return n; |
| 72 | } |
nothing calls this directly
no test coverage detected