Skip to content

Commit 3ffe0c7

Browse files
committed
cpp interaction goes both ways
1 parent 6fc9347 commit 3ffe0c7

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/compas/geometry/algorithms/_smoothing_cpp/src/main.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <array>
66
#include <vector>
77

8+
// cd _smoothing_cpp
89
// g++ -shared -fPIC src/main.cpp -o smoothing.so
910

1011
using namespace std;
@@ -22,7 +23,7 @@ void smooth_centroid(int v, int *nbrs, int *fixed, double **vertices, int **neig
2223
double cx, cy, cz;
2324
double c;
2425

25-
vector<vector<double>> xyz(v, vector<double>(3, 0.0));
26+
vector< vector<double> > xyz(v, vector<double>(3, 0.0));
2627

2728

2829
for (k = 0; k < kmax; k++) {

src/compas/geometry/algorithms/smoothing_cpp.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def smooth_centroid_cpp(vertices, adjacency, fixed, kmax=100, callback=None, cal
6060

6161
def wrapper(k):
6262
print(k)
63+
c_vertices.cdata[18][0] = 0.01 * k
6364
callback(c_vertices.pydata)
6465

6566
smooth_centroid.smooth_centroid.argtypes = [
@@ -118,7 +119,7 @@ def wrapper(k):
118119
fixed = list(mesh.vertices_where({'is_fixed': True}))
119120
adjacency = [mesh.vertex_neighbours(key) for key in mesh.vertices()]
120121

121-
v = len(vertices)
122+
print(fixed)
122123

123124
# make a plotter for (dynamic) visualization
124125
# and define a callback function

0 commit comments

Comments
 (0)