2
* ***** BEGIN GPL LICENSE BLOCK *****
4
* This program is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU General Public License
6
* as published by the Free Software Foundation; either version 2
7
* of the License, or (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software Foundation,
16
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19
* All rights reserved.
21
* The Original Code is: all of this file.
23
* Contributor(s): none yet.
25
* ***** END GPL LICENSE BLOCK *****
28
/** \file boolop/intern/BOP_Splitter.cpp
29
* \ingroup boolopintern
33
#include "BOP_Splitter.h"
39
* Returns the split point resulting from intersect a plane and a mesh face
40
* according to its specified relative edge.
41
* @param plane split plane
44
* @param e relative edge index
45
* @return intersection point
47
MT_Point3 BOP_splitEdge(MT_Plane3 plane, BOP_Mesh *m, BOP_Face *f, unsigned int e)
65
// wrong relative edge index!
69
MT_Point3 p1 = m->getVertex(v1)->getPoint();
70
MT_Point3 p2 = m->getVertex(v2)->getPoint();
71
return BOP_intersectPlane(plane,p1,p2);
75
* Returns the segment resulting from intersect a plane and a mesh face.
76
* @param plane split plane
79
* @return segment if there is intersection, NULL otherwise
81
BOP_Segment BOP_splitFace(MT_Plane3 plane, BOP_Mesh *m, BOP_Face *f)
83
BOP_Vertex *v1 = m->getVertex(f->getVertex(0));
84
BOP_Vertex *v2 = m->getVertex(f->getVertex(1));
85
BOP_Vertex *v3 = m->getVertex(f->getVertex(2));
87
// Classify face vertices
88
BOP_TAG tag1 = BOP_createTAG(BOP_classify(v1->getPoint(),plane));
89
BOP_TAG tag2 = BOP_createTAG(BOP_classify(v2->getPoint(),plane));
90
BOP_TAG tag3 = BOP_createTAG(BOP_classify(v3->getPoint(),plane));
92
// Classify face according to its vertices classification
93
BOP_TAG tag = BOP_createTAG(tag1,tag2,tag3);
101
s.m_cfg1 = s.m_cfg2 = BOP_Segment::createUndefinedCfg();
106
s.m_v1 = f->getVertex(0);
107
s.m_cfg1 = BOP_Segment::createVertexCfg(1);
108
s.m_cfg2 = BOP_Segment::createUndefinedCfg();
113
s.m_v1 = f->getVertex(1);
114
s.m_cfg1 = BOP_Segment::createVertexCfg(2);
115
s.m_cfg2 = BOP_Segment::createUndefinedCfg();
120
s.m_v1 = f->getVertex(2);
121
s.m_cfg1 = BOP_Segment::createVertexCfg(3);
122
s.m_cfg2 = BOP_Segment::createUndefinedCfg();
127
s.m_v1 = f->getVertex(0);
128
s.m_v2 = f->getVertex(1);
129
s.m_cfg1 = BOP_Segment::createVertexCfg(1);
130
s.m_cfg2 = BOP_Segment::createVertexCfg(2);
135
s.m_v1 = f->getVertex(0);
136
s.m_v2 = f->getVertex(2);
137
s.m_cfg1 = BOP_Segment::createVertexCfg(1);
138
s.m_cfg2 = BOP_Segment::createVertexCfg(3);
143
s.m_v1 = f->getVertex(1);
144
s.m_v2 = f->getVertex(2);
145
s.m_cfg1 = BOP_Segment::createVertexCfg(2);
146
s.m_cfg2 = BOP_Segment::createVertexCfg(3);
151
s.m_v2 = f->getVertex(2);
152
s.m_cfg1 = BOP_Segment::createEdgeCfg(1);
153
s.m_cfg2 = BOP_Segment::createVertexCfg(3);
158
s.m_v1 = f->getVertex(1);
159
s.m_cfg1 = BOP_Segment::createVertexCfg(2);
160
s.m_cfg2 = BOP_Segment::createEdgeCfg(3);
165
s.m_v1 = f->getVertex(0);
166
s.m_cfg1 = BOP_Segment::createVertexCfg(1);
167
s.m_cfg2 = BOP_Segment::createEdgeCfg(2);
172
s.m_cfg1 = BOP_Segment::createEdgeCfg(1);
173
s.m_cfg2 = BOP_Segment::createEdgeCfg(3);
178
s.m_cfg1 = BOP_Segment::createEdgeCfg(1);
179
s.m_cfg2 = BOP_Segment::createEdgeCfg(2);
184
s.m_cfg1 = BOP_Segment::createEdgeCfg(2);
185
s.m_cfg2 = BOP_Segment::createEdgeCfg(3);