|
@@ -317,16 +317,18 @@ app.post('/emitter/json', function (req, res) {
|
|
|
|
|
|
objTriangle.apex = getTop(objTriangle.dots);
|
|
|
objTriangle.center = [
|
|
|
- (objTriangle.dots[0].x+objTriangle.dots[1].x+objTriangle.dots[2].x)/3 ,
|
|
|
- (objTriangle.dots[0].y+objTriangle.dots[1].y+objTriangle.dots[2].y)/3
|
|
|
+ (objTriangle.dots[0].x + objTriangle.dots[1].x + objTriangle.dots[2].x) / 3,
|
|
|
+ (objTriangle.dots[0].y + objTriangle.dots[1].y + objTriangle.dots[2].y) / 3
|
|
|
];
|
|
|
|
|
|
- objTriangle.angleApex = getAngleApex(objTriangle.dots, objTriangle.apex) ;
|
|
|
- objTriangle.orientation = getOrientation(objTriangle.dots, objTriangle.apex) ;
|
|
|
+ objTriangle.angleApex = getAngleApex(objTriangle.dots, objTriangle.apex);
|
|
|
+ objTriangle.orientation = getOrientation(objTriangle.dots, objTriangle.apex);
|
|
|
|
|
|
- if (req.body.debug) {
|
|
|
+ if (config.app.debug && config.app.debugLog.backend.emitter.apex) {
|
|
|
console.log('-- apex --', objTriangle.apex);
|
|
|
- console.log('centerPos : ' + objTriangle.center + ' orientation : ' + objTriangle.orientation);
|
|
|
+ console.log('angle: ', objTriangle.angleApex);
|
|
|
+ console.log('centerPos: ' + objTriangle.center);
|
|
|
+ console.log('orientation: ' + objTriangle.orientation);
|
|
|
}
|
|
|
});
|
|
|
|
|
@@ -398,12 +400,16 @@ app.post('/emitter/json', function (req, res) {
|
|
|
// });
|
|
|
currentOscBundle = new Bundle ;
|
|
|
currentOscBundle.append([ '/tuio/2Dobj', 'alive', 1 ]);
|
|
|
- if (objTriangle.dots != undefined) {
|
|
|
+ if (objTriangle.dots) {
|
|
|
+ const matchingObject = config.objects.find(item => {
|
|
|
+ return objTriangle.angleApex > item.apexAngle - config.app.matchingTolerance && objTriangle.angleApex < item.apexAngle + config.app.matchingTolerance;
|
|
|
+ });
|
|
|
+ console.log(matchingObject);
|
|
|
currentOscBundle.append([
|
|
|
'/tuio/2Dobj',
|
|
|
'set',
|
|
|
1,
|
|
|
- 1,
|
|
|
+ matchingObject ? matchingObject.apexAngle : 1,
|
|
|
objTriangle.center[0],
|
|
|
objTriangle.center[1],
|
|
|
// objTriangle.center[0] / req.body.screenW,
|
|
@@ -416,7 +422,6 @@ app.post('/emitter/json', function (req, res) {
|
|
|
0.0
|
|
|
]);
|
|
|
}
|
|
|
-
|
|
|
currentOscBundle.append(['/tuio/2Dobj', 'fseq', fseq]);
|
|
|
hasPending = true;
|
|
|
res.status(200).send();
|