comparison native/Falcon/utils.h @ 5:d66dd5880081

Added support for Falcon Haptic device and Tablet/Mouse as haptic device
author Fiore Martin <fiore@eecs.qmul.ac.uk>
date Tue, 10 Jul 2012 22:39:37 +0100
parents
children
comparison
equal deleted inserted replaced
4:2c67ac862920 5:d66dd5880081
1 /*
2 CCmI Editor - A Collaborative Cross-Modal Diagram Editing Tool
3
4 Copyright (C) 2011 Queen Mary University of London (http://ccmi.eecs.qmul.ac.uk/)
5
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #pragma once
21
22 #include <jni.h>
23 #include <iostream>
24 #include <H3DUtil/Vec3d.h>
25 #include <math.h>
26
27 /* check for Java exception */
28 void checkExceptions(JNIEnv *env, char* what);
29
30 /* exit the program printing a message on the sttandard error */
31 void stopExecution(char* msg);
32
33 /* transforms the coordinates of aPoint from the screen space (the system used in the graphic diagram) *
34 * to the haptic space which is used by the Falcon and goes from about -0.05 to 0.05 on each axis */
35 H3DUtil::ArithmeticTypes::Vec3d & screenToHapticSpace(H3DUtil::ArithmeticTypes::Vec3d & aPoint, int w, int h);
36
37 /* does the inverse of screenToHapticSpace */
38 H3DUtil::ArithmeticTypes::Vec3d & hapticToScreenSpace(H3DUtil::ArithmeticTypes::Vec3d & aPoint, int w, int h);
39
40 /* Calculates the distance between points on a plane whose normal is the Z-axis. This *
41 * means that the z coordinate in not taken into account for the distance calculation */
42 double pointsDistance(const H3DUtil::ArithmeticTypes::Vec3d & p, const H3DUtil::ArithmeticTypes::Vec3d & q);
43
44 /* find the midpoint of a segment foing from start to end. The z coordinate of start and end is not taken into account */
45 H3DUtil::ArithmeticTypes::Vec3d midPoint(const H3DUtil::ArithmeticTypes::Vec3d & start, const H3DUtil::ArithmeticTypes::Vec3d & end);