Skip to content

Conversation

@Denneisk
Copy link
Member

Fixes a bug with EGP CircleOutlines where the dot product could be >0.999 and <=1, causing the function to skip calculating every segment but the last.

As far as I can tell, having these so imprecise isn't actually necessary.

@Denneisk Denneisk changed the title Increase precision of dot bounds check Increase precision of dot bounds check in EGP:DrawPath Nov 19, 2024
Copy link
Contributor

@thegrb93 thegrb93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change the comparators to >= and <=? Also move the local scaling calculation?

if dot >= 1 then
    ...
elseif dot <= -1 then
    ...
else
    local scaling = size*math.tan(math.acos(dot)/2)
    if dir.x*-lastdir.y + dir.y*lastdir.x > 0 then
        ...
    else
        ...
    end
end

Minor optimization
@Denneisk
Copy link
Member Author

The function works fine at +/-1 but I'll oblige in case there's some weird precision issue.

@thegrb93
Copy link
Contributor

The function works fine at +/-1 but I'll oblige in case there's some weird precision issue.

It's supposed to take the simpler branch though as an optimization.

@thegrb93 thegrb93 merged commit 6476d29 into wiremod:master Nov 20, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants