Facet.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (c) 2007 Werner Mayer <wmayer[at]users.sourceforge.net>     *
00003  *                                                                         *
00004  *   This file is part of the FreeCAD CAx development system.              *
00005  *                                                                         *
00006  *   This library is free software; you can redistribute it and/or         *
00007  *   modify it under the terms of the GNU Library General Public           *
00008  *   License as published by the Free Software Foundation; either          *
00009  *   version 2 of the License, or (at your option) any later version.      *
00010  *                                                                         *
00011  *   This library  is distributed in the hope that it will be useful,      *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU Library General Public License for more details.                  *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Library General Public     *
00017  *   License along with this library; see the file COPYING.LIB. If not,    *
00018  *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
00019  *   Suite 330, Boston, MA  02111-1307, USA                                *
00020  *                                                                         *
00021  ***************************************************************************/
00022 
00023 
00024 #include "PreCompiled.h"
00025 #ifndef _PreComp_
00026 # include <sstream>
00027 #endif
00028 
00029 #include "Facet.h"
00030 #include "Mesh.h"
00031 
00032 using namespace Mesh;
00033 
00034 Facet::Facet(const MeshCore::MeshFacet& face, MeshObject* obj, unsigned long index)
00035   : Index(index), Mesh(obj)
00036 {
00037     for (int i=0; i<3; i++) {
00038         PIndex[i] = face._aulPoints[i];
00039         NIndex[i] = face._aulNeighbours[i];
00040     }
00041     if (Mesh.isValid() && index != ULONG_MAX) {
00042         for (int i=0; i<3; i++) {
00043             Base::Vector3d vert = Mesh->getPoint(PIndex[i]);
00044             _aclPoints[i].Set((float)vert.x, (float)vert.y, (float)vert.z);
00045         }
00046     }
00047 }
00048 
00049 Facet::Facet(const Facet& f)
00050   : MeshCore::MeshGeomFacet(f), Index(f.Index), Mesh(f.Mesh)
00051 {
00052     for (int i=0; i<3; i++) {
00053         PIndex[i] = f.PIndex[i];
00054         NIndex[i] = f.NIndex[i];
00055     }
00056 }
00057 
00058 Facet::~Facet()
00059 {
00060 }
00061 
00062 void Facet::operator = (const Facet& f)
00063 {
00064     MeshCore::MeshGeomFacet::operator = (f);
00065     Mesh  = f.Mesh;
00066     Index = f.Index;
00067     for (int i=0; i<3; i++) {
00068         PIndex[i] = f.PIndex[i];
00069         NIndex[i] = f.NIndex[i];
00070     }
00071 }

Generated on Wed Nov 23 19:00:11 2011 for FreeCAD by  doxygen 1.6.1