| 29 | } |
| 30 | |
| 31 | Node* SquareModule::evaluate(const Context& ctx) const |
| 32 | { |
| 33 | Value* sizeVal=getParameterArgument(ctx,0); |
| 34 | Value* centerVal=getParameterArgument(ctx,1); |
| 35 | bool center=false; |
| 36 | if(centerVal) |
| 37 | center = centerVal->isTrue(); |
| 38 | |
| 39 | decimal x=1.0; |
| 40 | decimal y=1.0; |
| 41 | if(sizeVal) { |
| 42 | VectorValue& size=sizeVal->toVector(2); |
| 43 | Point pt = size.getPoint(); |
| 44 | x=pt.x(); |
| 45 | y=pt.y(); |
| 46 | } |
| 47 | |
| 48 | auto* pn=new PrimitiveNode(); |
| 49 | Primitive* p=pn->createPrimitive(); |
| 50 | pn->setChildren(ctx.getInputNodes()); |
| 51 | |
| 52 | Polygon& pg=p->createPolygon(); |
| 53 | p->createVertex(Point(0, 0, 0)); |
| 54 | p->createVertex(Point(x, 0, 0)); |
| 55 | p->createVertex(Point(x, y, 0)); |
| 56 | p->createVertex(Point(0, y, 0)); |
| 57 | pg.append(0); |
| 58 | pg.append(1); |
| 59 | pg.append(2); |
| 60 | pg.append(3); |
| 61 | |
| 62 | if(center) { |
| 63 | auto* an=new AlignNode(); |
| 64 | an->setCenter(true); |
| 65 | an->addChild(pn); |
| 66 | return an; |
| 67 | } |
| 68 | |
| 69 | return pn; |
| 70 | } |
nothing calls this directly
no test coverage detected