BRL-CAD
matrix.h
Go to the documentation of this file.
1 /* M A T R I X . H
2  * BRL-CAD
3  *
4  * Copyright (c) 2008-2024 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 /** @addtogroup ged_matrix
21  *
22  * Geometry EDiting Library Angle Matrix/Quat Functions.
23  *
24  */
25 /** @{ */
26 /** @file ged/view/matrix.h */
27 
28 #ifndef GED_VIEW_MATRIX_H
29 #define GED_VIEW_MATRIX_H
30 
31 #include "common.h"
32 #include "ged/defines.h"
33 
34 __BEGIN_DECLS
35 
36 GED_EXPORT extern void ged_persp_mat(fastf_t *m,
37  fastf_t fovy,
38  fastf_t aspect,
39  fastf_t near1,
40  fastf_t far1,
41  fastf_t backoff);
42 GED_EXPORT extern void ged_mike_persp_mat(fastf_t *pmat,
43  const fastf_t *eye);
44 GED_EXPORT extern void ged_deering_persp_mat(fastf_t *m,
45  const fastf_t *l,
46  const fastf_t *h,
47  const fastf_t *eye);
48 
49 /**
50  * Set/get the perspective angle.
51  */
52 GED_EXPORT extern int ged_perspective(struct ged *gedp, int argc, const char *argv[]);
53 
54 
55 
56 /**
57  * Convert az/el to a direction vector.
58  */
59 GED_EXPORT extern int ged_ae2dir(struct ged *gedp, int argc, const char *argv[]);
60 
61 /**
62  * Get or set the azimuth, elevation and twist.
63  */
64 GED_EXPORT extern int ged_aet(struct ged *gedp, int argc, const char *argv[]);
65 
66 /**
67  * Rotate angle degrees about the specified axis
68  */
69 GED_EXPORT extern int ged_arot_args(struct ged *gedp, int argc, const char *argv[], mat_t rmat);
70 GED_EXPORT extern int ged_arot(struct ged *gedp, int argc, const char *argv[]);
71 
72 /**
73  * Auto-adjust the view so that all displayed geometry is in view
74  */
75 GED_EXPORT extern int ged_autoview(struct ged *gedp, int argc, const char *argv[]);
76 
77 /**
78  * Get or set the view center.
79  */
80 GED_EXPORT extern int ged_center(struct ged *gedp, int argc, const char *argv[]);
81 
82 /**
83  * Convert a direction vector to az/el.
84  */
85 GED_EXPORT extern int ged_dir2ae(struct ged *gedp, int argc, const char *argv[]);
86 
87 /**
88  * Set/get the eye point
89  */
90 GED_EXPORT extern int ged_eye(struct ged *gedp, int argc, const char *argv[]);
91 
92 /**
93  * Set/get the eye position
94  */
95 GED_EXPORT extern int ged_eye_pos(struct ged *gedp, int argc, const char *argv[]);
96 
97 /**
98  * Get view size and center such that all displayed solids would be in view
99  */
100 GED_EXPORT extern int ged_get_autoview(struct ged *gedp, int argc, const char *argv[]);
101 
102 /**
103  * Get the viewsize, orientation and eye point.
104  */
105 GED_EXPORT extern int ged_get_eyemodel(struct ged *gedp, int argc, const char *argv[]);
106 
107 
108 /**
109  * Returns the inverse view size.
110  */
111 GED_EXPORT extern int ged_isize(struct ged *gedp, int argc, const char *argv[]);
112 
113 /**
114  * Load the view
115  */
116 GED_EXPORT extern int ged_loadview(struct ged *gedp, int argc, const char *argv[]);
117 
118 
119 /**
120  * Set the look-at point
121  */
122 GED_EXPORT extern int ged_lookat(struct ged *gedp, int argc, const char *argv[]);
123 
124 /**
125  * Convert the specified model point to a view point.
126  */
127 GED_EXPORT extern int ged_m2v_point(struct ged *gedp, int argc, const char *argv[]);
128 
129 /**
130  * Convert model coordinates to grid coordinates.
131  */
132 GED_EXPORT extern int ged_model2grid_lu(struct ged *gedp, int argc, const char *argv[]);
133 
134 /**
135  * Get the model to view matrix
136  */
137 GED_EXPORT extern int ged_model2view(struct ged *gedp, int argc, const char *argv[]);
138 
139 /**
140  * Convert model coordinates to view coordinates.
141  */
142 GED_EXPORT extern int ged_model2view_lu(struct ged *gedp, int argc, const char *argv[]);
143 
144 /**
145  * Rotate the view. Note - x, y and z are rotations in model coordinates.
146  */
147 GED_EXPORT extern int ged_mrot(struct ged *gedp, int argc, const char *argv[]);
148 
149 /**
150  * Set the view orientation using a quaternion.
151  */
152 GED_EXPORT extern int ged_orient(struct ged *gedp, int argc, const char *argv[]);
153 
154 /**
155  * Set/get the perspective matrix.
156  */
157 GED_EXPORT extern int ged_pmat(struct ged *gedp, int argc, const char *argv[]);
158 
159 /**
160  * Get the pmodel2view matrix.
161  */
162 GED_EXPORT extern int ged_pmodel2view(struct ged *gedp, int argc, const char *argv[]);
163 
164 /**
165  * Get/set the view orientation using a quaternion
166  */
167 GED_EXPORT extern int ged_quat(struct ged *gedp, int argc, const char *argv[]);
168 
169 /**
170  * Set the view from a direction vector and twist.
171  */
172 GED_EXPORT extern int ged_qvrot(struct ged *gedp, int argc, const char *argv[]);
173 
174 /**
175  * Rotate the view.
176  */
177 GED_EXPORT extern int ged_rot_args(struct ged *gedp, int argc, const char *argv[], char *coord, mat_t rmat);
178 GED_EXPORT extern int ged_rot(struct ged *gedp, int argc, const char *argv[]);
179 
180 /**
181  * Set/get the rotate_about point.
182  */
183 GED_EXPORT extern int ged_rotate_about(struct ged *gedp, int argc, const char *argv[]);
184 
185 /**
186  * Scale the view.
187  */
188 GED_EXPORT extern int ged_scale_args(struct ged *gedp, int argc, const char *argv[], fastf_t *sf1, fastf_t *sf2, fastf_t *sf3);
189 GED_EXPORT extern int ged_scale(struct ged *gedp, int argc, const char *argv[]);
190 
191 /**
192  * Set the view orientation given the angles x, y and z in degrees.
193  */
194 GED_EXPORT extern int ged_setview(struct ged *gedp, int argc, const char *argv[]);
195 
196 /**
197  * Get or set the view size.
198  */
199 GED_EXPORT extern int ged_size(struct ged *gedp, int argc, const char *argv[]);
200 
201 
202 /**
203  * Convert view coordinates to grid coordinates.
204  */
205 GED_EXPORT extern int ged_view2grid_lu(struct ged *gedp, int argc, const char *argv[]);
206 
207 /**
208  * Get the view2model matrix.
209  */
210 GED_EXPORT extern int ged_view2model(struct ged *gedp, int argc, const char *argv[]);
211 
212 /**
213  * Convert view coordinates to model coordinates.
214  */
215 GED_EXPORT extern int ged_view2model_lu(struct ged *gedp, int argc, const char *argv[]);
216 
217 /**
218  * Convert a view vector to a model vector.
219  */
220 GED_EXPORT extern int ged_view2model_vec(struct ged *gedp, int argc, const char *argv[]);
221 
222 /**
223  * Rotate the view. Note - x, y and z are rotations in view coordinates.
224  */
225 GED_EXPORT extern int ged_vrot(struct ged *gedp, int argc, const char *argv[]);
226 
227 /**
228  * Return the view direction.
229  */
230 GED_EXPORT extern int ged_viewdir(struct ged *gedp, int argc, const char *argv[]);
231 
232 /**
233  * Get/set the view orientation using yaw, pitch and roll
234  */
235 GED_EXPORT extern int ged_ypr(struct ged *gedp, int argc, const char *argv[]);
236 
237 /**
238  * Zoom the view in or out.
239  */
240 GED_EXPORT extern int ged_zoom(struct ged *gedp, int argc, const char *argv[]);
241 
242 /* defined in clip.c */
243 GED_EXPORT extern int ged_clip(fastf_t *xp1,
244  fastf_t *yp1,
245  fastf_t *xp2,
246  fastf_t *yp2);
247 GED_EXPORT extern int ged_vclip(vect_t a,
248  vect_t b,
249  fastf_t *min,
250  fastf_t *max);
251 
252 /**
253  * Slew the view
254  */
255 GED_EXPORT extern int ged_slew(struct ged *gedp, int argc, const char *argv[]);
256 
257 
258 /**
259  * Set/get the rotation matrix.
260  */
261 GED_EXPORT extern int ged_rmat(struct ged *gedp, int argc, const char *argv[]);
262 
263 
264 /**
265  * Translate the view.
266  */
267 GED_EXPORT extern int ged_tra_args(struct ged *gedp, int argc, const char *argv[], char *coord, vect_t tvec);
268 GED_EXPORT extern int ged_tra(struct ged *gedp, int argc, const char *argv[]);
269 
270 /**
271  * Convert the specified view point to a model point.
272  */
273 GED_EXPORT extern int ged_v2m_point(struct ged *gedp, int argc, const char *argv[]);
274 
275 
276 
277 __END_DECLS
278 
279 #endif /* GED_VIEW_MATRIX_H */
280 
281 /** @} */
282 
283 /*
284  * Local Variables:
285  * tab-width: 8
286  * mode: C
287  * indent-tabs-mode: t
288  * c-file-style: "stroustrup"
289  * End:
290  * ex: shiftwidth=4 tabstop=8
291  */
Header file for the BRL-CAD common definitions.
void int char int int double * min
Definition: tig.h:182
int ged_view2model_lu(struct ged *gedp, int argc, const char *argv[])
int ged_get_eyemodel(struct ged *gedp, int argc, const char *argv[])
int ged_arot(struct ged *gedp, int argc, const char *argv[])
int ged_isize(struct ged *gedp, int argc, const char *argv[])
int ged_view2model_vec(struct ged *gedp, int argc, const char *argv[])
int ged_mrot(struct ged *gedp, int argc, const char *argv[])
int ged_rotate_about(struct ged *gedp, int argc, const char *argv[])
int ged_rot(struct ged *gedp, int argc, const char *argv[])
int ged_quat(struct ged *gedp, int argc, const char *argv[])
int ged_view2grid_lu(struct ged *gedp, int argc, const char *argv[])
int ged_center(struct ged *gedp, int argc, const char *argv[])
int ged_aet(struct ged *gedp, int argc, const char *argv[])
int ged_lookat(struct ged *gedp, int argc, const char *argv[])
int ged_zoom(struct ged *gedp, int argc, const char *argv[])
int ged_m2v_point(struct ged *gedp, int argc, const char *argv[])
int ged_ypr(struct ged *gedp, int argc, const char *argv[])
int ged_vrot(struct ged *gedp, int argc, const char *argv[])
int ged_get_autoview(struct ged *gedp, int argc, const char *argv[])
int ged_model2view_lu(struct ged *gedp, int argc, const char *argv[])
int ged_ae2dir(struct ged *gedp, int argc, const char *argv[])
int ged_vclip(vect_t a, vect_t b, fastf_t *min, fastf_t *max)
int ged_viewdir(struct ged *gedp, int argc, const char *argv[])
int ged_eye_pos(struct ged *gedp, int argc, const char *argv[])
int ged_rmat(struct ged *gedp, int argc, const char *argv[])
int ged_model2view(struct ged *gedp, int argc, const char *argv[])
int ged_orient(struct ged *gedp, int argc, const char *argv[])
int ged_perspective(struct ged *gedp, int argc, const char *argv[])
int ged_loadview(struct ged *gedp, int argc, const char *argv[])
int ged_pmodel2view(struct ged *gedp, int argc, const char *argv[])
int ged_autoview(struct ged *gedp, int argc, const char *argv[])
int ged_arot_args(struct ged *gedp, int argc, const char *argv[], mat_t rmat)
void ged_mike_persp_mat(fastf_t *pmat, const fastf_t *eye)
int ged_tra(struct ged *gedp, int argc, const char *argv[])
int ged_model2grid_lu(struct ged *gedp, int argc, const char *argv[])
int ged_dir2ae(struct ged *gedp, int argc, const char *argv[])
int ged_v2m_point(struct ged *gedp, int argc, const char *argv[])
int ged_slew(struct ged *gedp, int argc, const char *argv[])
int ged_scale(struct ged *gedp, int argc, const char *argv[])
int ged_eye(struct ged *gedp, int argc, const char *argv[])
int ged_setview(struct ged *gedp, int argc, const char *argv[])
void ged_persp_mat(fastf_t *m, fastf_t fovy, fastf_t aspect, fastf_t near1, fastf_t far1, fastf_t backoff)
int ged_view2model(struct ged *gedp, int argc, const char *argv[])
int ged_size(struct ged *gedp, int argc, const char *argv[])
int ged_clip(fastf_t *xp1, fastf_t *yp1, fastf_t *xp2, fastf_t *yp2)
void ged_deering_persp_mat(fastf_t *m, const fastf_t *l, const fastf_t *h, const fastf_t *eye)
int ged_qvrot(struct ged *gedp, int argc, const char *argv[])
int ged_tra_args(struct ged *gedp, int argc, const char *argv[], char *coord, vect_t tvec)
int ged_scale_args(struct ged *gedp, int argc, const char *argv[], fastf_t *sf1, fastf_t *sf2, fastf_t *sf3)
int ged_rot_args(struct ged *gedp, int argc, const char *argv[], char *coord, mat_t rmat)
int ged_pmat(struct ged *gedp, int argc, const char *argv[])
fastf_t vect_t[ELEMENTS_PER_VECT]
3-tuple vector
Definition: vmath.h:349
double fastf_t
fastest 64-bit (or larger) floating point type
Definition: vmath.h:334
fastf_t mat_t[ELEMENTS_PER_MAT]
4x4 matrix
Definition: vmath.h:370
Definition: defines.h:205