Blender V2.61 - r43446

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