diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CGALEvaluator.cc | 10 | ||||
-rw-r--r-- | src/cgaladv.cc | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/CGALEvaluator.cc b/src/CGALEvaluator.cc index 8e1b5eb..adaec4a 100644 --- a/src/CGALEvaluator.cc +++ b/src/CGALEvaluator.cc @@ -215,20 +215,24 @@ CGAL_Nef_polyhedron CGALEvaluator::applyResize(const CgaladvNode &node) bbox_size.push_back( bb.xmax()-bb.xmin() ); bbox_size.push_back( bb.ymax()-bb.ymin() ); bbox_size.push_back( bb.zmax()-bb.zmin() ); + int newsizemax_index = 0; for (int i=0;i<3;i++) { if (node.newsize[i]) { if (bbox_size[i]==NT3(0)) { - PRINT("WARNING: Cannot resize in direction normal to flat object"); + PRINT("WARNING: Resize in direction normal to flat object is not implemented"); return N; } else { scale[i] = NT3(node.newsize[i]) / bbox_size[i]; } + if ( node.newsize[i] > node.newsize[newsizemax_index] ) + newsizemax_index = i; } } - NT3 autoscale = std::max( scale[0], std::max( scale[1], scale[2] )); + NT3 autoscale = NT3( node.newsize[ newsizemax_index ] ) / bbox_size[ newsizemax_index ]; for (int i=0;i<3;i++) { - if (node.autosize[i]) scale[i] = autoscale; + if (node.autosize[i] && node.newsize[i]==0) + scale[i] = autoscale; } Eigen::Matrix4d t; diff --git a/src/cgaladv.cc b/src/cgaladv.cc index ee3d657..8fd030a 100644 --- a/src/cgaladv.cc +++ b/src/cgaladv.cc @@ -98,7 +98,7 @@ AbstractNode *CgaladvModule::instantiate(const Context *ctx, const ModuleInstant if ( va.size() >= 3 ) node->autosize[2] = va[2].toBool(); } else if ( autosize.type() == Value::BOOL ) { - node->autosize << true, true, true; + node->autosize << autosize.toBool(),autosize.toBool(),autosize.toBool(); } } |