## Radial Menu lines are acting odd.

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
JJSax
Prole
Posts: 8
Joined: Fri Apr 04, 2014 3:59 am

### Radial Menu lines are acting odd.

I'm in the early stages of making a radial menu and I'm having some weird lines out of my circle and can't figure out why. What is going on with this code to cause the lines. Also 6 segments and above has a missing section. I'm sure I could figure that one out but if you fix it in the process I wouldn't complain. I'll post my segment functions below.

segments: 2, 4, 6*, 10 and more after that have the weird line.
segment 6 also is having a wierd issue with the background segment not matching perfectly too.

Thank you in advance.

Code: Select all

function drawFillSegment(segments, x, y, radius)
love.graphics.setLineStyle("smooth")
local p2 = math.pi*2
local slice = p2 / segments
for i = 1, segments do
love.graphics.arc("fill", x, y, radius, p2 * slice, slice * i)
end
end

function drawLineSegments(segments, x, y, radius)
love.graphics.setLineStyle("smooth")
local p2 = math.pi*2
local slice = p2 / segments
for i = 1, segments do
love.graphics.arc("line", x, y, radius, p2 + slice, slice * i)
end
end

Attachments
temp.love
(7.44 KiB) Downloaded 62 times

pgimeno
Party member
Posts: 1686
Joined: Sun Oct 18, 2015 2:58 pm

### Re: Radial Menu lines are acting odd.

There's an issue with the miter line mode. Try love.graphics.setLineJoin to correct it. Basically, in miter line join mode, the outer edges of the lines are extended until they join, but in your case they are nearly parallel, that's why they extend out of the screen.

The other issue is a typo in your code. In the filling formula you're using p2 * slice where it should be p2 + slice.

JJSax
Prole
Posts: 8
Joined: Fri Apr 04, 2014 3:59 am

### Re: Radial Menu lines are acting odd.

pgimeno wrote:
Sun Jun 23, 2019 10:45 pm
There's an issue with the miter line mode. Try love.graphics.setLineJoin to correct it. Basically, in miter line join mode, the outer edges of the lines are extended until they join, but in your case they are nearly parallel, that's why they extend out of the screen.

The other issue is a typo in your code. In the filling formula you're using p2 * slice where it should be p2 + slice.
That works perfectly actually. Thank you for your help! It makes a lot of sense.

### Who is online

Users browsing this forum: No registered users and 6 guests