|
@@ -130,7 +130,7 @@ function getAngleApex(dotTrio, topIndex) {
|
|
|
|
|
|
const alpha = Math.atan2(crossProd, dotProd);
|
|
|
//return alpha ;
|
|
|
- return Math.floor(alpha * 180. / Math.PI + 0.5) ;
|
|
|
+ return Math.abs(Math.floor(alpha * 180. / Math.PI + 0.5)) ;
|
|
|
}
|
|
|
|
|
|
function getOrientation(dotTrio, topIndex) {
|
|
@@ -228,13 +228,13 @@ app.post('/emitter/json', function (req, res) {
|
|
|
|
|
|
/* Listage de tous les points */
|
|
|
const dots = [];
|
|
|
- touches.forEach(function(touch) {
|
|
|
+ for(const touch of req.body.touches){
|
|
|
dots.push({
|
|
|
- id: req.body.touches[touch].identifier,
|
|
|
- x: req.body.touches[touch].clientX,
|
|
|
- y: req.body.touches[touch].clientY
|
|
|
+ id: touch.identifier,
|
|
|
+ x: touch.clientX,
|
|
|
+ y: touch.clientY
|
|
|
});
|
|
|
- });
|
|
|
+ };
|
|
|
if (config.app.debug && config.app.debugLog.backend.emitter.dots) {
|
|
|
console.log('-- dots --', dots);
|
|
|
}
|
|
@@ -274,7 +274,7 @@ app.post('/emitter/json', function (req, res) {
|
|
|
/* Listage des triangles */
|
|
|
const triangles = [];
|
|
|
/* on boucle sur les segments */
|
|
|
- segments.forEach((segment) => {
|
|
|
+ for(const segment of segments) {
|
|
|
const dot1 = segment.identifiers[0];
|
|
|
const dot2 = segment.identifiers[1];
|
|
|
/* on vérifie que le triangle n'est pas déjà listé */
|
|
@@ -299,7 +299,7 @@ app.post('/emitter/json', function (req, res) {
|
|
|
triangles.push([dot1, dot2, dot3]);
|
|
|
}
|
|
|
}
|
|
|
- });
|
|
|
+ };
|
|
|
if (config.app.debug && config.app.debugLog.backend.emitter.triangles) {
|
|
|
console.log('-- triangles --', triangles);
|
|
|
}
|
|
@@ -309,7 +309,7 @@ app.post('/emitter/json', function (req, res) {
|
|
|
objTriangle = {} ;
|
|
|
|
|
|
/* Définition de l'apex, de la position du centre et de l'orientation */
|
|
|
- triangles.forEach(triangle => {
|
|
|
+ for(const triangle of triangles){
|
|
|
objTriangle.dots = [];
|
|
|
objTriangle.dots[0] = dots[triangle[0]];
|
|
|
objTriangle.dots[1] = dots[triangle[1]];
|
|
@@ -330,7 +330,7 @@ app.post('/emitter/json', function (req, res) {
|
|
|
console.log('centerPos: ' + objTriangle.center);
|
|
|
console.log('orientation: ' + objTriangle.orientation);
|
|
|
}
|
|
|
- });
|
|
|
+ };
|
|
|
|
|
|
|
|
|
//plante vite
|
|
@@ -404,7 +404,7 @@ app.post('/emitter/json', function (req, res) {
|
|
|
const matchingObject = config.objects.find(item => {
|
|
|
return objTriangle.angleApex > item.apexAngle - config.app.matchingTolerance && objTriangle.angleApex < item.apexAngle + config.app.matchingTolerance;
|
|
|
});
|
|
|
- console.log(matchingObject);
|
|
|
+ console.log('matching object ', matchingObject);
|
|
|
currentOscBundle.append([
|
|
|
'/tuio/2Dobj',
|
|
|
'set',
|