Skip to content
This repository has been archived by the owner on Jul 29, 2020. It is now read-only.

Commit

Permalink
motion progress
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcastillo committed Jun 3, 2016
1 parent ed260da commit d96fbab
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
1 change: 0 additions & 1 deletion src/app/motion/motion.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<section class="motion" [ngClass]="{ 'loading': !model }">
<h2>Motion</h2>
<pre>{{ rotation | json }}</pre>
<article id="brainbrowser"></article>
</section>
10 changes: 4 additions & 6 deletions src/app/motion/motion.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export class MotionComponent implements OnInit {
this.rotation = data.data;

if (this.model) {
console.log(this.model);
this.model.rotation.set(...this.rotation);
this.viewer.resetView();
this.viewer.model.rotation.set(...this.rotation);
}
});
}
Expand All @@ -42,12 +42,10 @@ export class MotionComponent implements OnInit {
this.viewer.render();
this.viewer.setWireframe(true);
this.viewer.loadModelFromURL('app/motion/models/brain-surface.obj');

this.viewer.setClearColor(0x333333);

this.viewer.addEventListener('displaymodel', (data) => {
this.model = data.model;
this.model.rotation.set(...this.rotation);
this.viewer.updated = true;
this.viewer.updateViewport();
});
});
}
Expand Down
10 changes: 7 additions & 3 deletions src/server/providers/motion.provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,19 @@ module.exports = class Motion {
this.simulate();
} else {
if (this.hasMotion(auxData)) {
this.auxData = auxData;
this.auxData = this.amplify(auxData);
this.emit();
}
}

}

hasMotion () {
return auxData.reduce((a, b) => a + b, 0)
hasMotion (auxData) {
return auxData.reduce((a, b) => a + b, 0);
}

amplify (auxData) {
return auxData.map(axis => Math.round(axis));
}

simulate () {
Expand Down
2 changes: 1 addition & 1 deletion src/server/providers/signal.provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ module.exports = class Signal {
}

add (sample) {
//console.log('sample', sample);
console.log('sample', sample);
Object.keys(sample.channelData).forEach((channel, i) => {
this.signals[i].push(sample.channelData[channel]);
});
Expand Down

0 comments on commit d96fbab

Please sign in to comment.