vrpn
07.33
Virtual Reality Peripheral Network
|
Go to the documentation of this file.
9 #if defined(linux) || defined(__sparc) || defined(hpux) || defined(__GNUC__)
25 if (a == -1) return -1
29 static void vector_cross (
const vrpn_float64 a [3],
const vrpn_float64 b [3],
32 c[0] = a[1] * b[2] - a[2] * b[1];
33 c[1] = a[2] * b[0] - a[0] * b[2];
34 c[2] = a[0] * b[1] - a[1] * b[0];
39 static void rotate_vector (
const vrpn_float64 v [3],
const vrpn_float64 T [9],
40 vrpn_float64 vprime [3]) {
41 vprime[0] = v[0] * T[0] + v[1] * T[3] + v[2] * T[6];
42 vprime[1] = v[0] * T[1] + v[1] * T[4] + v[2] * T[7];
43 vprime[2] = v[0] * T[2] + v[1] * T[5] + v[2] * T[8];
46 static vrpn_float64 vector_dot (
const vrpn_float64 a [3],
47 const vrpn_float64 b [3]) {
48 return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
113 "vrpn_ForceDevice addObjectExScene");
117 "vrpn_ForceDevice setObjectPosition");
119 "vrpn_ForceDevice setObjectOrientation");
133 "vrpn_ForceDevice updateTrimeshChanges");
135 "vrpn_ForceDevice transformTrimesh");
151 "vrpn_ForceDevice setObjectIsTouchable");
158 "vrpn_ForceDevice constraint_enable");
162 "vrpn_ForceDevice constraint_point");
164 "vrpn_ForceDevice constraint_linept");
166 "vrpn_ForceDevice constraint_linedir");
170 "vrpn_ForceDevice constraint_plnorm");
172 "vrpn_ForceDevice constraint_KSpring");
198 printf(
"Timestamp:%ld:%ld\n",
timestamp.tv_sec,
205 const vrpn_float64 *force)
215 length = 3 *
sizeof(vrpn_float64);
218 buf =
new char[length];
222 for (i = 0; i < 3; i++) {
231 const vrpn_int32 len,
235 const char *mptr = buffer;
237 if (len != (3 *
sizeof(vrpn_float64))) {
238 fprintf(stderr,
"vrpn_ForceDevice: force message payload error\n");
239 fprintf(stderr,
" (got %d, expected %lud)\n", len,
240 static_cast<unsigned long>(3 *
sizeof(vrpn_float64)));
244 for (i = 0; i < 3; i++)
252 vrpn_uint32 effectId,
253 const vrpn_float32 *params,
254 vrpn_uint32 nbParams)
260 len =
sizeof(vrpn_uint32) * 2 + nbParams *
sizeof(vrpn_float32);
269 for (
unsigned int i = 0; i < nbParams; i++) {
278 const vrpn_int32 len,
279 vrpn_uint32 *effectId,
280 vrpn_float32 **params,
281 vrpn_uint32 *nbParams)
283 const char *mptr = buffer;
287 if (
static_cast<size_t>(len) < (
sizeof(vrpn_uint32) * 2)) {
289 "vrpn_ForceDevice: custom effect message payload error\n");
290 fprintf(stderr,
" (got %d, expected at least %lud)\n", len,
291 static_cast<unsigned long>(2 *
sizeof(vrpn_uint32)));
298 if ((vrpn_uint32)(len) <
299 (2 *
sizeof(vrpn_uint32) + (*nbParams) *
sizeof(vrpn_float32))) {
301 "vrpn_ForceDevice: custom effect message payload error\n");
302 fprintf(stderr,
" (got %d, expected at least %lud)\n", len,
303 static_cast<unsigned long>(2 *
sizeof(vrpn_uint32) +
304 (*nbParams) *
sizeof(vrpn_float32)));
308 if (*params != NULL)
delete[] * params;
309 *params =
new vrpn_float32[(*nbParams)];
311 for (vrpn_uint32 i = 0; i < (*nbParams); i++) {
321 const vrpn_float64 *quat)
328 length = 7 *
sizeof(vrpn_float64);
331 buf =
new char[length];
334 for (i = 0; i < 3; i++) {
337 for (i = 0; i < 4; i++) {
346 const vrpn_int32 len, vrpn_float64 *pos,
350 const char *mptr = buffer;
351 int desiredLen = 7 *
sizeof(vrpn_float64);
353 if (len != desiredLen) {
354 fprintf(stderr,
"vrpn_ForceDevice: scp message payload error\n");
355 fprintf(stderr,
" (got %d, expected %d)\n", len,
360 for (i = 0; i < 3; i++)
362 for (i = 0; i < 4; i++)
370 vrpn_int32 &len,
const vrpn_float32 *plane,
const vrpn_float32 kspring,
371 const vrpn_float32 kdamp,
const vrpn_float32 fdyn,
const vrpn_float32 fstat,
372 const vrpn_int32 plane_index,
const vrpn_int32 n_rec_cycles)
381 len = 8 *
sizeof(vrpn_float32) + 2 *
sizeof(vrpn_int32);
387 for (i = 0; i < 4; i++) {
403 const char *buffer,
const vrpn_int32 len, vrpn_float32 *plane,
404 vrpn_float32 *kspring, vrpn_float32 *kdamp, vrpn_float32 *fdyn,
405 vrpn_float32 *fstat, vrpn_int32 *plane_index, vrpn_int32 *n_rec_cycles)
408 const char *mptr = buffer;
410 if (len != 8 *
sizeof(vrpn_float32) + 2 *
sizeof(vrpn_int32)) {
411 fprintf(stderr,
"vrpn_ForceDevice: plane message payload error\n");
412 fprintf(stderr,
" (got %d, expected %lud)\n", len,
413 static_cast<unsigned long>(8 *
sizeof(vrpn_float32) +
414 2 *
sizeof(vrpn_int32)));
418 for (i = 0; i < 4; i++)
432 vrpn_int32 &len,
const vrpn_float32 k_adhesion_normal,
433 const vrpn_float32 k_adhesion_lateral,
const vrpn_float32 tex_amp,
434 const vrpn_float32 tex_wl,
const vrpn_float32 buzz_amp,
435 const vrpn_float32 buzz_freq)
442 len = 6 *
sizeof(vrpn_float32);
460 const char *buffer,
const vrpn_int32 len, vrpn_float32 *k_adhesion_normal,
461 vrpn_float32 *k_adhesion_lateral, vrpn_float32 *tex_amp,
462 vrpn_float32 *tex_wl, vrpn_float32 *buzz_amp, vrpn_float32 *buzz_freq)
465 const char *mptr = buffer;
467 if (len != 6 *
sizeof(vrpn_float32)) {
468 fprintf(stderr,
"vrpn_ForceDevice: surface effects message payload ");
469 fprintf(stderr,
"error\n (got %d, expected %lud)\n", len,
470 static_cast<unsigned long>(6 *
sizeof(vrpn_float32)));
486 const vrpn_int32 vertNum,
487 const vrpn_float32 x,
488 const vrpn_float32 y,
489 const vrpn_float32 z)
496 len =
sizeof(objNum) +
sizeof(vertNum) + 3 *
sizeof(vrpn_float32);
513 const vrpn_int32 len,
515 vrpn_int32 *vertNum, vrpn_float32 *x,
516 vrpn_float32 *y, vrpn_float32 *z)
518 const char *mptr = buffer;
520 if (len != (
sizeof(objNum) +
sizeof(vertNum) + 3 *
sizeof(vrpn_float32))) {
521 fprintf(stderr,
"vrpn_ForceDevice: vertex message payload error\n");
522 fprintf(stderr,
" (got %d, expected %lud)\n", len,
523 static_cast<unsigned long>(
sizeof(objNum) +
sizeof(vertNum) +
524 3 *
sizeof(vrpn_float32)));
539 const vrpn_int32 normNum,
540 const vrpn_float32 x,
541 const vrpn_float32 y,
542 const vrpn_float32 z)
549 len =
sizeof(vrpn_int32) +
sizeof(vrpn_int32) + 3 *
sizeof(vrpn_float32);
565 const vrpn_int32 len,
567 vrpn_int32 *vertNum, vrpn_float32 *x,
568 vrpn_float32 *y, vrpn_float32 *z)
571 const char *mptr = buffer;
574 (
sizeof(vrpn_int32) +
sizeof(vrpn_int32) + 3 *
sizeof(vrpn_float32))) {
575 fprintf(stderr,
"vrpn_ForceDevice: normal message payload error\n");
576 fprintf(stderr,
" (got %d, expected %lud)\n", len,
577 static_cast<unsigned long>(
sizeof(vrpn_int32) +
579 3 *
sizeof(vrpn_float32)));
594 vrpn_int32 &len,
const vrpn_int32 objNum,
const vrpn_int32 triNum,
595 const vrpn_int32 vert0,
const vrpn_int32 vert1,
const vrpn_int32 vert2,
596 const vrpn_int32 norm0,
const vrpn_int32 norm1,
const vrpn_int32 norm2)
602 len =
sizeof(vrpn_int32) + 7 *
sizeof(vrpn_int32);
622 const char *buffer,
const vrpn_int32 len, vrpn_int32 *objNum,
623 vrpn_int32 *triNum, vrpn_int32 *vert0, vrpn_int32 *vert1, vrpn_int32 *vert2,
624 vrpn_int32 *norm0, vrpn_int32 *norm1, vrpn_int32 *norm2)
626 const char *mptr = buffer;
628 if (len != (
sizeof(vrpn_int32) + 7 *
sizeof(vrpn_int32))) {
629 fprintf(stderr,
"vrpn_ForceDevice: triangle message payload error\n");
630 fprintf(stderr,
" (got %d, expected %lud)\n", len,
631 static_cast<unsigned long>(
sizeof(vrpn_int32) +
632 7 *
sizeof(vrpn_int32)));
650 const vrpn_int32 objNum,
651 const vrpn_int32 triNum)
658 len =
sizeof(vrpn_int32) +
sizeof(vrpn_int32);
672 const vrpn_int32 len,
676 const char *mptr = buffer;
678 if (len != (
sizeof(vrpn_int32) +
sizeof(vrpn_int32))) {
679 fprintf(stderr,
"vrpn_ForceDevice: remove triangle message payload");
680 fprintf(stderr,
" error\n (got %d, expected %lud)\n", len,
681 static_cast<unsigned long>(
sizeof(vrpn_int32) +
682 sizeof(vrpn_int32)));
695 vrpn_int32 &len,
const vrpn_int32 objNum,
const vrpn_float32 kspring,
696 const vrpn_float32 kdamp,
const vrpn_float32 fstat,
const vrpn_float32 fdyn)
703 len =
sizeof(vrpn_int32) + 4 *
sizeof(vrpn_float32);
720 const char *buffer,
const vrpn_int32 len, vrpn_int32 *objNum,
721 vrpn_float32 *kspring, vrpn_float32 *kdamp, vrpn_float32 *fstat,
725 const char *mptr = buffer;
727 if (len != (
sizeof(vrpn_int32) + 4 *
sizeof(vrpn_float32))) {
728 fprintf(stderr,
"vrpn_ForceDevice: update trimesh message payload");
729 fprintf(stderr,
" error\n (got %d, expected %lud)\n", len,
730 static_cast<unsigned long>(
sizeof(vrpn_int32) +
731 4 *
sizeof(vrpn_float32)));
746 const vrpn_int32 objNum,
747 const vrpn_int32 type)
754 len =
sizeof(vrpn_int32) +
sizeof(vrpn_int32);
768 const vrpn_int32 len,
773 const char *mptr = buffer;
775 if (len != (
sizeof(vrpn_int32) +
sizeof(vrpn_int32))) {
776 fprintf(stderr,
"vrpn_ForceDevice: trimesh type message payload");
777 fprintf(stderr,
" error\n (got %d, expected %lud)\n", len,
778 static_cast<unsigned long>(
sizeof(vrpn_int32) +
779 sizeof(vrpn_int32)));
791 vrpn_int32 &len,
const vrpn_int32 objNum,
const vrpn_float32 homMatrix[16])
798 len =
sizeof(vrpn_int32) + 16 *
sizeof(vrpn_float32);
805 for (i = 0; i < 16; i++)
813 const vrpn_int32 len,
815 vrpn_float32 homMatrix[16])
818 const char *mptr = buffer;
820 if (len != (
sizeof(vrpn_int32) + 16 *
sizeof(vrpn_float32))) {
821 fprintf(stderr,
"vrpn_ForceDevice: trimesh transform message payload ");
822 fprintf(stderr,
"error\n (got %d, expected %lud)\n", len,
823 static_cast<unsigned long>(
sizeof(vrpn_int32) +
824 16 *
sizeof(vrpn_float32)));
829 for (i = 0; i < 16; i++)
836 const vrpn_int32 objNum,
837 const vrpn_int32 ParentNum)
843 len = 2 *
sizeof(vrpn_int32);
858 vrpn_int32 *ParentNum)
860 const char *mptr = buffer;
862 if (len != 2 *
sizeof(vrpn_int32)) {
863 fprintf(stderr,
"vrpn_ForceDevice: add object message payload ");
864 fprintf(stderr,
"error\n (got %d, expected %lud)\n", len,
865 static_cast<unsigned long>(2 *
sizeof(vrpn_int32)));
876 const vrpn_int32 objNum)
882 len =
sizeof(objNum);
897 const char *mptr = buffer;
899 if (len !=
sizeof(vrpn_int32)) {
900 fprintf(stderr,
"vrpn_ForceDevice: add object message payload ");
901 fprintf(stderr,
"error\n (got %d, expected %lud)\n", len,
902 static_cast<unsigned long>(
sizeof(vrpn_int32)));
912 const vrpn_int32 objNum,
913 const vrpn_float32 Pos[3])
919 len =
sizeof(vrpn_int32) + 3 *
sizeof(vrpn_float32);
938 const char *mptr = buffer;
940 if (len != (
sizeof(vrpn_int32) + 3 *
sizeof(vrpn_float32))) {
941 fprintf(stderr,
"vrpn_ForceDevice: object position message payload ");
942 fprintf(stderr,
"error\n (got %d, expected %lud)\n", len,
943 static_cast<unsigned long>(
sizeof(vrpn_int32) +
944 3 *
sizeof(vrpn_float32)));
957 const vrpn_int32 objNum,
958 const vrpn_float32 axis[3],
959 const vrpn_float32 angle)
965 len =
sizeof(vrpn_int32) + 4 *
sizeof(vrpn_float32);
983 vrpn_float32 axis[3],
986 const char *mptr = buffer;
988 if (len != (
sizeof(vrpn_int32) + 4 *
sizeof(vrpn_float32))) {
990 "vrpn_ForceDevice: object orientation message payload ");
991 fprintf(stderr,
"error\n (got %d, expected %lud)\n", len,
992 static_cast<unsigned long>(
sizeof(vrpn_int32) +
993 4 *
sizeof(vrpn_float32)));
1007 const vrpn_int32 objNum,
1008 const vrpn_float32 Scale[3])
1014 len =
sizeof(vrpn_int32) + 3 *
sizeof(vrpn_float32);
1017 buf =
new char[len];
1031 vrpn_float32 Scale[3])
1033 const char *mptr = buffer;
1035 if (len != (
sizeof(vrpn_int32) + 3 *
sizeof(vrpn_float32))) {
1036 fprintf(stderr,
"vrpn_ForceDevice: object scale message payload ");
1037 fprintf(stderr,
"error\n (got %d, expected %lud)\n", len,
1038 static_cast<unsigned long>(
sizeof(vrpn_int32) +
1039 3 *
sizeof(vrpn_float32)));
1052 const vrpn_int32 objNum)
1058 len =
sizeof(vrpn_int32);
1061 buf =
new char[len];
1073 const char *mptr = buffer;
1075 if (len !=
sizeof(vrpn_int32)) {
1076 fprintf(stderr,
"vrpn_ForceDevice: remove object message payload ");
1077 fprintf(stderr,
"error\n (got %d, expected %lud)\n", len,
1078 static_cast<unsigned long>(
sizeof(vrpn_int32)));
1088 const vrpn_int32 objNum)
1094 len =
sizeof(vrpn_int32);
1097 buf =
new char[len];
1109 const char *mptr = buffer;
1111 if (len !=
sizeof(vrpn_int32)) {
1112 fprintf(stderr,
"vrpn_ForceDevice: clear TriMesh message payload ");
1113 fprintf(stderr,
"error\n (got %d, expected %lud)\n", len,
1114 static_cast<unsigned long>(
sizeof(vrpn_int32)));
1124 const vrpn_int32 objNum,
1125 const vrpn_int32 parentNum)
1131 len =
sizeof(vrpn_int32) +
sizeof(vrpn_int32);
1134 buf =
new char[len];
1146 vrpn_int32 *parentNum)
1148 const char *mptr = buffer;
1150 if (len != (
sizeof(vrpn_int32) +
sizeof(vrpn_int32))) {
1152 "vrpn_ForceDevice: move object to parent message payload ");
1153 fprintf(stderr,
"error\n (got %d, expected %lud)\n", len,
1154 static_cast<unsigned long>(
sizeof(vrpn_int32) +
1155 sizeof(vrpn_int32)));
1166 const vrpn_float32 Pos[3],
1167 const vrpn_float32 axis[3],
1168 const vrpn_float32 angle)
1175 len = 7 *
sizeof(vrpn_float32);
1178 buf =
new char[len];
1181 for (i = 0; i < 3; i++)
1184 for (i = 0; i < 3; i++)
1194 vrpn_float32 Pos[3],
1195 vrpn_float32 axis[3],
1196 vrpn_float32 *angle)
1199 const char *mptr = buffer;
1201 if (len != 7 *
sizeof(vrpn_int32)) {
1203 "vrpn_ForceDevice: sethapticorigin message payload error\n");
1204 fprintf(stderr,
" (got %d, expected %lud)\n", len,
1205 static_cast<unsigned long>(7 *
sizeof(vrpn_int32)));
1209 for (i = 0; i < 3; i++)
1212 for (i = 0; i < 3; i++)
1220 const vrpn_float32 scale)
1226 len =
sizeof(vrpn_float32);
1229 buf =
new char[len];
1239 vrpn_float32 *scale)
1241 const char *mptr = buffer;
1243 if (len !=
sizeof(vrpn_float32)) {
1245 "vrpn_ForceDevice: sethapticscale message payload error\n");
1246 fprintf(stderr,
" (got %d, expected %lud)\n", len,
1247 static_cast<unsigned long>(7 *
sizeof(vrpn_float32)));
1257 const vrpn_float32 Pos[3],
1258 const vrpn_float32 axis[3],
1259 const vrpn_float32 angle)
1266 len = 7 *
sizeof(vrpn_float32);
1269 buf =
new char[len];
1272 for (i = 0; i < 3; i++)
1275 for (i = 0; i < 3; i++)
1285 vrpn_float32 Pos[3],
1286 vrpn_float32 axis[3],
1287 vrpn_float32 *angle)
1290 const char *mptr = buffer;
1292 if (len != 7 *
sizeof(vrpn_int32)) {
1294 "vrpn_ForceDevice: setsceneorigin message payload error\n");
1295 fprintf(stderr,
" (got %d, expected %lud)\n", len,
1296 static_cast<unsigned long>(7 *
sizeof(vrpn_int32)));
1300 for (i = 0; i < 3; i++)
1303 for (i = 0; i < 3; i++)
1312 const vrpn_int32 objNum,
1313 const vrpn_bool IsTouchable)
1319 len =
sizeof(vrpn_int32) +
sizeof(vrpn_bool);
1322 buf =
new char[len];
1334 vrpn_bool *IsTouchable)
1336 const char *mptr = buffer;
1338 if (len != (
sizeof(vrpn_int32) +
sizeof(vrpn_bool))) {
1339 fprintf(stderr,
"vrpn_ForceDevice: set object is touchable message "
1342 stderr,
" (got %d, expected %lud)\n", len,
1343 static_cast<unsigned long>(
sizeof(vrpn_int32) +
sizeof(vrpn_bool)));
1355 const vrpn_float32 origin[3],
1356 const vrpn_float32 force[3],
1357 const vrpn_float32 jacobian[3][3],
1358 const vrpn_float32 radius)
1365 len = 16 *
sizeof(vrpn_float32);
1368 buf =
new char[len];
1371 for (i = 0; i < 3; i++)
1374 for (i = 0; i < 3; i++)
1377 for (i = 0; i < 3; i++)
1378 for (j = 0; j < 3; j++)
1388 const char *buffer,
const vrpn_int32 len, vrpn_float32 origin[3],
1389 vrpn_float32 force[3], vrpn_float32 jacobian[3][3], vrpn_float32 *radius)
1392 const char *mptr = buffer;
1394 if (len != 16 *
sizeof(vrpn_float32)) {
1396 "vrpn_ForceDevice: force field message payload error\n");
1397 fprintf(stderr,
" (got %d, expected %lud)\n", len,
1398 static_cast<unsigned long>(16 *
sizeof(vrpn_float32)));
1402 for (i = 0; i < 3; i++)
1405 for (i = 0; i < 3; i++)
1408 for (i = 0; i < 3; i++)
1409 for (j = 0; j < 3; j++)
1418 const vrpn_int32 error_code)
1425 len =
sizeof(vrpn_int32);
1428 buf =
new char[len];
1437 const vrpn_int32 len,
1438 vrpn_int32 *error_code)
1441 const char *mptr = buffer;
1443 if (len !=
sizeof(vrpn_int32)) {
1444 fprintf(stderr,
"vrpn_ForceDevice: error message payload error\n");
1445 fprintf(stderr,
" (got %d, expected %lud)\n", len,
1446 static_cast<unsigned long>(
sizeof(vrpn_int32)));
1457 for (
int i = 0; i < 4; i++) {
1473 for (
int i = 0; i < 3; i++) {
1474 plane[i] = normal[i];
1484 struct timeval current_time;
1488 timestamp.tv_usec = current_time.tv_usec;
1495 fprintf(stderr,
"Phantom: cannot write message: tossing\n");
1511 len =
sizeof(vrpn_int32);
1514 buf =
new char[len];
1524 const vrpn_int32 len,
1527 const char *mptr = buffer;
1529 if (len !=
sizeof(vrpn_int32)) {
1530 fprintf(stderr,
"vrpn_ForceDevice: "
1531 "enable constraint message payload error\n"
1532 " (got %d, expected %lud)\n",
1533 len,
static_cast<unsigned long>(
sizeof(vrpn_int32)));
1551 len =
sizeof(vrpn_int32);
1554 buf =
new char[len];
1571 fprintf(stderr,
"vrpn_ForceDevice: "
1572 "Unknown or illegal constraint mode.\n");
1584 const vrpn_int32 len,
1587 const char *mptr = buffer;
1590 if (len !=
sizeof(vrpn_int32)) {
1591 fprintf(stderr,
"vrpn_ForceDevice: "
1592 "constraint mode payload error\n"
1593 " (got %d, expected %lud)\n",
1594 len,
static_cast<unsigned long>(
sizeof(vrpn_int32)));
1614 fprintf(stderr,
"vrpn_ForceDevice: "
1615 "Unknown or illegal constraint mode.\n");
1634 const vrpn_int32 len,
1653 const vrpn_int32 len,
1672 const char *buffer,
const vrpn_int32 len, vrpn_float32 *x, vrpn_float32 *y,
1689 const char *buffer,
const vrpn_int32 len, vrpn_float32 *x, vrpn_float32 *y,
1706 const char *buffer,
const vrpn_int32 len, vrpn_float32 *x, vrpn_float32 *y,
1720 len =
sizeof(vrpn_float32);
1723 buf =
new char[len];
1733 const vrpn_int32 len,
1736 const char *mptr = buffer;
1738 if (len !=
sizeof(vrpn_float32)) {
1739 fprintf(stderr,
"vrpn_ForceDevice: "
1740 "set constraint spring message payload error\n"
1741 " (got %d, expected %lud)\n",
1742 len,
static_cast<unsigned long>(
sizeof(vrpn_float32)));
1757 vrpn_float32 y, vrpn_float32 z)
1763 len = 3 *
sizeof(vrpn_float32);
1766 buf =
new char[len];
1778 const vrpn_int32 len, vrpn_float32 *x,
1779 vrpn_float32 *y, vrpn_float32 *z)
1781 const char *mptr = buffer;
1783 if (len != 3 *
sizeof(vrpn_float32)) {
1784 fprintf(stderr,
"vrpn_ForceDevice: "
1785 "decode point message payload error\n"
1786 " (got size %d, expected %lud)\n",
1787 len,
static_cast<unsigned long>(3 *
sizeof(vrpn_float32)));
1804 , d_conMode(POINT_CONSTRAINT)
1810 fprintf(stderr,
"vrpn_ForceDevice_Remote: No connection\n");
1817 fprintf(stderr,
"vrpn_ForceDevice_Remote:can't register handler\n");
1824 fprintf(stderr,
"vrpn_ForceDevice_Remote:can't register handler\n");
1831 fprintf(stderr,
"vrpn_ForceDevice_Remote:can't register handler\n");
1846 struct timeval current_time;
1850 timestamp.tv_usec = current_time.tv_usec;
1859 fprintf(stderr,
"Phantom: cannot write message: tossing\n");
1870 fprintf(stderr,
"Phantom: cannot write message: tossing\n");
1880 struct timeval current_time;
1884 timestamp.tv_usec = current_time.tv_usec;
1893 fprintf(stderr,
"Phantom: cannot write message: tossing\n");
1903 struct timeval current_time;
1907 timestamp.tv_usec = current_time.tv_usec;
1918 fprintf(stderr,
"Phantom: cannot write message: tossing\n");
1925 vrpn_float32 y, vrpn_float32 z)
1931 vrpn_float32 y, vrpn_float32 z)
1937 vrpn_int32 vert1, vrpn_int32 vert2,
1938 vrpn_int32 norm0, vrpn_int32 norm1,
1968 vrpn_int32 ParentNum )
1972 struct timeval current_time;
1978 timestamp.tv_usec = current_time.tv_usec;
1985 fprintf(stderr,
"Phantom: cannot write message: tossing\n");
1996 struct timeval current_time;
2002 timestamp.tv_usec = current_time.tv_usec;
2009 fprintf(stderr,
"Phantom: cannot write message: tossing\n");
2018 vrpn_float32 x, vrpn_float32 y,
2023 struct timeval current_time;
2027 timestamp.tv_usec = current_time.tv_usec;
2034 fprintf(stderr,
"Phantom: cannot write message: tossing\n");
2044 vrpn_float32 x, vrpn_float32 y,
2049 struct timeval current_time;
2053 timestamp.tv_usec = current_time.tv_usec;
2060 fprintf(stderr,
"Phantom: cannot write message: tossing\n");
2067 vrpn_int32 objNum, vrpn_int32 triNum, vrpn_int32 vert0, vrpn_int32 vert1,
2068 vrpn_int32 vert2, vrpn_int32 norm0 , vrpn_int32 norm1 ,
2073 struct timeval current_time;
2077 timestamp.tv_usec = current_time.tv_usec;
2081 norm0, norm1, norm2);
2085 fprintf(stderr,
"Phantom: cannot write message: tossing\n");
2096 struct timeval current_time;
2100 timestamp.tv_usec = current_time.tv_usec;
2107 fprintf(stderr,
"Phantom: cannot write message: tossing\n");
2119 struct timeval current_time;
2123 timestamp.tv_usec = current_time.tv_usec;
2132 fprintf(stderr,
"Phantom: cannot write message: tossing\n");
2140 vrpn_int32 objNum, vrpn_float32 homMatrix[16])
2144 struct timeval current_time;
2148 timestamp.tv_usec = current_time.tv_usec;
2155 fprintf(stderr,
"Phantom: cannot write message: tossing\n");
2163 vrpn_float32 Pos[3])
2167 struct timeval current_time;
2171 timestamp.tv_usec = current_time.tv_usec;
2178 fprintf(stderr,
"Phantom: cannot write message: tossing\n");
2186 vrpn_float32 axis[3],
2191 struct timeval current_time;
2195 timestamp.tv_usec = current_time.tv_usec;
2202 fprintf(stderr,
"Phantom: cannot write message: tossing\n");
2210 vrpn_float32 Scale[3])
2214 struct timeval current_time;
2218 timestamp.tv_usec = current_time.tv_usec;
2225 fprintf(stderr,
"Phantom: cannot write message: tossing\n");
2236 struct timeval current_time;
2240 timestamp.tv_usec = current_time.tv_usec;
2247 fprintf(stderr,
"Phantom: cannot write message: tossing\n");
2255 char *msgbuf = NULL;
2257 struct timeval current_time;
2261 timestamp.tv_usec = current_time.tv_usec;
2268 fprintf(stderr,
"Phantom: cannot write message: tossing\n");
2278 vrpn_int32 ParentNum)
2282 struct timeval current_time;
2286 timestamp.tv_usec = current_time.tv_usec;
2293 fprintf(stderr,
"Phantom: cannot write message: tossing\n");
2301 vrpn_float32 axis[3],
2306 struct timeval current_time;
2310 timestamp.tv_usec = current_time.tv_usec;
2317 fprintf(stderr,
"Phantom: cannot write message: tossing\n");
2328 struct timeval current_time;
2332 timestamp.tv_usec = current_time.tv_usec;
2339 fprintf(stderr,
"Phantom: cannot write message: tossing\n");
2346 vrpn_float32 axis[3],
2351 struct timeval current_time;
2355 timestamp.tv_usec = current_time.tv_usec;
2362 fprintf(stderr,
"Phantom: cannot write message: tossing\n");
2377 vrpn_int32 objNum, vrpn_bool IsTouchable )
2381 struct timeval current_time;
2385 timestamp.tv_usec = current_time.tv_usec;
2392 fprintf(stderr,
"Phantom: cannot write message: tossing\n");
2403 struct timeval current_time;
2407 timestamp.tv_usec = current_time.tv_usec;
2414 fprintf(stderr,
"Phantom: cannot write message: tossing\n");
2424 struct timeval current_time;
2428 timestamp.tv_usec = current_time.tv_usec;
2435 fprintf(stderr,
"Phantom: cannot write message: tossing\n");
2446 struct timeval current_time;
2450 timestamp.tv_usec = current_time.tv_usec;
2458 fprintf(stderr,
"Phantom: cannot write message: tossing\n");
2468 struct timeval current_time;
2472 timestamp.tv_usec = current_time.tv_usec;
2482 fprintf(stderr,
"Phantom: cannot write message: tossing\n");
2493 #ifndef FD_SPRINGS_AS_FIELDS
2537 fprintf(stderr,
"vrpn_ForceDevice_Remote::enableConstraint: "
2538 "Illegal value of enable (%d).\n",
2576 vrpn_float32 direction[3])
2618 #endif // FD_SPRINGS_AS_FIELDS
2626 vrpn_float32 force[3],
2627 vrpn_float32 jacobian[3][3],
2628 vrpn_float32 radius)
2632 struct timeval current_time;
2636 timestamp.tv_usec = current_time.tv_usec;
2643 fprintf(stderr,
"Phantom: cannot write message: tossing\n");
2652 vrpn_float32 origin[3] = {0, 0, 0};
2653 vrpn_float32 force[3] = {0, 0, 0};
2654 vrpn_float32 jacobian[3][3] = {{0, 0, 0}, {0, 0, 0}, {0, 0, 0}};
2655 vrpn_float32 radius = 0;
2659 struct timeval current_time;
2663 timestamp.tv_usec = current_time.tv_usec;
2670 fprintf(stderr,
"Phantom: cannot write message: tossing\n");
2714 vrpn_FORCEERRORCB tp;
2717 fprintf(stderr,
"vrpn_ForceDevice: error message payload"
2718 " error\n(got %d, expected %lud)\n",
2719 p.
payload_len,
static_cast<unsigned long>(
sizeof(vrpn_int32)));
2741 "vrpn_ForceDevice_Remote::send: Can't pack message.\n");
2746 delete[](
char *)msgbuf;
2749 #ifdef FD_SPRINGS_AS_FIELDS
2761 const float largeRadius = 100.0f;
2808 q_vec_type norm_line_dir;
2809 vrpn_float64 norm_len =
2813 if (norm_len == 0) {
2816 for (i = 0; i < 3; i++) {
2822 q_vec_type z_dir = {0, 0, 1};
2824 q_matrix_type forward;
2826 q_matrix_type reverse;
2827 q_from_two_vecs(q_forward, norm_line_dir, z_dir);
2828 q_to_row_matrix(forward, q_forward);
2829 q_invert(q_reverse, q_forward);
2830 q_to_row_matrix(reverse, q_reverse);
2835 q_matrix_type diagonal, temp, jacobian;
2836 for (i = 0; i < 4; i++) {
2837 for (j = 0; j < 4; j++) {
2838 if ((i == j) && (i < 2)) {
2842 diagonal[i][j] = 0.0;
2846 q_matrix_mult(temp, diagonal, forward);
2847 q_matrix_mult(jacobian, reverse, temp);
2851 for (i = 0; i < 3; i++) {
2852 for (j = 0; j < 3; j++) {
2853 c[i + j * 3] = (vrpn_float32)jacobian[i][j];
2857 setFF_Jacobian(c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8]);
2867 vrpn_float64 norm_plane_dir[3];
2868 vrpn_float64 norm_len =
2872 if (norm_len == 0) {
2875 for (i = 0; i < 3; i++) {
2883 for (i = 0; i < 3; i++)
2884 for (j = 0; j < 3; j++)
2885 c[i + j * 3] = (vrpn_float32)(
2886 -
d_conKSpring * norm_plane_dir[i] * norm_plane_dir[j]);
2888 setFF_Jacobian(c[0], c[1], c[2], c[3], c[4], c[5], c[6], c[7], c[8]);
2895 #endif // FD_SPRINGS_AS_FIELDS
vrpn_int32 setNormal_message_id
static char * encode_scp(vrpn_int32 &length, const vrpn_float64 *pos, const vrpn_float64 *quat)
static vrpn_int32 decode_setConstraintLinePoint(const char *buffer, const vrpn_int32 len, vrpn_float32 *x, vrpn_float32 *y, vrpn_float32 *z)
static char * encode_enableConstraint(vrpn_int32 &len, vrpn_int32 enable)
int register_autodeleted_handler(vrpn_int32 type, vrpn_MESSAGEHANDLER handler, void *userdata, vrpn_int32 sender=vrpn_ANY_SENDER)
Registers a handler with the connection, and remembers to delete at destruction.
virtual int pack_message(vrpn_uint32 len, struct timeval time, vrpn_int32 type, vrpn_int32 sender, const char *buffer, vrpn_uint32 class_of_service)
Pack a message that will be sent the next time mainloop() is called. Turn off the RELIABLE flag if yo...
static char * encode_removeTriangle(vrpn_int32 &len, const vrpn_int32 objNum, const vrpn_int32 triNum)
static vrpn_int32 decode_removeObject(const char *buffer, vrpn_int32 len, vrpn_int32 *objNum)
void client_mainloop(void)
Handles functions that all clients should provide in their mainloop() (warning of no server,...
void setVertex(vrpn_int32 vertNum, vrpn_float32 x, vrpn_float32 y, vrpn_float32 z)
functions for a single object
vrpn_int32 clearTrimesh_message_id
vrpn_float32 SurfaceFstatic
vrpn_int32 setConstraintMode_message_id
static char * encode_setConstraintMode(vrpn_int32 &len, ConstraintGeometry mode)
static char * encode_removeObject(vrpn_int32 &len, const vrpn_int32 objNum)
vrpn_int32 setObjectPosition_message_id
void setTriangle(vrpn_int32 triNum, vrpn_int32 vert0, vrpn_int32 vert1, vrpn_int32 vert2, vrpn_int32 norm0=-1, vrpn_int32 norm1=-1, vrpn_int32 norm2=-1)
vrpn_float32 ff_jacobian[3][3]
void setConstraintPoint(vrpn_float32 point[3])
virtual ~vrpn_ForceDevice(void)
static char * encode_setConstraintPlanePoint(vrpn_int32 &len, vrpn_float32 x, vrpn_float32 y, vrpn_float32 z)
void setConstraintKSpring(vrpn_float32 k)
ConstraintGeometry d_conMode
void setTrimeshTransform(vrpn_float32 homMatrix[16])
void removeObjectTriangle(vrpn_int32 objNum, vrpn_int32 triNum)
vrpn_float32 SurfaceFdynamic
vrpn_int32 setConstraintPoint_message_id
vrpn_Callback_List< vrpn_FORCESCPCB > d_scp_change_list
void updateObjectTrimeshChanges(vrpn_int32 objNum)
vrpn_int32 transformTrimesh_message_id
vrpn_float32 SurfaceTextureAmplitude
static char * encode_setSceneOrigin(vrpn_int32 &len, const vrpn_float32 Pos[3], const vrpn_float32 axis[3], const vrpn_float32 angle)
static vrpn_int32 decode_setConstraintPlaneNormal(const char *buffer, const vrpn_int32 len, vrpn_float32 *x, vrpn_float32 *y, vrpn_float32 *z)
void setFF_Radius(vrpn_float32 r)
static char * encode_plane(vrpn_int32 &length, const vrpn_float32 *plane, const vrpn_float32 kspring, const vrpn_float32 kdamp, const vrpn_float32 fdyn, const vrpn_float32 fstat, const vrpn_int32 plane_index, const vrpn_int32 n_rec_cycles)
static char * encode_forcefield(vrpn_int32 &len, const vrpn_float32 origin[3], const vrpn_float32 force[3], const vrpn_float32 jacobian[3][3], const vrpn_float32 radius)
static char * encode_setConstraintPlaneNormal(vrpn_int32 &len, vrpn_float32 x, vrpn_float32 y, vrpn_float32 z)
static vrpn_int32 decode_setConstraintPoint(const char *buffer, const vrpn_int32 len, vrpn_float32 *x, vrpn_float32 *y, vrpn_float32 *z)
static char * encode_setHapticScale(vrpn_int32 &len, const vrpn_float32 Scale)
vrpn_int32 setConstraintLinePoint_message_id
void setHapticOrigin(vrpn_float32 Pos[3], vrpn_float32 axis[3], vrpn_float32 angle)
static vrpn_int32 decode_setObjectIsTouchable(const char *buffer, vrpn_int32 len, vrpn_int32 *objNum, vrpn_bool *isTouchable)
void set_plane(vrpn_float32 *p)
static char * encode_setConstraintPoint(vrpn_int32 &len, vrpn_float32 x, vrpn_float32 y, vrpn_float32 z)
static vrpn_int32 decode_removeTriangle(const char *buffer, const vrpn_int32 len, vrpn_int32 *objNum, vrpn_int32 *triNum)
void sendError(int error_code)
void setConstraintLineDirection(vrpn_float32 direction[3])
vrpn_int32 addObjectExScene_message_id
static char * encode_objectPosition(vrpn_int32 &len, const vrpn_int32 objNum, const vrpn_float32 Pos[3])
static char * encode_moveToParent(vrpn_int32 &len, const vrpn_int32 objNum, const vrpn_int32 parentNum)
vrpn_float32 SurfaceKadhesionLateral
vrpn_int32 setHapticScale_message_id
static vrpn_int32 decode_normal(const char *buffer, const vrpn_int32 len, vrpn_int32 *objNum, vrpn_int32 *vertNum, vrpn_float32 *x, vrpn_float32 *y, vrpn_float32 *z)
static vrpn_int32 decode_addObjectExScene(const char *buffer, vrpn_int32 len, vrpn_int32 *objNum)
static vrpn_int32 decode_scp(const char *buffer, const vrpn_int32 len, vrpn_float64 *pos, vrpn_float64 *quat)
vrpn_float64 d_conPlaneNormal[3]
void constraintToForceField(void)
void setNormal(vrpn_int32 normNum, vrpn_float32 x, vrpn_float32 y, vrpn_float32 z)
static vrpn_int32 decode_setHapticScale(const char *buffer, vrpn_int32 len, vrpn_float32 *Scale)
void send(const char *msgbuf, vrpn_int32 len, vrpn_int32 type)
void setObjectIsTouchable(vrpn_int32 objNum, vrpn_bool IsTouchable=true)
void updateTrimeshChanges()
static vrpn_int32 decode_enableConstraint(const char *buffer, const vrpn_int32 len, vrpn_int32 *enable)
const vrpn_uint32 vrpn_CONNECTION_LOW_LATENCY
VRPN_API int vrpn_unbuffer(const char **buffer, timeval *t)
Utility routine for taking a struct timeval from a buffer that was sent as a message.
static char * encode_addObjectExScene(vrpn_int32 &len, const vrpn_int32 objNum)
vrpn_float32 SurfaceBuzzAmp
void addObjectExScene(vrpn_int32 objNum)
vrpn_int32 setVertex_message_id
vrpn_Connection * d_connection
Connection that this object talks to.
static vrpn_int32 decode_setTrimeshType(const char *buffer, const vrpn_int32 len, vrpn_int32 *objNum, vrpn_int32 *type)
virtual vrpn_int32 register_message_type(const char *name)
void removeObject(vrpn_int32 objNum)
void stopForceField(void)
virtual ~vrpn_ForceDevice_Remote(void)
static char * encode_setConstraintLinePoint(vrpn_int32 &len, vrpn_float32 x, vrpn_float32 y, vrpn_float32 z)
static char * encode_objectScale(vrpn_int32 &len, const vrpn_int32 objNum, const vrpn_float32 Scale[3])
static vrpn_int32 decodePoint(const char *buffer, const vrpn_int32 len, vrpn_float32 *x, vrpn_float32 *y, vrpn_float32 *z)
static int VRPN_CALLBACK handle_force_change_message(void *userdata, vrpn_HANDLERPARAM p)
void setFF_Force(vrpn_float32 fx, vrpn_float32 fy, vrpn_float32 fz)
vrpn_int32 setTrimeshType_message_id
const vrpn_uint32 vrpn_CONNECTION_RELIABLE
Classes of service for messages, specify multiple by ORing them together Priority of satisfying these...
void setObjectNormal(vrpn_int32 objNum, vrpn_int32 normNum, vrpn_float32 x, vrpn_float32 y, vrpn_float32 z)
This structure is what is passed to a vrpn_Connection message callback.
vrpn_int32 setConstraintKSpring_message_id
void setObjectOrientation(vrpn_int32 objNum, vrpn_float32 axis[3], vrpn_float32 angle)
void setConstraintPlaneNormal(vrpn_float32 normal[3])
vrpn_int32 setConstraintLineDirection_message_id
virtual void mainloop()
Called once through each main loop iteration to handle updates. Remote object mainloop() should call ...
vrpn_float32 d_conLinePoint[3]
static vrpn_int32 decode_triangle(const char *buffer, const vrpn_int32 len, vrpn_int32 *objNum, vrpn_int32 *triNum, vrpn_int32 *vert0, vrpn_int32 *vert1, vrpn_int32 *vert2, vrpn_int32 *norm0, vrpn_int32 *norm1, vrpn_int32 *norm2)
vrpn_int32 setHapticOrigin_message_id
void setFF_Jacobian(vrpn_float32 dfxdx, vrpn_float32 dfxdy, vrpn_float32 dfxdz, vrpn_float32 dfydx, vrpn_float32 dfydy, vrpn_float32 dfydz, vrpn_float32 dfzdx, vrpn_float32 dfzdy, vrpn_float32 dfzdz)
void setConstraintMode(ConstraintGeometry mode)
vrpn_int32 d_sender_id
Sender ID registered with the connection.
static char * encode_vertex(vrpn_int32 &len, const vrpn_int32 objNum, const vrpn_int32 vertNum, const vrpn_float32 x, const vrpn_float32 y, const vrpn_float32 z)
vrpn_Callback_List< vrpn_FORCECB > d_change_list
static vrpn_int32 decode_plane(const char *buffer, const vrpn_int32 len, vrpn_float32 *plane, vrpn_float32 *kspring, vrpn_float32 *kdamp, vrpn_float32 *fdyn, vrpn_float32 *fstat, vrpn_int32 *plane_index, vrpn_int32 *n_rec_cycles)
void clearObjectTrimesh(vrpn_int32 objNum)
static char * encodePoint(vrpn_int32 &len, vrpn_float32 x, vrpn_float32 y, vrpn_float32 z)
vrpn_int32 setConstraintPlaneNormal_message_id
vrpn_int32 forcefield_message_id
static vrpn_int32 decode_setConstraintMode(const char *buffer, const vrpn_int32 len, ConstraintGeometry *mode)
vrpn_int32 addObject_message_id
vrpn_int32 error_message_id
static char * encode_clearTrimesh(vrpn_int32 &len, const vrpn_int32 objNum)
static int VRPN_CALLBACK handle_scp_change_message(void *userdata, vrpn_HANDLERPARAM p)
vrpn_float32 d_conKSpring
void setHapticScale(vrpn_float32 Scale)
static char * encode_setHapticOrigin(vrpn_int32 &len, const vrpn_float32 Pos[3], const vrpn_float32 axis[3], const vrpn_float32 angle)
virtual int mainloop(const struct timeval *timeout=NULL)=0
Call each time through program main loop to handle receiving any incoming messages and sending any pa...
void setObjectScale(vrpn_int32 objNum, vrpn_float32 Scale[3])
static vrpn_int32 decode_forcefield(const char *buffer, const vrpn_int32 len, vrpn_float32 origin[3], vrpn_float32 force[3], vrpn_float32 jacobian[3][3], vrpn_float32 *radius)
vrpn_int32 enableConstraint_message_id
Generic connection class not specific to the transport mechanism.
void setObjectVertex(vrpn_int32 objNum, vrpn_int32 vertNum, vrpn_float32 x, vrpn_float32 y, vrpn_float32 z)
vrpn_int32 removeTriangle_message_id
vrpn_Callback_List< vrpn_FORCEERRORCB > d_error_change_list
void removeTriangle(vrpn_int32 triNum)
vrpn_float32 * customEffectParams
vrpn_float32 SurfaceTextureWavelength
static vrpn_int32 decode_updateTrimeshChanges(const char *buffer, const vrpn_int32 len, vrpn_int32 *objNum, vrpn_float32 *kspring, vrpn_float32 *kdamp, vrpn_float32 *fdyn, vrpn_float32 *fstat)
vrpn_float32 SurfaceKadhesionNormal
#define vrpn_gettimeofday
static char * encode_updateTrimeshChanges(vrpn_int32 &len, const vrpn_int32 objNum, const vrpn_float32 kspring, const vrpn_float32 kdamp, const vrpn_float32 fdyn, const vrpn_float32 fstat)
static vrpn_int32 decode_error(const char *buffer, const vrpn_int32 len, vrpn_int32 *error_code)
static char * encode_setObjectIsTouchable(vrpn_int32 &len, const vrpn_int32 objNum, const vrpn_bool isTouchable)
static vrpn_int32 decode_trimeshTransform(const char *buffer, const vrpn_int32 len, vrpn_int32 *objNum, vrpn_float32 homMatrix[16])
virtual int register_types(void)
Register the types of messages this device sends/receives. Return 0 on success, -1 on fail.
vrpn_int32 updateTrimeshChanges_message_id
static char * encode_normal(vrpn_int32 &len, const vrpn_int32 objNum, const vrpn_int32 vertNum, const vrpn_float32 x, const vrpn_float32 y, const vrpn_float32 z)
void moveToParent(vrpn_int32 objNum, vrpn_int32 ParentNum)
Functions to organize the scene.
static char * encode_triangle(vrpn_int32 &len, const vrpn_int32 objNum, const vrpn_int32 triNum, const vrpn_int32 vert0, const vrpn_int32 vert1, const vrpn_int32 vert2, const vrpn_int32 norm0, const vrpn_int32 norm1, const vrpn_int32 norm2)
vrpn_float32 d_conPoint[3]
static char * encode_custom_effect(vrpn_int32 &len, vrpn_uint32 effectId, const vrpn_float32 *params, vrpn_uint32 nbParams)
static vrpn_int32 decode_setHapticOrigin(const char *buffer, vrpn_int32 len, vrpn_float32 Pos[3], vrpn_float32 axis[3], vrpn_float32 *angle)
void setObjectTrimeshTransform(vrpn_int32 objNum, vrpn_float32 homMatrix[16])
void sendForceField(void)
vrpn_int32 custom_effect_message_id
void setObjectPosition(vrpn_int32 objNum, vrpn_float32 Pos[3])
vrpn_float32 ff_origin[3]
static char * encode_force(vrpn_int32 &length, const vrpn_float64 *force)
vrpn_int32 setObjectOrientation_message_id
static vrpn_int32 decode_custom_effect(const char *buffer, const vrpn_int32 len, vrpn_uint32 *effectId, vrpn_float32 **params, vrpn_uint32 *nbParams)
static vrpn_int32 decode_moveToParent(const char *buffer, vrpn_int32 len, vrpn_int32 *objNum, vrpn_int32 *parentNum)
static vrpn_int32 decode_objectPosition(const char *buffer, vrpn_int32 len, vrpn_int32 *objNum, vrpn_float32 Pos[3])
static char * encode_trimeshTransform(vrpn_int32 &len, const vrpn_int32 objNum, const vrpn_float32 homMatrix[16])
static char * encode_error(vrpn_int32 &len, const vrpn_int32 error_code)
static char * encode_setConstraintKSpring(vrpn_int32 &len, vrpn_float32 k)
vrpn_int32 setObjectScale_message_id
static vrpn_int32 decode_setConstraintLineDirection(const char *buffer, const vrpn_int32 len, vrpn_float32 *x, vrpn_float32 *y, vrpn_float32 *z)
vrpn_ForceDevice(const char *name, vrpn_Connection *c)
void setCustomEffect(vrpn_int32 effectId, vrpn_float32 *params=NULL, vrpn_uint32 nbParams=0)
void setConstraintPlanePoint(vrpn_float32 point[3])
vrpn_int32 setTriangle_message_id
vrpn_int32 setSceneOrigin_message_id
vrpn_int32 plane_message_id
static vrpn_int32 decode_setConstraintPlanePoint(const char *buffer, const vrpn_int32 len, vrpn_float32 *x, vrpn_float32 *y, vrpn_float32 *z)
void enableConstraint(vrpn_int32 enable)
vrpn_int32 setConstraintPlanePoint_message_id
vrpn_float32 SurfaceKdamping
virtual int init(void)
Initialize things that the constructor can't. Returns 0 on success, -1 on failure.
static vrpn_int32 decode_setConstraintKSpring(const char *buffer, const vrpn_int32 len, vrpn_float32 *k)
static char * encode_addObject(vrpn_int32 &len, const vrpn_int32 objNum, const vrpn_int32 ParentNum)
VRPN_API int vrpn_buffer(char **insertPt, vrpn_int32 *buflen, const timeval t)
Utility routine for placing a timeval struct into a buffer that is to be sent as a message.
static char * encode_setTrimeshType(vrpn_int32 &len, const vrpn_int32 objNum, const vrpn_int32 type)
static vrpn_int32 decode_clearTrimesh(const char *buffer, vrpn_int32 len, vrpn_int32 *objNum)
vrpn_int32 setObjectIsTouchable_message_id
void setFF_Origin(vrpn_float32 x, vrpn_float32 y, vrpn_float32 z)
vrpn_float64 d_conLineDirection[3]
vrpn_uint32 nbCustomEffectParams
static vrpn_int32 decode_setSceneOrigin(const char *buffer, vrpn_int32 len, vrpn_float32 Pos[3], vrpn_float32 axis[3], vrpn_float32 *angle)
static vrpn_int32 decode_addObject(const char *buffer, vrpn_int32 len, vrpn_int32 *objNum, vrpn_int32 *ParentNum)
vrpn_int32 getNewObjectID_message_id
vrpn_int32 moveToParent_message_id
vrpn_float32 SurfaceKspring
void call_handlers(const CALLBACK_STRUCT &info)
This will pass the referenced parameter as a const to all the callbacks.
vrpn_float32 SurfaceBuzzFreq
static char * encode_objectOrientation(vrpn_int32 &len, const vrpn_int32 objNum, const vrpn_float32 axis[3], const vrpn_float32 angle)
static char * encode_surface_effects(vrpn_int32 &len, const vrpn_float32 k_adhesion_norm, const vrpn_float32 k_adhesion_lat, const vrpn_float32 tex_amp, const vrpn_float32 tex_wl, const vrpn_float32 buzz_amp, const vrpn_float32 buzz_freq)
void setConstraintLinePoint(vrpn_float32 point[3])
vrpn_int32 m_NextAvailableObjectID
static vrpn_int32 decode_objectScale(const char *buffer, vrpn_int32 len, vrpn_int32 *objNum, vrpn_float32 Scale[3])
vrpn_int32 removeObject_message_id
void setObjectTriangle(vrpn_int32 objNum, vrpn_int32 triNum, vrpn_int32 vert0, vrpn_int32 vert1, vrpn_int32 vert2, vrpn_int32 norm0=-1, vrpn_int32 norm1=-1, vrpn_int32 norm2=-1)
static vrpn_int32 decode_force(const char *buffer, const vrpn_int32 len, vrpn_float64 *force)
vrpn_int32 plane_effects_message_id
vrpn_int32 getNewObjectID()
vrpn_int32 force_message_id
static vrpn_int32 decode_vertex(const char *buffer, const vrpn_int32 len, vrpn_int32 *objNum, vrpn_int32 *vertNum, vrpn_float32 *x, vrpn_float32 *y, vrpn_float32 *z)
vrpn_int32 scp_message_id
void setSceneOrigin(vrpn_float32 Pos[3], vrpn_float32 axis[3], vrpn_float32 angle)
Class from which all user-level (and other) classes that communicate with vrpn_Connections should der...
vrpn_ForceDevice_Remote(const char *name, vrpn_Connection *cn=NULL)
vrpn_float32 d_conPlanePoint[3]
static vrpn_int32 decode_surface_effects(const char *buffer, const vrpn_int32 len, vrpn_float32 *k_adhesion_norm, vrpn_float32 *k_adhesion_lat, vrpn_float32 *tex_amp, vrpn_float32 *tex_wl, vrpn_float32 *buzz_amp, vrpn_float32 *buzz_freq)
vrpn_int32 customEffectId
static vrpn_int32 decode_objectOrientation(const char *buffer, vrpn_int32 len, vrpn_int32 *objNum, vrpn_float32 axis[3], vrpn_float32 *angle)
static char * encode_setConstraintLineDirection(vrpn_int32 &len, vrpn_float32 x, vrpn_float32 y, vrpn_float32 z)
void addObject(vrpn_int32 objNum, vrpn_int32 ParentNum=-1)
functions for multiple objects in the haptic scene
static int VRPN_CALLBACK handle_error_change_message(void *userdata, vrpn_HANDLERPARAM p)