liba2ri  0.2
 All Data Structures
model.h
1 /*************************************/
2 /* Auteur : Rémi Synave */
3 /* Date de création : 01/03/07 */
4 /* Date de modification : 08/01/10 */
5 /* Version : 0.2 */
6 /*************************************/
7 
8 /*************************************/
9 /* Auteur : Romain Leguay */
10 /* Nguyen Haiduong */
11 /* Marianne Fichoux */
12 /* Date de modification : 26/05/09 */
13 /* Version : 0.2 */
14 /*************************************/
15 
16 /***************************************************************************/
17 /* This file is part of a2ri. */
18 /* */
19 /* a2ri is free software: you can redistribute it and/or modify it */
20 /* under the terms of the GNU Lesser General Public License as published */
21 /* by the Free Software Foundation, either version 3 of the License, or */
22 /* (at your option) any later version. */
23 /* */
24 /* a2ri is distributed in the hope that it will be useful, */
25 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
26 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
27 /* GNU Lesser General Public License for more details. */
28 /* */
29 /* You should have received a copy of the GNU Lesser General Public */
30 /* License along with a2ri. */
31 /* If not, see <http://www.gnu.org/licenses/>. */
32 /***************************************************************************/
33 
34 
35 
36 #ifndef MODEL__H
37 #define MODEL__H
38 
39 #include <stdio.h>
40 #include <stdlib.h>
41 #include <math.h>
42 #include <gsl/gsl_linalg.h>
43 #include <gsl/gsl_math.h>
44 #include <string.h>
45 
46 #include "util.h"
47 #include "vertex.h"
48 #include "edge.h"
49 #include "face.h"
50 #include "point.h"
51 #include "polyhedron.h"
52 #include "geometry.h"
53 #include "hashtable.h"
54 #include "space_partition.h"
55 
56 
61 typedef struct
62 {
63  vf_vertex *ve;
64  vf_face *fa;
65  polyhedron *pol;
66  int nbvertex;
67  int nbface;
68  int nbpolyhedron;
69  double xmin,
70  ymin,
71  zmin,
72  xmax,
73  ymax,
74  zmax;
75 } vf_model;
76 
77 typedef struct
78 {
79  vef_vertex *ve;
80  vef_edge *ed;
81  vef_face *fa;
82  polyhedron *pol;
83  int nbvertex;
84  int nbedge;
85  int nbface;
86  int nbpolyhedron;
87  double xmin,
88  ymin,
89  zmin,
90  xmax,
91  ymax,
92  zmax;
93 } vef_model;
94 
95 typedef void (
96  *ptf_func_hashtable) (
97  vf_edge *,
98  vf_model *,
99  hashtable *);
100 
106 void a2ri_vf_init (
107  vf_model * m);
108 
113 void a2ri_vf_free (
114  vf_model * m);
115 
121 vf_model* a2ri_vf_clone (
122  vf_model * m);
123 
129 void a2ri_vf_display (
130  vf_model m);
131 
137 void a2ri_vf_display_detail (
138  vf_model m);
139 
147 void a2ri_vf_update_num_edge (
148  vf_edge * e,
149  vf_model * m,
150  hashtable * table);
151 
159 void a2ri_vf_update_length_edge (
160  vf_edge * e,
161  vf_model * m,
162  hashtable * table);
163 
171 hashtable *a2ri_vf_construction_edge_table (
172  vf_model * m,
173  ptf_func_hashtable * func,
174  int nbfunc);
175 
184 int a2ri_vf_add_vertex (
185  vf_model * m,
186  double x,
187  double y,
188  double z);
189 
198 int a2ri_vf_search_vertex (
199  vf_model m,
200  double x,
201  double y,
202  double z);
203 
210 int a2ri_vf_remove_vertex (
211  vf_model * m,
212  int numvertex);
213 
220 int a2ri_vf_remove_list_of_vertex (
221  vf_model * m,
222  int *listvertex,
223  int sizelist);
224 
233 int a2ri_vf_add_face (
234  vf_model * m,
235  int ve1,
236  int ve2,
237  int ve3);
238 
269 int a2ri_vf_search_face (
270  vf_model m,
271  int ve1,
272  int ve2,
273  int ve3);
274 
281 int a2ri_vf_remove_face (
282  vf_model * m,
283  int numface);
284 
291 int a2ri_vf_remove_list_of_face (
292  vf_model * m,
293  int *listface,
294  int sizelist);
295 
305 int a2ri_vf_add_polyhedron (
306  vf_model * m,
307  int f1,
308  int f2,
309  int f3,
310  int f4);
311 
321 int a2ri_vf_search_polyhedron (
322  vf_model m,
323  int f1,
324  int f2,
325  int f3,
326  int f4);
327 
334 int a2ri_vf_remove_polyhedron (
335  vf_model * m,
336  int numpolyhedron);
337 
344 int a2ri_vf_remove_list_of_polyhedron (
345  vf_model * m,
346  int *list,
347  int size);
348 
357 void a2ri_vf_translate (
358  vf_model * m,
359  vector3d delta);
360 
366 void a2ri_vf_center (
367  vf_model * m);
368 
375 void a2ri_vf_rotateX_radian (
376  vf_model * m,
377  double angle);
378 
385 void a2ri_vf_rotateX_degre (
386  vf_model * m,
387  double angle);
388 
398 void a2ri_vf_rotateX_radian_center (
399  vf_model * m,
400  double angle,
401  point3d centre);
402 
412 void a2ri_vf_rotateX_degre_center (
413  vf_model * m,
414  double angle,
415  point3d centre);
416 
423 void a2ri_vf_rotateY_radian (
424  vf_model * m,
425  double angle);
426 
433 void a2ri_vf_rotateY_degre (
434  vf_model * m,
435  double angle);
436 
446 void a2ri_vf_rotateY_radian_center (
447  vf_model * m,
448  double angle,
449  point3d centre);
450 
460 void a2ri_vf_rotateY_degre_center (
461  vf_model * m,
462  double angle,
463  point3d centre);
464 
471 void a2ri_vf_rotateZ_radian (
472  vf_model * m,
473  double angle);
474 
481 void a2ri_vf_rotateZ_degre (
482  vf_model * m,
483  double angle);
484 
494 void a2ri_vf_rotateZ_radian_center (
495  vf_model * m,
496  double angle,
497  point3d centre);
498 
508 void a2ri_vf_rotateZ_degre_center (
509  vf_model * m,
510  double angle,
511  point3d centre);
512 
523 void a2ri_vf_rotate_axe_radian (
524  vf_model * m,
525  double angle,
526  vector3d axe);
527 
533 double a2ri_vf_area (
534  vf_model * m);
535 
544 void a2ri_vf_faces_next_vertex (
545  vf_model m,
546  int numve,
547  int **list,
548  int *size);
549 
559 void a2ri_vf_faces_next_vertex_with_hashtable (
560  vf_model m,
561  int numve,
562  int **list,
563  int *size,
564  hashtable * table);
565 
572 vector3d a2ri_vf_normal_face (
573  vf_model * m,
574  int numfa);
575 
582 vector3d a2ri_vf_normal_vertex (
583  vf_model * m,
584  int numve);
585 
593 vector3d a2ri_vf_normal_vertex_with_hashtable (
594  vf_model * m,
595  int numve,
596  hashtable * table);
597 
604 vf_model *a2ri_vf_concat (
605  vf_model ** m,
606  int size);
607 
614 void a2ri_vf_space_partition (
615  vf_model * m,
616  space_partition * sp);
617 
623 point3d*
624 a2ri_vf_to_list_point3d(
625  vf_model *m);
626 
632 vef_model* a2ri_vf_to_vef (
633  vf_model *m);
634 
640 void a2ri_vef_init (
641  vef_model * m);
642 
647 void a2ri_vef_free (
648  vef_model * m);
649 
655 void a2ri_vef_display (
656  vef_model m);
657 
663 void a2ri_vef_display_detail (
664  vef_model m);
665 
674 int a2ri_vef_add_vertex (
675  vef_model * m,
676  double x,
677  double y,
678  double z);
679 
688 int a2ri_vef_search_vertex (
689  vef_model m,
690  double x,
691  double y,
692  double z);
693 
700 int a2ri_vef_remove_vertex (
701  vef_model * m,
702  int numvertex);
703 
710 int a2ri_vef_remove_list_of_vertex (
711  vef_model * m,
712  int *listvertex,
713  int size);
714 
723 int a2ri_vef_add_edge (
724  vef_model * m,
725  int ve1,
726  int ve2,
727  int verif);
728 
737 int a2ri_vef_search_edge (
738  vef_model m,
739  int ve1,
740  int ve2);
741 
748 int a2ri_vef_remove_edge (
749  vef_model * m,
750  int numedge);
751 
758 int a2ri_vef_remove_list_of_edge (
759  vef_model * m,
760  int *listedge,
761  int size);
762 
771 int a2ri_vef_add_face (
772  vef_model * m,
773  int ed1,
774  int ed2,
775  int ed3);
776 
807 int a2ri_vef_search_face (
808  vef_model m,
809  int ed1,
810  int ed2,
811  int ed3);
812 
819 int a2ri_vef_remove_face (
820  vef_model * m,
821  int numface);
822 
829 int a2ri_vef_remove_list_of_face (
830  vef_model * m,
831  int *listface,
832  int size);
833 
843 int a2ri_vef_add_polyhedron (
844  vef_model * m,
845  int f1,
846  int f2,
847  int f3,
848  int f4);
849 
859 int a2ri_vef_search_polyhedron (
860  vef_model m,
861  int f1,
862  int f2,
863  int f3,
864  int f4);
865 
872 int a2ri_vef_remove_polyhedron (
873  vef_model * m,
874  int numpolyhedron);
875 
882 int a2ri_vef_remove_list_of_polyhedron (
883  vef_model * m,
884  int *listpolyhedron,
885  int size);
886 
895 void a2ri_vef_translate (
896  vef_model * m,
897  vector3d delta);
898 
905 void a2ri_vef_rotateX_radian (
906  vef_model * m,
907  double angle);
908 
915 void a2ri_vef_rotateX_degre (
916  vef_model * m,
917  double angle);
918 
928 void a2ri_vef_rotateX_radian_center (
929  vef_model * m,
930  double angle,
931  point3d centre);
932 
942 void a2ri_vef_rotateX_degre_center (
943  vef_model * m,
944  double angle,
945  point3d centre);
946 
953 void a2ri_vef_rotateY_radian (
954  vef_model * m,
955  double angle);
956 
963 void a2ri_vef_rotateY_degre (
964  vef_model * m,
965  double angle);
966 
976 void a2ri_vef_rotateY_radian_center (
977  vef_model * m,
978  double angle,
979  point3d centre);
980 
990 void a2ri_vef_rotateY_degre_center (
991  vef_model * m,
992  double angle,
993  point3d centre);
994 
1001 void a2ri_vef_rotateZ_radian (
1002  vef_model * m,
1003  double angle);
1004 
1011 void a2ri_vef_rotateZ_degre (
1012  vef_model * m,
1013  double angle);
1014 
1024 void a2ri_vef_rotateZ_radian_center (
1025  vef_model * m,
1026  double angle,
1027  point3d centre);
1028 
1038 void a2ri_vef_rotateZ_degre_center (
1039  vef_model * m,
1040  double angle,
1041  point3d centre);
1042 
1048 double a2ri_vef_area_model (
1049  vef_model * m);
1050 
1057 void a2ri_vef_space_partition (
1058  vef_model * m,
1059  space_partition * sp);
1060 
1066 point3d*
1067 a2ri_vef_to_list_point3d(
1068  vef_model *m);
1069 
1075 vf_model*
1076 a2ri_vef_to_vf(
1077  vef_model *m);
1078 
1079 #endif