~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina6/tina-tools/tinatool/tlvision/tlvisSmm_view.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /**********
  2  *
  3  *
  4  * Copyright (c) 2003, Division of Imaging Science and Biomedical Engineering,
  5  * University of Manchester, UK.  All rights reserved.
  6  * 
  7  * Redistribution and use in source and binary forms, with or without modification, 
  8  * are permitted provided that the following conditions are met:
  9  * 
 10  *   . Redistributions of source code must retain the above copyright notice, 
 11  *     this list of conditions and the following disclaimer.
 12  *    
 13  *   . Redistributions in binary form must reproduce the above copyright notice,
 14  *     this list of conditions and the following disclaimer in the documentation 
 15  *     and/or other materials provided with the distribution.
 16  * 
 17  *   . Neither the name of the University of Manchester nor the names of its
 18  *     contributors may be used to endorse or promote products derived from this 
 19  *     software without specific prior written permission.
 20  * 
 21  * 
 22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
 23  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
 24  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
 25  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
 26  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
 27  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
 28  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 29  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
 30  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
 31  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
 32  * POSSIBILITY OF SUCH DAMAGE.
 33  **********
 34  *
 35  * Program :   TINA
 36  * File    :  $Source: /home/tina/cvs/tina-tools/tinatool/tlvision/tlvisSmm_view.c,v $
 37  * Date    :  $Date: 2009/03/24 12:58:52 $
 38  * Version :  $Revision: 1.5 $
 39  * CVS Id  :  $Id: tlvisSmm_view.c,v 1.5 2009/03/24 12:58:52 paul Exp $
 40  *
 41  * Author  : Legacy TINA
 42 */
 43 /**
 44  *  @file
 45  *  @brief
 46  */
 47 
 48 
 49 #include "tlvisSmm_view.h"
 50 
 51 #if HAVE_CONFIG_H
 52 #include <config.h>
 53 #endif
 54 
 55 #include <stdio.h>
 56 
 57 #include <tina/sys/sysDef.h>
 58 #include <tina/sys/sysPro.h>
 59 #include <tina/math/mathDef.h>
 60 #include <tina/math/mathPro.h>
 61 #include <tina/geometry/geomGen_hull.h>
 62 #include <tina/vision/visDef.h>
 63 #include <tina/vision/visPro.h>
 64 
 65 #include <tinatool/wdgts/wdgtsDef.h>
 66 #include <tinatool/wdgts/wdgtsPro.h>
 67 #include <tinatool/gphx/gphxDef.h>
 68 #include <tinatool/gphx/gphxPro.h>
 69 #include <tinatool/draw/drawDef.h>
 70 #include <tinatool/draw/drawPro.h>
 71 #include <tinatool/tlbase/tlbaseDef.h>
 72 #include <tinatool/tlbase/tlbasePro.h>
 73 
 74 #include "tlvisSmm_matcher.h"
 75 #include "tlvisSmm_draw.h"
 76 
 77 void            model_init(Tv * tv)
 78 {
 79         Vec3            centre = {Vec3_id};
 80         Vec3            aim = {Vec3_id};
 81         Vec3            down = {Vec3_id};
 82         double          radius, pscale;
 83         List           *model = (List *) model_get();
 84 
 85         if (model == NULL)
 86                 return;
 87 
 88         geom_hull_get(model, &centre, &radius);
 89         pscale = 3.0;
 90         aim = vec3_ez();
 91         down = vec3_ey();
 92         tv_camera3(tv, centre, radius, pscale, aim, down);
 93         tv_repaint(tv);
 94 }
 95 
 96 
 97 void            scene_init(Tv * tv)
 98 {
 99         Vec3            centre = {Vec3_id};
100         Vec3            aim = {Vec3_id};
101         Vec3            down = {Vec3_id};
102         double          radius, pscale;
103         List           *scene = (List *) scene_get();
104 
105         if (scene == NULL)
106                 return;
107 
108         geom_hull_get(scene, &centre, &radius);
109         pscale = 3.0;
110         aim = vec3_ez();
111         down = vec3_ey();
112         tv_camera3(tv, centre, radius, pscale, aim, down);
113         tv_repaint(tv);
114 }
115 
116 void            matches_draw(void)
117 {
118         Tv             *model_tv();
119         Tv             *scene_tv();
120         List           *matcher_matches_get();
121 
122         match_list_draw(matcher_matches_get(), model_tv(), scene_tv(), white);
123 }
124 
125 void            model_fulldraw(Tv * tv)
126 {
127         List           *model = (List *) model_get();
128         List           *group;
129         List           *group_get();
130         List           *focus;
131         List           *focus_get();
132 
133         group = group_get();
134         focus = focus_get();
135 
136         tv_screen_double_buffer_start(tv->tv_screen);
137         tv_set_color(tv, baby_pink);
138         reclist_list_draw(tv, model, 0, geom_draw_directed, (void *) POSITIVE);
139         tv_set_color(tv, magenta);
140         reclist_list_draw(tv, group, 0, geom_draw_directed, (void *) POSITIVE);
141         tv_set_color(tv, cyan);
142         reclist_list_draw(tv, focus, 0, geom_draw_directed, (void *) POSITIVE);
143         tv_screen_double_buffer_end(tv->tv_screen);
144 }
145 
146 void            model_skeldraw(Tv * tv)
147 {
148         List           *model = (List *) model_get();
149         int             old_sample = curve_draw_sample_get();
150 
151         if (tv == NULL)
152                 return;
153 
154         tv_screen_double_buffer_start(tv->tv_screen);
155         curve_draw_sample_set(MAX(tv->height, tv->width) / 10);
156         reclist_list_draw(tv, model, 0, geom_draw, NULL);
157         curve_draw_sample_set(old_sample);
158         tv_screen_double_buffer_end(tv->tv_screen);
159 }
160 
161 void            scene_fulldraw(Tv * tv)
162 {
163         List           *scene = (List *) scene_get();
164 
165         tv_screen_double_buffer_start(tv->tv_screen);
166         tv_set_color(tv, baby_blue);
167         reclist_list_draw(tv, scene, 0, geom_draw_directed, (void *) POSITIVE);
168         tv_screen_double_buffer_end(tv->tv_screen);
169 }
170 
171 void            scene_skeldraw(Tv * tv)
172 {
173         List           *scene = (List *) scene_get();
174         int             old_sample = curve_draw_sample_get();
175 
176         if (tv == NULL)
177                 return;
178 
179         tv_screen_double_buffer_start(tv->tv_screen);
180         curve_draw_sample_set(MAX(tv->height, tv->width) / 10);
181         reclist_list_draw(tv, scene, 0, geom_draw, NULL);
182         curve_draw_sample_set(old_sample);
183         tv_screen_double_buffer_end(tv->tv_screen);
184 }
185 
186 Tv             *model_tv_make(void)
187 {
188         static Tv      *tvmodel;
189 
190         tvmodel = tv_create("model");
191         (void) tv_set_zoomlevel(tvmodel, ZOOM3);
192         (void) tv_set_fulldraw(tvmodel, model_fulldraw);
193         (void) tv_set_skeldraw(tvmodel, model_skeldraw);
194         tv_set_init(tvmodel, model_init);
195         return (tvmodel);
196 }
197 
198 Tv             *scene_tv_make(void)
199 {
200         static Tv      *tvscene;
201 
202         tvscene = tv_create("scene");
203         (void) tv_set_zoomlevel(tvscene, ZOOM3);
204         (void) tv_set_fulldraw(tvscene, scene_fulldraw);
205         (void) tv_set_skeldraw(tvscene, scene_skeldraw);
206         tv_set_init(tvscene, scene_init);
207         return (tvscene);
208 }
209 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.