Skip to content

Commit

Permalink
done! fix centroid
Browse files Browse the repository at this point in the history
  • Loading branch information
dnanto committed Aug 8, 2024
1 parent fd3fd62 commit d8b39c1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion js/democapsid.js
Original file line number Diff line number Diff line change
Expand Up @@ -824,10 +824,16 @@ function draw_capsid(PARAMS) {
.map((f) => mmul(M, f.T()).flat())
.map((e) => spherize(e, ico_coors, PARAMS.s, PARAMS.c))
.map((e) => mmul(CAMERA, e.concat(1).T()).flat());
const centroid = mmul(
CAMERA,
spherize(mmul(M, [e.data.centroid.x, e.data.centroid.y, 1].T()).flat(), ico_coors, PARAMS.s, PARAMS.c)
.concat(1)
.T()
).flat();
return new Path({
segments: segments.map((f) => f.slice(0, 2)),
data: Object.assign({}, e.data, {
centroid: segments.centroid(),
centroid: centroid,
normal: segments[1].sub(segments[0]).cross(segments[2].sub(segments[0])).uvec(),
M: M,
}),
Expand Down

0 comments on commit d8b39c1

Please sign in to comment.