neil@yc.estec.nl (Neil Dixon) (10/23/89)
Help! I'm trying to write a program in starbase that uses a right-hand coordinate system. The man page for view_camera states that :- The view_camera function assumes a left-handed world coordinate system. If this is not the case, then simply call the view_matrix3d function right after calling the view_camera function with a matrix that is identity except that the z-scale term is -1, and the mode set to PRE_CONCAT_VW. Therefore I would expect the attached program to produce the following picture on the screen:- z | | | |_______ y / / / x/ However what I get is _______ x /| / | / | y/ | |z Indeed I have a r.h.s but my camera position does not agree with the appearance of the picture. Can someone point out to what I'm doing wrong. How do I represent right-hand world c.s. correctly? # This is a shell archive. Remove anything before this line, # then unpack it by saving it in a file and typing "sh file". # # Wrapped by Neil Dixon <neil@esatst> on Thu Oct 12 11:25:33 1989 # # This archive contains: # test.c # unset LANG echo x - test.c cat >test.c <<'@EOF' #include <starbase.c.h> camera_arg camera = { 0.0, 0.0, 0.0, /* reference position */ 1.0, 1.0, 1.0, /* camera position */ 0.0, 0.0, 1.0, /* up vector */ 60.0, /* field of view */ -1.0, 1.0, /* front & back */ CAM_PARALLEL /* projection */ }; float left_to_right[4][4] = { {1.0, 0.0, 0.0, 0.0}, {0.0, 1.0, 0.0, 0.0}, {0.0, 0.0,-1.0, 0.0}, {0.0, 0.0, 0.0, 1.0}, }; static int draw_axes(fd) int fd; /* output device */ { text_alignment(fd, TA_LEFT, TA_TOP, 0.0, 0.0); character_height(fd, 0.2); move3d(fd, 0.0, 0.0, 0.0); draw3d(fd, 0.8, 0.0, 0.0); text3d(fd, 0.8, 0.0, 0.0,"X",WORLD_COORDINATE_TEXT,FALSE); move3d(fd, 0.0, 0.0, 0.0); draw3d(fd, 0.0, 0.8, 0.0); text3d(fd, 0.0, 0.8, 0.0,"Y",WORLD_COORDINATE_TEXT,FALSE); move3d(fd, 0.0, 0.0, 0.0); draw3d(fd, 0.0, 0.0, 0.8); text3d(fd, 0.0, 0.0, 0.8,"Z",WORLD_COORDINATE_TEXT,FALSE); } main() { int fd; fd = gopen("/dev/crt0", OUTDEV, "hp98721", INIT|THREE_D); view_camera(fd, &camera); view_matrix3d(fd, left_to_right, PRE_CONCAT_VW); draw_axes(fd); make_picture_current(fd); } @EOF chmod 644 test.c exit 0 -- Neil Dixon <neil@yc.estec.nl> UUCP:...!mcvax!esatst!neil, BITNET: NDIXON@ESTEC Thermal Control & Life Support Division (YC) European Space Research and Technology Centre (ESTEC), Noordwijk, The Netherlands. -- Neil Dixon <neil@yc.estec.nl> UUCP:...!mcvax!esatst!neil, BITNET: NDIXON@ESTEC Thermal Control & Life Support Division (YC) European Space Research and Technology Centre (ESTEC), Noordwijk, The Netherlands.
jeff@hpfcmgw.HP.COM (Jeff Taylor) (10/26/89)
> I'm trying to write a program in starbase that uses a right-hand > coordinate system. The man page for view_camera states that :- You need to negate the Z fields of the "camera_arg". camera.refz will also need to be negated: camera_arg camera = { 0.0, 0.0, 0.0, /* reference position */ 1.0, 1.0, -1.0, /* camera position */ 0.0, 0.0, -1.0, /* up vector */ 60.0, /* field of view */ -1.0, 1.0, /* front & back */ CAM_PARALLEL /* projection */ }; Jeff Taylor jeff@hpfcmr #include <std.disclaimer>