Fixed a 64bit compatiblity in admesh, fixed a typo in TriangleMesh::swap()

Conflicts:

	xs/src/libslic3r/TriangleMesh.cpp
This commit is contained in:
bubnikv 2016-11-15 17:22:00 +01:00 committed by Alessandro Ranellucci
parent 9ed127274e
commit 497b7fb6c4
3 changed files with 13 additions and 5 deletions

View File

@ -24,6 +24,7 @@
#define __admesh_stl__ #define __admesh_stl__
#include <stdio.h> #include <stdio.h>
#include <stdint.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -33,11 +34,15 @@ extern "C" {
#define STL_MIN(A,B) ((A)<(B)? (A):(B)) #define STL_MIN(A,B) ((A)<(B)? (A):(B))
#define ABS(X) ((X) < 0 ? -(X) : (X)) #define ABS(X) ((X) < 0 ? -(X) : (X))
// Size of the binary STL header, free form.
#define LABEL_SIZE 80 #define LABEL_SIZE 80
// Binary STL, length of the "number of faces" counter.
#define NUM_FACET_SIZE 4 #define NUM_FACET_SIZE 4
// Binary STL, sizeof header + number of faces.
#define HEADER_SIZE 84 #define HEADER_SIZE 84
#define STL_MIN_FILE_SIZE 284 #define STL_MIN_FILE_SIZE 284
#define ASCII_LINES_PER_FACET 7 #define ASCII_LINES_PER_FACET 7
// Comparing an edge by memcmp, 2x3x4 bytes = 24
#define SIZEOF_EDGE_SORT 24 #define SIZEOF_EDGE_SORT 24
typedef struct { typedef struct {
@ -70,14 +75,17 @@ typedef struct {
} stl_edge; } stl_edge;
typedef struct stl_hash_edge { typedef struct stl_hash_edge {
unsigned key[6]; // Key of a hash edge: 2x binary copy of a floating point vertex.
uint32_t key[6];
int facet_number; int facet_number;
int which_edge; int which_edge;
struct stl_hash_edge *next; struct stl_hash_edge *next;
} stl_hash_edge; } stl_hash_edge;
typedef struct { typedef struct {
// Index of a neighbor facet.
int neighbor[3]; int neighbor[3];
// Index of an opposite vertex at the neighbor face.
char which_vertex_not[3]; char which_vertex_not[3];
} stl_neighbors; } stl_neighbors;

View File

@ -55,10 +55,10 @@ TriangleMesh& TriangleMesh::operator= (TriangleMesh other)
} }
void void
TriangleMesh::swap(TriangleMesh &first, TriangleMesh &second) TriangleMesh::swap(TriangleMesh &other)
{ {
std::swap(first.repaired, second.repaired); std::swap(this->stl, other.stl);
std::swap(first.stl, second.stl); std::swap(this->repaired, other.repaired);
} }
TriangleMesh::~TriangleMesh() { TriangleMesh::~TriangleMesh() {

View File

@ -22,7 +22,7 @@ class TriangleMesh
TriangleMesh(); TriangleMesh();
TriangleMesh(const TriangleMesh &other); TriangleMesh(const TriangleMesh &other);
TriangleMesh& operator= (TriangleMesh other); TriangleMesh& operator= (TriangleMesh other);
void swap(TriangleMesh &first, TriangleMesh &second); void swap(TriangleMesh &other);
~TriangleMesh(); ~TriangleMesh();
void ReadSTLFile(const std::string &input_file); void ReadSTLFile(const std::string &input_file);
void write_ascii(const std::string &output_file); void write_ascii(const std::string &output_file);