summaryrefslogtreecommitdiff
path: root/src/cgaladv.cc
diff options
context:
space:
mode:
authorMarius Kintel <marius@kintel.net>2011-09-06 12:57:24 (GMT)
committerMarius Kintel <marius@kintel.net>2011-09-06 12:57:24 (GMT)
commit1e4e18c52451d2f04050cb44441b615398882c56 (patch)
tree0fc51c818db83632e983c0720d1e497c83fedb01 /src/cgaladv.cc
parentfdd96a177c0fb3a94d317cb3e584b4881c09ea0e (diff)
minkowski sums should now work again
Diffstat (limited to 'src/cgaladv.cc')
-rw-r--r--src/cgaladv.cc66
1 files changed, 21 insertions, 45 deletions
diff --git a/src/cgaladv.cc b/src/cgaladv.cc
index 6c4c222..8ffd626 100644
--- a/src/cgaladv.cc
+++ b/src/cgaladv.cc
@@ -24,24 +24,16 @@
*
*/
+#include "cgaladvnode.h"
#include "module.h"
-#include "node.h"
#include "context.h"
#include "builtin.h"
#include "printutils.h"
-#include "visitor.h"
#include <sstream>
#include <assert.h>
#include <boost/assign/std/vector.hpp>
using namespace boost::assign; // bring 'operator+=()' into scope
-enum cgaladv_type_e {
- MINKOWSKI,
- GLIDE,
- SUBDIV,
- HULL
-};
-
class CgaladvModule : public AbstractModule
{
public:
@@ -50,42 +42,6 @@ public:
virtual AbstractNode *evaluate(const Context *ctx, const ModuleInstantiation *inst) const;
};
-class CgaladvNode : public AbstractNode
-{
-public:
- CgaladvNode(const ModuleInstantiation *mi, cgaladv_type_e type) : AbstractNode(mi), type(type) {
- convexity = 1;
- }
- virtual ~CgaladvNode() { }
- virtual Response accept(class State &state, Visitor &visitor) const {
- return visitor.visit(state, *this);
- }
- virtual std::string toString() const;
- virtual std::string name() const {
- switch (this->type) {
- case MINKOWSKI:
- return "minkowski";
- break;
- case GLIDE:
- return "glide";
- break;
- case SUBDIV:
- return "subdiv";
- break;
- case HULL:
- return "hull";
- break;
- default:
- assert(false);
- }
- }
-
- Value path;
- std::string subdiv_type;
- int convexity, level;
- cgaladv_type_e type;
-};
-
AbstractNode *CgaladvModule::evaluate(const Context *ctx, const ModuleInstantiation *inst) const
{
CgaladvNode *node = new CgaladvNode(inst, type);
@@ -144,6 +100,26 @@ void register_builtin_cgaladv()
builtin_modules["hull"] = new CgaladvModule(HULL);
}
+std::string CgaladvNode::name() const
+{
+ switch (this->type) {
+ case MINKOWSKI:
+ return "minkowski";
+ break;
+ case GLIDE:
+ return "glide";
+ break;
+ case SUBDIV:
+ return "subdiv";
+ break;
+ case HULL:
+ return "hull";
+ break;
+ default:
+ assert(false);
+ }
+}
+
std::string CgaladvNode::toString() const
{
std::stringstream stream;
contact: Jan Huwald // Impressum