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 Lesser 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 Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser 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 **********
20 *
21 * Program : TINA
22 * File : $Source: /home/tina/cvs/tina-libs/tina/geometry/geomCam_aim.c,v $
23 * Date : $Date: 2002/12/09 11:51:23 $
24 * Version : $Revision: 1.1.1.1 $
25 * CVS Id : $Id: geomCam_aim.c,v 1.1.1.1 2002/12/09 11:51:23 cvstina Exp $
26 *
27 * Author : Legacy TINA
28 *
29 * Notes : general camera functions
30 *
31 *********
32 */
33
34 #include "geomCam_aim.h"
35
36 #if HAVE_CONFIG_H
37 #include <config.h>
38 #endif
39
40 #include <math.h>
41 #include <tina/sys/sysDef.h>
42 #include <tina/sys/sysPro.h>
43 #include <tina/math/mathDef.h>
44 #include <tina/math/mathPro.h>
45 #include <tina/geometry/geomCam_gen.h>
46 #include <tina/geometry/geom_CamDef.h>
47
48 /**
49 transformation to the coordinate system standing
50 at point p,
51 z-axis along aim
52 y-axis in plane of aim and down
53 **/
54
55 Transform3 trans3_from_aim(Vec3 p, Vec3 aim, Vec3 down)
56 {
57 Vec3 ex = {Vec3_id};
58 Vec3 ey = {Vec3_id};
59 Vec3 ez = {Vec3_id};
60
61 vec3_basis(aim, down, &ex, &ey, &ez);
62 return (trans3_to_frame(p, ex, ey, ez));
63 }
64
65 /**
66 camera with position and orientation specified as above
67
68 Note:
69
70 get simplest camera model
71 type = 0
72 f = ax = ay = 1.0;
73 width = height = 1;
74 cx = cy = 0.0;
75 pix = 1.0;
76
77 can get more realistic, centred camera with given field of view using
78 type = 0
79 f = ax = ay = 1.0;
80 width = height (e.g. 256.0 or 512.0)
81 cx = cy = width/2.0
82 pix = (2.0/width)*tan(theta*DEGREE/2.0) (theta = field of view in degrees)
83
84 standard Tina camera has position and orientation
85 p = vec3_zero()
86 aim = vec3_ez()
87 down = vec3_ey()
88 **/
89
90 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)
91 {
92 Transform3 transf = {Transform3_id};
93
94 transf = trans3_from_aim(p, aim, down);
95
96 return (cam_make(type, &transf, f, pix, ax, ay, cx, cy, width, height));
97 }
98
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.