OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::Arachne::STHalfEdge Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/Arachne/SkeletalTrapezoidationGraph.hpp>

Inheritance diagram for Slic3r::Arachne::STHalfEdge:
Collaboration diagram for Slic3r::Arachne::STHalfEdge:

Public Member Functions

 STHalfEdge (SkeletalTrapezoidationEdge data)
bool canGoUp (bool strict=false) const
bool isUpward () const
std::optional< coord_t > distToGoUp () const
STHalfEdge * getNextUnconnected ()
bool operator== (const edge_t &other)

Public Attributes

SkeletalTrapezoidationEdge data
edge_t * twin
edge_t * next
edge_t * prev
node_t * from
node_t * to

Private Types

using edge_t = STHalfEdge
using node_t = STHalfEdgeNode

Detailed Description

Member Typedef Documentation

◆ edge_t

◆ node_t

Constructor & Destructor Documentation

◆ STHalfEdge()

Slic3r::Arachne::STHalfEdge::STHalfEdge ( SkeletalTrapezoidationEdge data)

References Slic3r::Arachne::HalfEdge< SkeletalTrapezoidationJoint, SkeletalTrapezoidationEdge, STHalfEdgeNode, STHalfEdge >::HalfEdge(), and Slic3r::Arachne::HalfEdge< SkeletalTrapezoidationJoint, SkeletalTrapezoidationEdge, STHalfEdgeNode, STHalfEdge >::data.

Referenced by getNextUnconnected().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ canGoUp()

bool Slic3r::Arachne::STHalfEdge::canGoUp ( bool strict = false) const

Check (recursively) whether there is any upward edge from the distance_to_boundary of the from of the

Parameters
edge
strictWhether equidistant edges can count as a local maximum
30{
31 if (to->data.distance_to_boundary > from->data.distance_to_boundary)
32 {
33 return true;
34 }
35 if (to->data.distance_to_boundary < from->data.distance_to_boundary || strict)
36 {
37 return false;
38 }
39
40 // Edge is between equidistqant verts; recurse!
41 for (edge_t* outgoing = next; outgoing != twin; outgoing = outgoing->twin->next)
42 {
43 if (outgoing->canGoUp())
44 {
45 return true;
46 }
47 assert(outgoing->twin); if (!outgoing->twin) return false;
48 assert(outgoing->twin->next); if (!outgoing->twin->next) return true; // This point is on the boundary?! Should never occur
49 }
50 return false;
51}
STHalfEdge edge_t
Definition SkeletalTrapezoidationGraph.hpp:30

References Slic3r::Arachne::HalfEdge< SkeletalTrapezoidationJoint, SkeletalTrapezoidationEdge, STHalfEdgeNode, STHalfEdge >::from, Slic3r::Arachne::HalfEdge< SkeletalTrapezoidationJoint, SkeletalTrapezoidationEdge, STHalfEdgeNode, STHalfEdge >::next, Slic3r::Arachne::HalfEdge< SkeletalTrapezoidationJoint, SkeletalTrapezoidationEdge, STHalfEdgeNode, STHalfEdge >::to, and Slic3r::Arachne::HalfEdge< SkeletalTrapezoidationJoint, SkeletalTrapezoidationEdge, STHalfEdgeNode, STHalfEdge >::twin.

Referenced by Slic3r::Arachne::STHalfEdgeNode::isLocalMaximum().

Here is the caller graph for this function:

◆ distToGoUp()

std::optional< coord_t > Slic3r::Arachne::STHalfEdge::distToGoUp ( ) const

Calculate the traversed distance until we meet an upward edge. Useful for calling on edges between equidistant points.

If we can go up then the distance includes the length of the

Parameters
edge
85{
86 if (to->data.distance_to_boundary > from->data.distance_to_boundary)
87 {
88 return 0;
89 }
90 if (to->data.distance_to_boundary < from->data.distance_to_boundary)
91 {
92 return std::optional<coord_t>();
93 }
94
95 // Edge is between equidistqant verts; recurse!
96 std::optional<coord_t> ret;
97 for (edge_t* outgoing = next; outgoing != twin; outgoing = outgoing->twin->next)
98 {
99 std::optional<coord_t> dist_to_up = outgoing->distToGoUp();
100 if (dist_to_up)
101 {
102 if (ret)
103 {
104 ret = std::min(*ret, *dist_to_up);
105 }
106 else
107 {
108 ret = dist_to_up;
109 }
110 }
111 assert(outgoing->twin); if (!outgoing->twin) return std::optional<coord_t>();
112 assert(outgoing->twin->next); if (!outgoing->twin->next) return 0; // This point is on the boundary?! Should never occur
113 }
114 if (ret)
115 {
116 ret = *ret + (to->p - from->p).cast<int64_t>().norm();
117 }
118 return ret;
119}
auto cast(const BoundingBoxBase< Tin > &b)
Definition BoundingBox.hpp:299

