Skip to content

Commit

Permalink
Merge pull request #3617 from t20100/fix-arcroi
Browse files Browse the repository at this point in the history
silx.gui.plot: Fixed arc roi display
  • Loading branch information
vallsv authored Apr 8, 2022
2 parents 0dddd8f + e27cf98 commit 0a8e3bc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/silx/gui/plot/items/_arc_roi.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8
# /*##########################################################################
#
# Copyright (c) 2018-2021 European Synchrotron Radiation Facility
# Copyright (c) 2018-2022 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -635,7 +635,9 @@ def _createShapeFromGeometry(self, geometry):
innerRadius = geometry.radius - geometry.weight * 0.5
outerRadius = geometry.radius + geometry.weight * 0.5

delta = 0.1 if geometry.endAngle >= geometry.startAngle else -0.1
sign = numpy.sign(geometry.endAngle - geometry.startAngle)
delta = min(0.1, abs(geometry.startAngle - geometry.endAngle) / 100) * sign

if geometry.startAngle == geometry.endAngle:
# Degenerated, it's a line (single radius)
angle = geometry.startAngle
Expand All @@ -654,7 +656,6 @@ def _createShapeFromGeometry(self, geometry):
points = []
points.append(geometry.center)
points.append(geometry.startPoint)
delta = 0.1 if geometry.endAngle >= geometry.startAngle else -0.1
for angle in angles:
direction = numpy.array([numpy.cos(angle), numpy.sin(angle)])
points.append(geometry.center + direction * outerRadius)
Expand Down

0 comments on commit 0a8e3bc

Please sign in to comment.