BRL-CAD
rotate_hyp.c
Go to the documentation of this file.
1 /* R O T A T E _ H Y P . 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/rotate_hyp.c
21  *
22  * The rotate_hyp command.
23  *
24  */
25 
26 #include "common.h"
27 
28 #include <string.h>
29 
30 #include "bu/cmd.h"
31 #include "rtgeom.h"
32 #include "raytrace.h"
33 
34 #include "./ged_private.h"
35 
36 
37 int
38 _ged_rotate_hyp(struct ged *gedp, struct rt_hyp_internal *hyp, const char *attribute, matp_t rmat)
39 {
40  RT_HYP_CK_MAGIC(hyp);
41 
42  if (attribute[1] != '\0') {
43  bu_vls_printf(gedp->ged_result_str, "bad hyp attribute - %s", attribute);
44  return GED_ERROR;
45  }
46 
47  switch (attribute[0]) {
48  case 'h':
49  case 'H':
50  MAT4X3VEC(hyp->hyp_Hi, rmat, hyp->hyp_Hi);
51  break;
52  default:
53  bu_vls_printf(gedp->ged_result_str, "bad hyp attribute - %s", attribute);
54  return GED_ERROR;
55  }
56 
57  return GED_OK;
58 }
59 
60 
61 /*
62  * Local Variables:
63  * tab-width: 8
64  * mode: C
65  * indent-tabs-mode: t
66  * c-file-style: "stroustrup"
67  * End:
68  * ex: shiftwidth=4 tabstop=8
69  */
#define GED_OK
Definition: ged.h:55
int _ged_rotate_hyp(struct ged *gedp, struct rt_hyp_internal *hyp, const char *attribute, matp_t rmat)
Definition: rotate_hyp.c:38
Definition: ged.h:338
Header file for the BRL-CAD common definitions.
#define GED_ERROR
Definition: ged.h:61
struct bu_vls * ged_result_str
Definition: ged.h:357
void bu_vls_printf(struct bu_vls *vls, const char *fmt,...) _BU_ATTR_PRINTF23
Definition: vls.c:694