GASP/GASP_Code
6
1
Fork
You've already forked GASP_Code
4

Arc Definition Suggestion #12

Closed
opened 2021年04月09日 05:20:20 +02:00 by RichardMartinez · 1 comment

In the current version of GASP, the Arc class is defined as so:

>>> Arc(position, radius, start_angle, end_angle)

My interpretation of this was that the arc would start and end at those angles (hence the name). For example:

>>> Arc((300, 200), 100, 90, 180)

would produce an arc as shown in the first image below. The arc starts at 90 degrees and ends at 180 degrees for a total of 90 degrees travelled by the arc. (Image 1)

However, this line when run produces an arc that starts at 90 degrees but then travels for 180 degrees total. (Image 2)

In my interpretation, Image 2 would instead be created by:

>>> Arc((300, 200), 100, 90, 270)

This would create an arc that starts at 90 degrees (straight up) and ends at 270 degrees (straight down). Maybe the class is intended to work this way, but to my math oriented brain, "start angle" and "end angle" mean just that: where the arc starts and where it ends.

This would be a relatively easy fix. After some thinking and tinkering around in the gasp module, I found the fix. On this line of gasp.py, replace:

extent=end_angle,

with:

extent=end_angle-start_angle,

This makes the class work the way I expected. I assumed correctly that "extent" meant how far the arc should travel. By subtracting off the start angle, the arc instead ends at the given angle rather than travelling that far. Of course if the previous functionally is meant to stay intact, maybe it could become an option?

Hope this helps.

In the current version of GASP, the Arc class is defined as so: `>>> Arc(position, radius, start_angle, end_angle)` My interpretation of this was that the arc would start and end at those angles (hence the name). For example: `>>> Arc((300, 200), 100, 90, 180)` would produce an arc as shown in the first image below. The arc starts at 90 degrees and ends at 180 degrees for a total of 90 degrees travelled by the arc. (Image 1) However, this line when run produces an arc that starts at 90 degrees but then travels for 180 degrees total. (Image 2) In my interpretation, Image 2 would instead be created by: `>>> Arc((300, 200), 100, 90, 270)` This would create an arc that starts at 90 degrees (straight up) and ends at 270 degrees (straight down). Maybe the class is intended to work this way, but to my math oriented brain, "start angle" and "end angle" mean just that: where the arc starts and where it ends. This would be a relatively easy fix. After some thinking and tinkering around in the gasp module, I found the fix. On [this](https://codeberg.org/GASP/GASP_Tkinter/src/branch/main/gasp/gasp.py#L262) line of gasp.py, replace: `extent=end_angle,` with: `extent=end_angle-start_angle,` This makes the class work the way I expected. I assumed correctly that "extent" meant how far the arc should travel. By subtracting off the start angle, the arc instead ends at the given angle rather than travelling that far. Of course if the previous functionally is meant to stay intact, maybe it could become an option? Hope this helps.

yeah we can do that if you want it

yeah we can do that if you want it
Sign in to join this conversation.
No Branch/Tag specified
main
No results found.
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
GASP/GASP_Code#12
Reference in a new issue
GASP/GASP_Code
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?