Blender V2.61 - r43446
|
00001 /* 00002 * ***** BEGIN GPL LICENSE BLOCK ***** 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software Foundation, 00016 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 * 00018 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 00019 * All rights reserved. 00020 * 00021 * The Original Code is: all of this file. 00022 * 00023 * Contributor(s): none yet. 00024 * 00025 * ***** END GPL LICENSE BLOCK ***** 00026 */ 00027 00033 #include <string.h> 00034 #include <stdio.h> 00035 00036 #ifndef BOP_TAG_H 00037 #define BOP_TAG_H 00038 00039 #define IN_TAG 0x02 // Below the plane 00040 #define ON_TAG 0x00 // On the plane 00041 #define OUT_TAG 0x01 // Above the plane 00042 #define INOUT_TAG 0x0E // Above and below the plane 00043 #define INON_TAG 0x12 // Below and on the plane 00044 #define OUTON_TAG 0x11 // Above and on the plane 00045 #define UNCLASSIFIED_TAG 0x0F // Expecting to be classified 00046 00047 #define PHANTOM_TAG 0x0C // Phantom face: verts form collinear triangle 00048 #define OVERLAPPED_TAG 0x0D // Overlapped face 00049 #define BROKEN_TAG 0x0B // Splitted and unused ... 00050 00051 #define ON_ON_IN_TAG IN_TAG 00052 #define ON_IN_ON_TAG IN_TAG << 2 00053 #define IN_ON_ON_TAG IN_TAG << 4 00054 00055 #define ON_ON_OUT_TAG OUT_TAG 00056 #define ON_OUT_ON_TAG OUT_TAG << 2 00057 #define OUT_ON_ON_TAG OUT_TAG << 4 00058 00059 #define ON_ON_ON_TAG ON_TAG 00060 #define IN_IN_IN_TAG IN_ON_ON_TAG | ON_IN_ON_TAG | ON_ON_IN_TAG 00061 #define OUT_OUT_OUT_TAG OUT_ON_ON_TAG | ON_OUT_ON_TAG | ON_ON_OUT_TAG 00062 00063 #define IN_IN_ON_TAG IN_ON_ON_TAG | ON_IN_ON_TAG 00064 #define IN_ON_IN_TAG IN_ON_ON_TAG | ON_ON_IN_TAG 00065 #define ON_IN_IN_TAG ON_IN_ON_TAG | ON_ON_IN_TAG 00066 00067 #define OUT_OUT_ON_TAG OUT_ON_ON_TAG | ON_OUT_ON_TAG 00068 #define OUT_ON_OUT_TAG OUT_ON_ON_TAG | ON_ON_OUT_TAG 00069 #define ON_OUT_OUT_TAG ON_OUT_ON_TAG | ON_ON_OUT_TAG 00070 00071 #define IN_OUT_OUT_TAG IN_ON_ON_TAG | ON_OUT_OUT_TAG 00072 #define OUT_IN_OUT_TAG ON_IN_ON_TAG | OUT_ON_OUT_TAG 00073 #define OUT_OUT_IN_TAG ON_ON_IN_TAG | OUT_OUT_ON_TAG 00074 00075 #define OUT_IN_IN_TAG ON_IN_IN_TAG | OUT_ON_ON_TAG 00076 #define IN_OUT_IN_TAG IN_ON_IN_TAG | ON_OUT_ON_TAG 00077 #define IN_IN_OUT_TAG IN_IN_ON_TAG | ON_ON_OUT_TAG 00078 00079 #define IN_ON_OUT_TAG IN_ON_ON_TAG | ON_ON_OUT_TAG 00080 #define IN_OUT_ON_TAG IN_ON_ON_TAG | ON_OUT_ON_TAG 00081 #define ON_IN_OUT_TAG ON_IN_ON_TAG | ON_ON_OUT_TAG 00082 #define ON_OUT_IN_TAG ON_ON_IN_TAG | ON_OUT_ON_TAG 00083 #define OUT_IN_ON_TAG ON_IN_ON_TAG | OUT_ON_ON_TAG 00084 #define OUT_ON_IN_TAG ON_ON_IN_TAG | OUT_ON_ON_TAG 00085 00086 typedef enum BOP_TAGEnum { 00087 IN = IN_TAG, 00088 ON = ON_TAG, 00089 OUT = OUT_TAG, 00090 INOUT = INOUT_TAG, 00091 INON = INON_TAG, 00092 OUTON = OUTON_TAG, 00093 UNCLASSIFIED = UNCLASSIFIED_TAG, 00094 PHANTOM = PHANTOM_TAG, 00095 OVERLAPPED = OVERLAPPED_TAG, 00096 BROKEN = BROKEN_TAG, 00097 IN_ON_ON = IN_ON_ON_TAG, 00098 ON_IN_ON = ON_IN_ON_TAG, 00099 ON_ON_IN = ON_ON_IN_TAG, 00100 OUT_ON_ON = OUT_ON_ON_TAG, 00101 ON_OUT_ON = ON_OUT_ON_TAG, 00102 ON_ON_OUT = ON_ON_OUT_TAG, 00103 ON_ON_ON = ON_ON_ON_TAG, 00104 IN_IN_IN = IN_IN_IN_TAG, 00105 OUT_OUT_OUT = OUT_OUT_OUT_TAG, 00106 IN_IN_ON = IN_IN_ON_TAG, 00107 IN_ON_IN = IN_ON_IN_TAG, 00108 ON_IN_IN = ON_IN_IN_TAG, 00109 OUT_OUT_ON = OUT_OUT_ON_TAG, 00110 OUT_ON_OUT = OUT_ON_OUT_TAG, 00111 ON_OUT_OUT = ON_OUT_OUT_TAG, 00112 IN_OUT_OUT = IN_OUT_OUT_TAG, 00113 OUT_IN_OUT = OUT_IN_OUT_TAG, 00114 OUT_OUT_IN = OUT_OUT_IN_TAG, 00115 OUT_IN_IN = OUT_IN_IN_TAG, 00116 IN_OUT_IN = IN_OUT_IN_TAG, 00117 IN_IN_OUT = IN_IN_OUT_TAG, 00118 IN_ON_OUT = IN_ON_OUT_TAG, 00119 IN_OUT_ON = IN_OUT_ON_TAG, 00120 ON_IN_OUT = ON_IN_OUT_TAG, 00121 ON_OUT_IN = ON_OUT_IN_TAG, 00122 OUT_IN_ON = OUT_IN_ON_TAG, 00123 OUT_ON_IN = OUT_ON_IN_TAG } BOP_TAG; 00124 00125 inline BOP_TAG BOP_createTAG(BOP_TAG tag1, BOP_TAG tag2, BOP_TAG tag3) 00126 { 00127 return (BOP_TAG) (tag1 << 4 | tag2 << 2 | tag3); 00128 } 00129 00130 inline BOP_TAG BOP_createTAG(int i) 00131 { 00132 return i < 0 ? IN : i > 0 ? OUT : ON; 00133 } 00134 00135 inline BOP_TAG BOP_addON(BOP_TAG tag) 00136 { 00137 return (tag==IN?INON:(tag==OUT?OUTON:tag)); 00138 } 00139 00140 void BOP_stringTAG(BOP_TAG tag, char *dest); 00141 00142 inline bool BOP_compTAG(BOP_TAG tag1, BOP_TAG tag2) 00143 { 00144 return (tag1==tag2) || (BOP_addON(tag1) == BOP_addON(tag2)); 00145 } 00146 00147 #endif