Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lines drawn on a 2D Canvas have strange "squashing" behaviour #104

Open
tiggerbiggo opened this issue Aug 16, 2024 · 1 comment
Open

Lines drawn on a 2D Canvas have strange "squashing" behaviour #104

tiggerbiggo opened this issue Aug 16, 2024 · 1 comment

Comments

@tiggerbiggo
Copy link

tiggerbiggo commented Aug 16, 2024

Minecraft 1.20.1
Fabric Loader version 0.15.10
Plethora 1.20.1-1.11.7

Example code is below, for a neural interface with overlay glasses

local neural = peripheral.wrap("back")
local canvas = neural.canvas()
canvas.clear()
local w, h = canvas.getSize()
local pointer = canvas.addLine({x=w/2, y=h/2}, {x=w/2, y=h/2}, 0xFFFFFFFF, 5)

local angleDeg = 0
local pointerLength = 10

while true do
    angleDeg = angleDeg + 5

    local pointerX = math.sin(math.rad(angleDeg)) * pointerLength
    local pointerY = math.cos(math.rad(angleDeg)) * pointerLength

    pointer.setPoint(1, pointerX + w/2, pointerY + h/2)
    pointer.setPoint(2, w/2, h/2)
    sleep(0.05)
end

This results in a line that rotates around the center of the screen, but when it goes horizontal the line get so thin it disappears.

PlethoraLine

@tiggerbiggo
Copy link
Author

I cannot get the code to show up consistently. Here's a gist instead if you need it:

https://gist.github.com/tiggerbiggo/ffde0cee7e65f3627125e0d6b03a6c78

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

No branches or pull requests

1 participant