BRL-CAD
get_eyemodel.c
Go to the documentation of this file.
1 /* G E T _ E Y E M O D E L . C
2  * BRL-CAD
3  *
4  * Copyright (c) 2008-2014 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 /** @file libged/get_eyemodel.c
21  *
22  * The get_eyemodel command.
23  *
24  */
25 
26 #include "common.h"
27 
28 
29 #include "./ged_private.h"
30 
31 
32 /*
33  * Returns the views eyemodel
34  *
35  * Usage:
36  * get_eyemodel
37  *
38  */
39 int
40 ged_get_eyemodel(struct ged *gedp, int argc, const char *argv[])
41 {
42  quat_t quat;
43  vect_t eye_model;
44 
48  GED_CHECK_ARGC_GT_0(gedp, argc, GED_ERROR);
49 
50  /* initialize result */
51  bu_vls_trunc(gedp->ged_result_str, 0);
52 
53  if (argc != 1) {
54  bu_vls_printf(gedp->ged_result_str, "Usage: %s", argv[0]);
55  return GED_ERROR;
56  }
57 
58  _ged_rt_set_eye_model(gedp, eye_model);
59  quat_mat2quat(quat, gedp->ged_gvp->gv_rotation);
60 
61  bu_vls_printf(gedp->ged_result_str, "viewsize %.15e;\n", gedp->ged_gvp->gv_size);
62  bu_vls_printf(gedp->ged_result_str, "orientation %.15e %.15e %.15e %.15e;\n",
63  V4ARGS(quat));
64  bu_vls_printf(gedp->ged_result_str, "eye_pt %.15e %.15e %.15e;\n",
65  eye_model[X], eye_model[Y], eye_model[Z]);
66 
67  return GED_OK;
68 }
69 
70 
71 /*
72  * Local Variables:
73  * tab-width: 8
74  * mode: C
75  * indent-tabs-mode: t
76  * c-file-style: "stroustrup"
77  * End:
78  * ex: shiftwidth=4 tabstop=8
79  */
#define GED_OK
Definition: ged.h:55
Definition: ged.h:338
void _ged_rt_set_eye_model(struct ged *gedp, vect_t eye_model)
Definition: rt.c:88
void bu_vls_trunc(struct bu_vls *vp, int len)
Definition: vls.c:198
#define GED_CHECK_ARGC_GT_0(_gedp, _argc, _flags)
Definition: ged.h:202
Header file for the BRL-CAD common definitions.
#define GED_ERROR
Definition: ged.h:61
struct bview * ged_gvp
Definition: ged.h:361
Definition: color.c:49
#define GED_CHECK_VIEW(_gedp, _flags)
Definition: ged.h:140
#define GED_CHECK_DATABASE_OPEN(_gedp, _flags)
Definition: ged.h:114
fastf_t gv_size
2.0 * scale
Definition: bview.h:212
#define GED_CHECK_DRAWABLE(_gedp, _flags)
Definition: ged.h:129
struct bu_vls * ged_result_str
Definition: ged.h:357
int ged_get_eyemodel(struct ged *gedp, int argc, const char *argv[])
Definition: get_eyemodel.c:40
mat_t gv_rotation
Definition: bview.h:220
void bu_vls_printf(struct bu_vls *vls, const char *fmt,...) _BU_ATTR_PRINTF23
Definition: vls.c:694
Definition: color.c:51
void quat_mat2quat(quat_t quat, const mat_t mat)
Quaternion math routines.
Definition: color.c:50