-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSlicing.hh
36 lines (32 loc) · 856 Bytes
/
Slicing.hh
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
#pragma once
/*
@author: Xinqi Bao
With a particular z, get lines from triangles at this position.
Then make loops from the pool of intersections, store the result into layer object.
*/
#include <vector>
#include "Triangle.hh"
#include "Cross.hh"
#include "Loop.hh"
#include "STL.hh"
#include "GCode.hh"
class Slicing {
private:
double z;
std::vector<Loop>& loops;
std::vector<Triangle>& triangles;
std::vector<Cross> intersections;
bool isCross(const Vec3d& v_1, const Vec3d& v_2) const;
bool isSectionExist(Cross& cr) const;
void intersection();
void mkLoop();
public:
Slicing(Stl* stl, Layer* layer) :Slicing(*stl, *layer) {}
Slicing(Stl& stl, Layer& layer) :z(layer.getZ()), loops(layer.getLoops()), triangles(stl.getLevel(z)) {
intersection();
mkLoop();
Gcode g(layer);
}
void printVector() const;
void printLoop() const;
};