|
@@ -90,9 +90,15 @@ function getTop(dotTrio) {
|
|
|
const diff01m12 = Math.abs(dist01 - dist12);
|
|
|
const diff02m12 = Math.abs(dist02 - dist12);
|
|
|
|
|
|
- if (diff01m02 < diff02m12 && diff01m02 < diff01m12) {return 0;}
|
|
|
- else if (diff01m12<diff01m02 && diff01m12<diff02m12) {return 1;}
|
|
|
- else if (diff02m12<diff01m02 && diff02m12<diff01m12) {return 2;}
|
|
|
+ if (diff01m02 < diff02m12 && diff01m02 < diff01m12) {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ else if (diff01m12 < diff01m02 && diff01m12 < diff02m12) {
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ else if (diff02m12 < diff01m02 && diff02m12 < diff01m12) {
|
|
|
+ return 2;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
function getAngleApex(dotTrio, topIndex) {
|
|
@@ -113,8 +119,8 @@ function getAngleApex(dotTrio, topIndex) {
|
|
|
dotC = dotTrio[1];
|
|
|
}
|
|
|
|
|
|
- const AB = [dotB.x - dotA.x, dotB.y - dotA.y] ;
|
|
|
- const CB = [dotB.x - dotC.x, dotB.y - dotC.y] ;
|
|
|
+ const AB = [dotB.x - dotA.x, dotB.y - dotA.y];
|
|
|
+ const CB = [dotB.x - dotC.x, dotB.y - dotC.y];
|
|
|
|
|
|
const dotProd = (AB[0] * CB[0] + AB[1] * CB[1]);
|
|
|
const crossProd = (AB[0] * CB[1] - AB[1] * CB[0]);
|
|
@@ -396,34 +402,32 @@ app.post('/emitter/json', function (req, res) {
|
|
|
// });
|
|
|
oscBundle = new Bundle ;
|
|
|
oscBundle.append([ '/tuio/2Dobj', 'alive', 1 ]);
|
|
|
- if (objTriangle.dots != undefined){
|
|
|
+ if (objTriangle.dots != undefined) {
|
|
|
oscBundle.append([
|
|
|
- '/tuio/2Dobj',
|
|
|
- 'set',
|
|
|
- 1,
|
|
|
- 1,
|
|
|
- objTriangle.center[0],
|
|
|
- objTriangle.center[1],
|
|
|
- objTriangle.orientation,
|
|
|
- 0.0,
|
|
|
- 0.0,
|
|
|
- 0.0,
|
|
|
- 0.0,
|
|
|
- 0.0
|
|
|
- ]);
|
|
|
- }
|
|
|
- oscBundle.append([ '/tuio/2Dobj', 'fseq', fseq ]);
|
|
|
- emitterOscClient.send(oscBundle, () => {
|
|
|
- res.status(200).send();
|
|
|
- });
|
|
|
- } else {
|
|
|
- res.status(400).send();
|
|
|
+ '/tuio/2Dobj',
|
|
|
+ 'set',
|
|
|
+ 1,
|
|
|
+ 1,
|
|
|
+ objTriangle.center[0],
|
|
|
+ objTriangle.center[1],
|
|
|
+ objTriangle.orientation,
|
|
|
+ 0.0,
|
|
|
+ 0.0,
|
|
|
+ 0.0,
|
|
|
+ 0.0,
|
|
|
+ 0.0
|
|
|
+ ]);
|
|
|
}
|
|
|
+ oscBundle.append([ '/tuio/2Dobj', 'fseq', fseq ]);
|
|
|
+ emitterOscClient.send(oscBundle, () => {
|
|
|
+ res.status(200).send();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ res.status(400).send();
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
|
|
|
-
|
|
|
-
|
|
|
httpServer.listen(config.app.httpPort, function () {
|
|
|
- console.log(`Votre app est disponible sur localhost:${config.app.httpPort} !`)
|
|
|
+ console.log(`Votre app est disponible sur http://localhost:${config.app.httpPort} !`)
|
|
|
});
|