1
/***************************************************************************
2
* Copyright (c) 2007 Werner Mayer <wmayer[at]users.sourceforge.net> *
4
* This file is part of the FreeCAD CAx development system. *
6
* This library is free software; you can redistribute it and/or *
7
* modify it under the terms of the GNU Library General Public *
8
* License as published by the Free Software Foundation; either *
9
* version 2 of the License, or (at your option) any later version. *
11
* This library is distributed in the hope that it will be useful, *
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14
* GNU Library General Public License for more details. *
16
* You should have received a copy of the GNU Library General Public *
17
* License along with this library; see the file COPYING.LIB. If not, *
18
* write to the Free Software Foundation, Inc., 59 Temple Place, *
19
* Suite 330, Boston, MA 02111-1307, USA *
21
***************************************************************************/
23
#include "PreCompiled.h"
34
Facet::Facet(const MeshCore::MeshFacet& face, // NOLINT
35
const MeshObject* obj,
36
MeshCore::FacetIndex index)
40
for (int i = 0; i < 3; i++) {
41
PIndex[i] = face._aulPoints[i];
42
NIndex[i] = face._aulNeighbours[i];
44
if (Mesh.isValid() && index != MeshCore::FACET_INDEX_MAX) {
45
for (int i = 0; i < 3; i++) {
46
Base::Vector3d vert = Mesh->getPoint(PIndex[i]);
47
_aclPoints[i].Set((float)vert.x, (float)vert.y, (float)vert.z);
52
Facet::Facet(const Facet& f) // NOLINT
53
: MeshCore::MeshGeomFacet(f)
57
for (int i = 0; i < 3; i++) {
58
PIndex[i] = f.PIndex[i];
59
NIndex[i] = f.NIndex[i];
63
Facet::Facet(Facet&& f) // NOLINT
64
: MeshCore::MeshGeomFacet(f)
68
for (int i = 0; i < 3; i++) {
69
PIndex[i] = f.PIndex[i];
70
NIndex[i] = f.NIndex[i];
74
Facet::~Facet() = default;
76
Facet& Facet::operator=(const Facet& f)
78
MeshCore::MeshGeomFacet::operator=(f);
81
for (int i = 0; i < 3; i++) {
82
PIndex[i] = f.PIndex[i];
83
NIndex[i] = f.NIndex[i];
89
Facet& Facet::operator=(Facet&& f)
91
MeshCore::MeshGeomFacet::operator=(f);
94
for (int i = 0; i < 3; i++) {
95
PIndex[i] = f.PIndex[i];
96
NIndex[i] = f.NIndex[i];
102
Edge Facet::getEdge(int index) const
106
// geometric coordinates
107
edge._aclPoints[0] = this->_aclPoints[index];
108
edge._aclPoints[1] = this->_aclPoints[(index + 1) % 3];
112
edge.PIndex[0] = this->PIndex[index];
113
edge.PIndex[1] = this->PIndex[(index + 1) % 3];
114
edge.NIndex[0] = this->Index;
115
edge.NIndex[1] = this->NIndex[index];
116
edge._bBorder = (this->NIndex[index] == MeshCore::FACET_INDEX_MAX);
118
edge.Mesh = this->Mesh;