diff options
author | don bright <hugh.m.bright@gmail.com> | 2013-03-10 02:28:43 (GMT) |
---|---|---|
committer | don bright <hugh.m.bright@gmail.com> | 2013-03-10 02:28:43 (GMT) |
commit | 3cf6c24d834295eb9f409cece0b9aec8f2296fa2 (patch) | |
tree | 7e8eb6c567b5fdcbbf8cee532b7858adc9b4f08d /src/cgaladv.cc | |
parent | 1221b66edb06e1b4f009b0ce3ebee1fb1651aa4e (diff) |
beginning of resize() command implementation.
Diffstat (limited to 'src/cgaladv.cc')
-rw-r--r-- | src/cgaladv.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/cgaladv.cc b/src/cgaladv.cc index 1773a90..073a908 100644 --- a/src/cgaladv.cc +++ b/src/cgaladv.cc @@ -58,6 +58,9 @@ AbstractNode *CgaladvModule::evaluate(const Context *ctx, const ModuleInstantiat if (type == SUBDIV) argnames += "type", "level", "convexity"; + if (type == RESIZE) + argnames += "newsize"; + Context c(ctx); c.args(argnames, argexpr, inst->argnames, inst->argvalues); @@ -78,6 +81,17 @@ AbstractNode *CgaladvModule::evaluate(const Context *ctx, const ModuleInstantiat level = c.lookup_variable("level", true); } + if (type == RESIZE) { + Value ns = c.lookup_variable("newsize"); + node->newsize << 0,0,0; + if ( ns.type() == Value::VECTOR ) { + Value::VectorType v = ns.toVector(); + if ( v.size() >= 1 ) node->newsize[0] = v[0].toDouble(); + if ( v.size() >= 2 ) node->newsize[1] = v[1].toDouble(); + if ( v.size() >= 3 ) node->newsize[2] = v[2].toDouble(); + } + } + node->convexity = (int)convexity.toDouble(); node->path = path; node->subdiv_type = subdiv_type.toString(); @@ -112,6 +126,9 @@ std::string CgaladvNode::name() const case HULL: return "hull"; break; + case RESIZE: + return "resize"; + break; default: assert(false); } @@ -135,6 +152,9 @@ std::string CgaladvNode::toString() const case HULL: stream << "()"; break; + case RESIZE: + stream << "(newsize = " << this->newsize << ")"; + break; default: assert(false); } @@ -148,4 +168,5 @@ void register_builtin_cgaladv() Builtins::init("glide", new CgaladvModule(GLIDE)); Builtins::init("subdiv", new CgaladvModule(SUBDIV)); Builtins::init("hull", new CgaladvModule(HULL)); + Builtins::init("resize", new CgaladvModule(RESIZE)); } |