-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Clipping] Fixing issue with edge-vertex tolerance detection
- Loading branch information
Showing
6 changed files
with
79 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import Geometria | ||
import GeometriaClipping | ||
import MiniGraphviz | ||
|
||
extension GraphViz { | ||
static func printGraph<Vector>(_ graph: Simplex2Graph<Vector>) where Vector.Scalar: CustomStringConvertible { | ||
let nodes = graph.nodes | ||
let edges = graph.edges | ||
|
||
let graph = GraphViz() | ||
|
||
for node in nodes { | ||
graph.createNode(label: "\(node.id)") | ||
} | ||
|
||
for edge in edges { | ||
let label: String | ||
switch edge.kind { | ||
case .line: | ||
label = "line" | ||
case .circleArc(_, _, _, let sweepAngle): | ||
label = "arc (\(sweepAngle.degrees)°)" | ||
} | ||
graph.addConnection(fromLabel: "\(edge.start.id)", toLabel: "\(edge.end.id)", label: label) | ||
} | ||
|
||
print(graph.generateFile()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters