Skip to content

Instantly share code, notes, and snippets.

@sverhoeven
Created October 2, 2020 09:35
Show Gist options
  • Save sverhoeven/d7db19d299bd14ecaa9bc2d20b6029b0 to your computer and use it in GitHub Desktop.
Save sverhoeven/d7db19d299bd14ecaa9bc2d20b6029b0 to your computer and use it in GitHub Desktop.
run-cpp-on-web: vega
#include <emscripten/bind.h>
#include "newtonraphson.hpp"
using namespace emscripten;
EMSCRIPTEN_BINDINGS(newtonraphson) {
class_<NewtonRaphson>("NewtonRaphson")
.constructor<float>()
.function("solve", &NewtonRaphson::solve)
.property("iterations", &NewtonRaphson::iterations)
;
value_object<Iteration>("Iteration")
.field("index", &Iteration::index)
.field("x", &Iteration::x)
.field("y", &Iteration::y)
.field("slope", &Iteration::slope)
.field("delta_x", &Iteration::delta_x)
;
register_vector<Iteration>("vector<Iteration>");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment