Blender  V2.59
BOP_Segment.h
Go to the documentation of this file.
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 #ifndef BOP_SEGMENT_H
00034 #define BOP_SEGMENT_H
00035 
00036 #include "BOP_Indexs.h"
00037 #include <iostream>
00038 using namespace std;
00039 
00040 class BOP_Segment
00041 {
00042 private:
00043         int getEdgeBetween(unsigned int v1, unsigned int v2);
00044         bool isOnEdge(unsigned int v, unsigned int e);
00045 
00046 public:
00047         // Cfg : Configuration of the vertices
00048         // Values:
00049         //         20 IN,
00050         //         1X Intersected edge X{1,2,3} of the face,
00051         //         0X Coincident vertice X{1,2,3} of the face,
00052         //         0 otherwise
00053         unsigned int m_cfg1, m_cfg2; 
00054         BOP_Index m_v1, m_v2;     // if cfgX >0, vX is the vertice index of the face
00055         BOP_Segment();
00056 
00057         static bool isIn(unsigned int cfg);
00058         static bool isEdge(unsigned int cfg);
00059         static bool isVertex(unsigned int cfg);
00060         static bool isDefined(unsigned int cfg);
00061         static bool isUndefined(unsigned int cfg);
00062         static unsigned int getEdge(unsigned int cfg);
00063         static BOP_Index getVertex(unsigned int cfg);
00064         static unsigned int createEdgeCfg(unsigned int edge);
00065         static unsigned int createVertexCfg(BOP_Index vertex);
00066         static unsigned int createInCfg();
00067         static unsigned int createUndefinedCfg();
00068         void invert();  
00069         void sort();
00070         unsigned int getConfig();
00071 
00072         friend   ostream &operator<<(ostream &stream, const BOP_Segment &c);
00073 };
00074 
00075 #endif