Skip to content

Instantly share code, notes, and snippets.

View cohnt's full-sized avatar

Thomas Cohn cohnt

View GitHub Profile
import numpy as np
# Single point cloud case
point_cloud = np.random.rand(6,3) # 6 3D points
flattened = point_cloud.reshape(point_cloud.shape[0],-1) # One point in R^18
unflattened = flattened.reshape(-1,3) # 6 3D points
# Check that they're identical
print point_cloud

Correct include_dirs in setup.py to be whichever folder contains all of the ROS libraries. For example, [your_include_dir]/ros/ros.h should be the main ros library for C++.

Run python2 setup.py build_ext --inplace to build the program

Run python2 to enter a python environment, and type import node to start it off.

You will probably see an error message that looks something like ImportError: /file/path/to/node.so: undefined symbol: [some mangled symbol name].

function dist(x, y) {
return Math.sqrt(Math.pow(y[0]-x[0], 2)+Math.pow(y[1]-x[1], 2));
}
function ln(x) {
return Math.log(x);
}
function abs(x) {
return Math.abs(x);
}
function disth(p, q) {
@cohnt
cohnt / test.html
Last active January 30, 2018 04:58
HTML/Javascript Swarm Animation
<!DOCTYPE html>
<html>
<head>
<style>
canvas {
border: 1px dotted black;
}
</style>
</head>
<body>