1 /**********
2 *
3 * This file is part of the TINA Open Source Image Analysis Environment
4 * henceforth known as TINA
5 *
6 * TINA is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation.
9 *
10 * TINA is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with TINA; if not, write to the Free Software Foundation, Inc.,
17 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * ANY users of TINA who require exemption from the existing licence must
20 * negotiate a new licence with Dr. Neil.A.Thacker, the sole agent for
21 * the University of Manchester.
22 *
23 **********
24 *
25 * Program : TINA
26 * File : $Source: /home/tina/cvs/tina-libs/tina/geometry/geomCam_aim.c,v $
27 * Date : $Date: 2002/12/09 11:51:23 $
28 * Version : $Revision: 1.1.1.1 $
29 * CVS Id : $Id: geomCam_aim.c,v 1.1.1.1 2002/12/09 11:51:23 cvstina Exp $
30 *
31 * Author : Legacy TINA
32 *
33 * Notes : general camera functions
34 *
35 *********
36 */
37
38 #include "geomCam_aim.h"
39
40 #if HAVE_CONFIG_H
41 #include <config.h>
42 #endif
43
44 #include <math.h>
45 #include <tina/sys/sysDef.h>
46 #include <tina/sys/sysPro.h>
47 #include <tina/math/mathDef.h>
48 #include <tina/math/mathPro.h>
49 #include <tina/geometry/geomCam_gen.h>
50 #include <tina/geometry/geom_CamDef.h>
51
52 /**
53 transformation to the coordinate system standing
54 at point p,
55 z-axis along aim
56 y-axis in plane of aim and down
57 **/
58
59 Transform3 trans3_from_aim(Vec3 p, Vec3 aim, Vec3 down)
60 {
61 Vec3 ex = {Vec3_id};
62 Vec3 ey = {Vec3_id};
63 Vec3 ez = {Vec3_id};
64
65 vec3_basis(aim, down, &ex, &ey, &ez);
66 return (trans3_to_frame(p, ex, ey, ez));
67 }
68
69 /**
70 camera with position and orientation specified as above
71
72 Note:
73
74 get simplest camera model
75 type = 0
76 f = ax = ay = 1.0;
77 width = height = 1;
78 cx = cy = 0.0;
79 pix = 1.0;
80
81 can get more realistic, centred camera with given field of view using
82 type = 0
83 f = ax = ay = 1.0;
84 width = height (e.g. 256.0 or 512.0)
85 cx = cy = width/2.0
86 pix = (2.0/width)*tan(theta*DEGREE/2.0) (theta = field of view in degrees)
87
88 standard Tina camera has position and orientation
89 p = vec3_zero()
90 aim = vec3_ez()
91 down = vec3_ey()
92 **/
93
94 Camera *cam_from_aim(unsigned int type, Vec3 p, Vec3 aim, Vec3 down, double f, double pix, double ax, double ay, double cx, double cy, int width, int height)
95 {
96 Transform3 transf = {Transform3_id};
97
98 transf = trans3_from_aim(p, aim, down);
99
100 return (cam_make(type, &transf, f, pix, ax, ay, cx, cy, width, height));
101 }
102
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.