References Slic3r::cast(), Slic3r::Arachne::HalfEdge< SkeletalTrapezoidationJoint, SkeletalTrapezoidationEdge, STHalfEdgeNode, STHalfEdge >::from, Slic3r::Arachne::HalfEdge< SkeletalTrapezoidationJoint, SkeletalTrapezoidationEdge, STHalfEdgeNode, STHalfEdge >::next, Slic3r::Arachne::HalfEdge< SkeletalTrapezoidationJoint, SkeletalTrapezoidationEdge, STHalfEdgeNode, STHalfEdge >::to, and Slic3r::Arachne::HalfEdge< SkeletalTrapezoidationJoint, SkeletalTrapezoidationEdge, STHalfEdgeNode, STHalfEdge >::twin.

Referenced by isUpward().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getNextUnconnected()

STHalfEdge * Slic3r::Arachne::STHalfEdge::getNextUnconnected ( )
122{
123 edge_t* result = static_cast<STHalfEdge*>(this);
124 while (result->next)
125 {
126 result = result->next;
127 if (result == this)
128 {
129 return nullptr;
130 }
131 }
132 return result->twin;
133}
STHalfEdge(SkeletalTrapezoidationEdge data)
Definition SkeletalTrapezoidationGraph.cpp:27

References STHalfEdge(), Slic3r::Arachne::HalfEdge< node_data_t, edge_data_t, derived_node_t, derived_edge_t >::next, and Slic3r::Arachne::HalfEdge< node_data_t, edge_data_t, derived_node_t, derived_edge_t >::twin.

Referenced by Slic3r::Arachne::SkeletalTrapezoidation::connectJunctions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isUpward()

bool Slic3r::Arachne::STHalfEdge::isUpward ( ) const

Check whether the edge goes from a lower to a higher distance_to_boundary. Effectively deals with equidistant edges by looking beyond this edge.

54{
55 if (to->data.distance_to_boundary > from->data.distance_to_boundary)
56 {
57 return true;
58 }
59 if (to->data.distance_to_boundary < from->data.distance_to_boundary)
60 {
61 return false;
62 }
63
64 // Equidistant edge case:
65 std::optional<coord_t> forward_up_dist = this->distToGoUp();
66 std::optional<coord_t> backward_up_dist = twin->distToGoUp();
67 if (forward_up_dist && backward_up_dist)
68 {
69 return forward_up_dist < backward_up_dist;
70 }
71
72 if (forward_up_dist)
73 {
74 return true;
75 }
76
77 if (backward_up_dist)
78 {
79 return false;
80 }
81 return to->p < from->p; // Arbitrary ordering, which returns the opposite for the twin edge
82}
std::optional< coord_t > distToGoUp() const
Definition SkeletalTrapezoidationGraph.cpp:84

References distToGoUp(), Slic3r::Arachne::HalfEdge< SkeletalTrapezoidationJoint, SkeletalTrapezoidationEdge, STHalfEdgeNode, STHalfEdge >::from, Slic3r::Arachne::HalfEdge< SkeletalTrapezoidationJoint, SkeletalTrapezoidationEdge, STHalfEdgeNode, STHalfEdge >::to, and Slic3r::Arachne::HalfEdge< SkeletalTrapezoidationJoint, SkeletalTrapezoidationEdge, STHalfEdgeNode, STHalfEdge >::twin.

Referenced by Slic3r::Arachne::SkeletalTrapezoidation::generateSegments(), and Slic3r::Arachne::SkeletalTrapezoidation::generateTransitionEnd().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator==()

33 {
34 return this == &other;
35 }
Definition HalfEdge.hpp:19

Member Data Documentation

◆ data

◆ from

◆ next

◆ prev

◆ to

◆ twin


The documentation for this class was generated from the following files: