/usr/include/Savitar/MeshData.h is in libsavitar-dev 3.1.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | /*
* This file is part of libSavitar
*
* Copyright (C) 2017 Ultimaker b.v. <j.vankessel@ultimaker.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MESHDATA_H
#define MESHDATA_H
#include "SavitarExport.h"
#include <vector>
#include <string>
#include <cstdint>
#include "Types.h"
#include "Vertex.h"
#include "Face.h"
// Forward declarations
namespace pugi
{
class xml_node;
}
namespace Savitar
{
class SAVITAR_EXPORT MeshData
{
public:
/**
* MeshData holds all data regarding a mesh (vertices, faces, etc).
* It can be filled by means of a byte array by using setVerticesFromBytes or setFacesFromBytes.
*/
MeshData();
virtual ~MeshData();
/**
* Set the data of this MeshData by giving it a xml node (An object node in 3mf)
*/
void fillByXMLNode(pugi::xml_node xml_node);
/**
* Serialise the meshData to xml_node
*/
void toXmlNode(pugi::xml_node& xml_node);
/**
* Return the vertices as flattend bytes.
*
* If there for example is a single vertex, it will return a byte array containing 3 floats (so 3 * 4 bytes)
*/
bytearray getVerticesAsBytes();
/**
* Return the faces as flattend bytes.
*
* If there for example is a single face, it will return a byte array containing 3 ints (so 3 * 4 bytes)
*/
bytearray getFacesAsBytes();
/**
* Instead of getting all unique vertices, this function returns a bytearray with 3 vertices per face.
* This is usefull if you want to mimic the data type of STL files.
*/
bytearray getFlatVerticesAsBytes();
/**
* Set the vertices of the meshdata by bytearray (as set from python)
*
* For every vertex it's assumed that there are 12 bytes (3 floats * 4).
*/
void setVerticesFromBytes(const bytearray& data);
/**
* Set the faces of the meshdata by bytearray (as set from python)
*
* For every face it's assumed that there are 12 bytes (3 int * 4).
*/
void setFacesFromBytes(const bytearray& data);
std::vector<Vertex> getVertices();
/**
* Reset the data of the MeshData object.
*/
void clear();
protected:
std::vector<Vertex> vertices;
std::vector<Face> faces;
};
}
#endif
|