1 #ifndef SLA_SUPPORTPOINT_HPP 2 #define SLA_SUPPORTPOINT_HPP 3 4 #include <libslic3r/Point.hpp> 5 6 namespace Slic3r { namespace sla { 7 8 // An enum to keep track of where the current points on the ModelObject came from. 9 enum class PointsStatus { 10 NoPoints, // No points were generated so far. 11 Generating, // The autogeneration algorithm triggered, but not yet finished. 12 AutoGenerated, // Points were autogenerated (i.e. copied from the backend). 13 UserModified // User has done some edits. 14 }; 15 16 struct SupportPoint 17 { 18 Vec3f pos; 19 float head_front_radius; 20 bool is_new_island; 21 SupportPointSlic3r::sla::SupportPoint22 SupportPoint() 23 : pos(Vec3f::Zero()), head_front_radius(0.f), is_new_island(false) 24 {} 25 SupportPointSlic3r::sla::SupportPoint26 SupportPoint(float pos_x, 27 float pos_y, 28 float pos_z, 29 float head_radius, 30 bool new_island = false) 31 : pos(pos_x, pos_y, pos_z) 32 , head_front_radius(head_radius) 33 , is_new_island(new_island) 34 {} 35 SupportPointSlic3r::sla::SupportPoint36 SupportPoint(Vec3f position, float head_radius, bool new_island = false) 37 : pos(position) 38 , head_front_radius(head_radius) 39 , is_new_island(new_island) 40 {} 41 SupportPointSlic3r::sla::SupportPoint42 SupportPoint(Eigen::Matrix<float, 5, 1, Eigen::DontAlign> data) 43 : pos(data(0), data(1), data(2)) 44 , head_front_radius(data(3)) 45 , is_new_island(data(4) != 0.f) 46 {} 47 operator ==Slic3r::sla::SupportPoint48 bool operator==(const SupportPoint &sp) const 49 { 50 float rdiff = std::abs(head_front_radius - sp.head_front_radius); 51 return (pos == sp.pos) && rdiff < float(EPSILON) && 52 is_new_island == sp.is_new_island; 53 } 54 operator !=Slic3r::sla::SupportPoint55 bool operator!=(const SupportPoint &sp) const { return !(sp == (*this)); } 56 serializeSlic3r::sla::SupportPoint57 template<class Archive> void serialize(Archive &ar) 58 { 59 ar(pos, head_front_radius, is_new_island); 60 } 61 }; 62 63 using SupportPoints = std::vector<SupportPoint>; 64 65 }} // namespace Slic3r::sla 66 67 #endif // SUPPORTPOINT_HPP 68