Skip to content

Commit

Permalink
Added Rotation Angle to Graph.Show. Bumped to v0.7.69
Browse files Browse the repository at this point in the history
Added an angle to Graph.Show and Plotly.DataByGraph to rotate the arc when sagitta is not 0.
Bumped to version 0.7.69
  • Loading branch information
wassimj committed Oct 25, 2024
1 parent af25d8f commit 6d7d3f8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/topologicpy/Graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -7845,6 +7845,7 @@ def Show(graph,
sagitta = 0,
absolute = False,
sides = 8,
angle = 0,
vertexColor="black",
vertexSize=6,
vertexLabelKey=None,
Expand Down Expand Up @@ -7893,6 +7894,8 @@ def Show(graph,
For example, if the length of the edge is 10, the sagitta is set to 0.5, and absolute is set to False, the sagitta length will be 5. The default is True.
sides : int , optional
The number of sides of the arc. The default is 8.
angle : float, optional
An additional angle in degrees to rotate arcs (where sagitta is more than 0). The default is 0.
vertexColor : str , optional
The desired color of the output vertices. This can be any plotly color string and may be specified as:
- A hex string (e.g. '#ff0000')
Expand Down Expand Up @@ -7994,7 +7997,7 @@ def Show(graph,
print("Graph.Show - Error: The input graph is not a valid graph. Returning None.")
return None

data= Plotly.DataByGraph(graph, sagitta=sagitta, absolute=absolute, sides=sides, vertexColor=vertexColor, vertexSize=vertexSize, vertexLabelKey=vertexLabelKey, vertexGroupKey=vertexGroupKey, vertexGroups=vertexGroups, showVertices=showVertices, showVertexLabels=showVertexLabels, showVertexLegend=showVertexLegend, edgeColor=edgeColor, edgeWidth=edgeWidth, edgeLabelKey=edgeLabelKey, edgeGroupKey=edgeGroupKey, edgeGroups=edgeGroups, showEdges=showEdges, showEdgeLabels=showEdgeLabels, showEdgeLegend=showEdgeLegend, colorScale=colorScale, silent=silent)
data= Plotly.DataByGraph(graph, sagitta=sagitta, absolute=absolute, sides=sides, angle=angle, vertexColor=vertexColor, vertexSize=vertexSize, vertexLabelKey=vertexLabelKey, vertexGroupKey=vertexGroupKey, vertexGroups=vertexGroups, showVertices=showVertices, showVertexLabels=showVertexLabels, showVertexLegend=showVertexLegend, edgeColor=edgeColor, edgeWidth=edgeWidth, edgeLabelKey=edgeLabelKey, edgeGroupKey=edgeGroupKey, edgeGroups=edgeGroups, showEdges=showEdges, showEdgeLabels=showEdgeLabels, showEdgeLegend=showEdgeLegend, colorScale=colorScale, silent=silent)
fig = Plotly.FigureByData(data, width=width, height=height, xAxis=xAxis, yAxis=yAxis, zAxis=zAxis, axisSize=axisSize, backgroundColor=backgroundColor,
marginLeft=marginLeft, marginRight=marginRight, marginTop=marginTop, marginBottom=marginBottom, tolerance=tolerance)
Plotly.Show(fig, renderer=renderer, camera=camera, center=center, up=up, projection=projection)
Expand Down
4 changes: 4 additions & 0 deletions src/topologicpy/Plotly.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ def DataByGraph(graph,
sagitta: float = 0,
absolute: bool = False,
sides: int = 8,
angle: float = 0,
vertexColor: str = "black",
vertexSize: float = 6,
vertexLabelKey: str = None,
Expand Down Expand Up @@ -454,6 +455,9 @@ def DataByGraph(graph,
d = Topology.Dictionary(edge)
arc = Wire.ArcByEdge(edge, sagitta=sagitta, absolute=absolute, sides=sides, close=False, silent=silent)
if Topology.IsInstance(arc, "Wire"):
if not angle == 0:
direc = Edge.Direction(edge)
arc = Topology.Rotate(arc, origin=Topology.Centroid(edge), axis=direc, angle=angle)
arc_edges = Topology.Edges(arc)
for arc_edge in arc_edges:
arc_edge = Topology.SetDictionary(arc_edge, d, silent=True)
Expand Down
2 changes: 1 addition & 1 deletion src/topologicpy/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.7.68'
__version__ = '0.7.69'

0 comments on commit 6d7d3f8

Please sign in to comment.