1 /***************************************************************************** 2 * 3 * Elmer, A Finite Element Software for Multiphysical Problems 4 * 5 * Copyright 1st April 1995 - , CSC - IT Center for Science Ltd., Finland 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program (in file fem/GPL-2); if not, write to the 19 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 20 * Boston, MA 02110-1301, USA. 21 * 22 *****************************************************************************/ 23 24 /******************************************************************************* 25 * 26 * The character of the routines in this file. 27 * 28 ******************************************************************************* 29 * 30 * Author: Juha Ruokolainen 31 * 32 * Address: CSC - IT Center for Science Ltd. 33 * Keilaranta 14, P.O. BOX 405 34 * 02101 Espoo, Finland 35 * Tel. +358 0 457 2723 36 * Telefax: +358 0 457 2302 37 * EMail: Juha.Ruokolainen@csc.fi 38 * 39 * Date: 1 Oct 1995 40 * 41 * Modification history: 42 * 43 ******************************************************************************/ 44 45 #ifdef MODULE_OBJECTS 46 # define OBJ_EXT 47 #else 48 # define OBJ_EXT extern 49 #endif 50 51 typedef double matrix_t[4][4]; 52 53 typedef enum 54 { 55 rot_pri_xyz, 56 rot_pri_xzy, 57 rot_pri_yxz, 58 rot_pri_yzx, 59 rot_pri_zxy, 60 rot_pri_zyx, 61 rot_pri_local, 62 rot_pri_parent 63 } rot_pri_t; 64 65 typedef enum 66 { 67 trn_pri_trs, 68 trn_pri_tsr, 69 trn_pri_rts, 70 trn_pri_rst, 71 trn_pri_str, 72 trn_pri_srt 73 } trn_pri_t; 74 75 typedef struct transform_s 76 { 77 struct transform_list_s *Children; 78 struct transform_s *Parent; 79 80 matrix_t Matrix; 81 82 matrix_t RotMatrix; 83 matrix_t TrnMatrix; 84 matrix_t SclMatrix; 85 86 double RotX,RotY,RotZ; 87 double TrnX,TrnY,TrnZ; 88 double SclX,SclY,SclZ; 89 90 rot_pri_t RotationPriority; 91 trn_pri_t TransformPriority; 92 } transform_t; 93 94 typedef struct transform_list_s 95 { 96 struct transform_list_s *Next; 97 transform_t *Entry; 98 } transform_list_t; 99 100 typedef struct object_s 101 { 102 struct object_s *Next; 103 int Id; 104 char *Name; 105 106 transform_t Transform; 107 108 element_model_t *ElementModel; 109 110 geometry_t *Geometry; 111 112 int ClipPlane[6]; 113 double ClipEquation[6][4]; 114 115 struct visual_s *VisualList; 116 } object_t; 117 118 OBJ_EXT object_t VisualObject,RotObject,*CurrentObject; 119 OBJ_EXT double PiDiv180; 120 121 void obj_object_initialize( object_t *object ); 122 object_t *obj_new(char *name); 123 object_t *obj_add_object( object_t *object,char *name ); 124 object_t *obj_find( object_t *object,char *name ); 125 int obj_display_list( object_t *object,double t ); 126 void obj_init_transform( transform_t *transform ); 127 void obj_get_matrix(matrix_t matrix,object_t *object); 128 void obj_get_matrix_transpose( matrix_t matrix,object_t *object ); 129 void obj_set_rotation_priority( object_t *object, rot_pri_t priority); 130 void obj_set_transform_priority( object_t *object, trn_pri_t priority); 131 int obj_set_parent( object_t *object,object_t *parent ); 132 void obj_rotate( object_t *object,double x,double y,double z,int which,int relative ); 133 void obj_scale( object_t *object,double x,double y,double z,int which, int relative ); 134 void obj_translate( object_t *object,double x,double y,double z,int which,int relative ); 135 void obj_set_matrix( object_t *object ); 136