Discuss Scratch

HighlaneGamingStudio
Scratcher
100+ posts

Triangle Filler Has Resolution Issues

Hello. On my project, TPR2D (Triangle Point Rendering 2-Dimensional), I'm experiencing a weird bug. When I set the resolution of my block (see below) to anything 0 through 5, the tiny right triangle turns into a blob, similar to if I set the resolution to a high number, like 50. My project is based off of TheLogFather's Faster Triangle Filler, but I replaced all of the variables with a list. At any other resolution, both scripts work the same.
fill()()()()()()resolution:()::custom//TheLogFather's block

render triangle from points:()()()color:()resolution:()::custom//My block
Fixing this would be great. Thank you for reading this.

EDIT: It actually stops working at 5.857864376269048. I rounded the number because it goes on a long way. I'm now truly baffled by this.

Last edited by HighlaneGamingStudio (Feb. 20, 2025 20:10:37)

HighlaneGamingStudio
Scratcher
100+ posts

Triangle Filler Has Resolution Issues

More precise number: 5.85786437626904854525378141261171549558639526…

It's not the square root of any integer (I checked). Where is this number coming from? Is there any way to recreate the number in the scripts?
legendary34678
Scratcher
1000+ posts

Triangle Filler Has Resolution Issues

Hello! What resolutions do work? Also, can you say exactly what changes you made to the original triangle fill block?
Jareddddddd
Scratcher
1000+ posts

Triangle Filler Has Resolution Issues

5.8578… - approx 3rd root of 201 - Theres nothing particularly outstanding about this number - How did you find this out? From looking at the scripts, it seems like a log base -
special number = Log 17(res / IND), where 17 is data, item 17
I have no idea what the list entries represent, and the tris filler seems to work fine for me.

Perhaps it's an issue with scratch - sometimes when copy+pasting scripts over, variables and duplicated and things and whatnot happen. Try deleting and re-pasting it into the sandbox.

Last edited by Jareddddddd (Feb. 21, 2025 17:04:13)

awesome-llama
Scratcher
1000+ posts

Triangle Filler Has Resolution Issues

Inside the repeat loop, the pen size is being multiplied by 10. This is not the case in TheLogFather's version that multiplies by the variable “td”.
HighlaneGamingStudio
Scratcher
100+ posts

Triangle Filler Has Resolution Issues

Jareddddddd wrote:

5.8578… - approx 3rd root of 201 - Theres nothing particularly outstanding about this number - How did you find this out? From looking at the scripts, it seems like a log base -
special number = Log 17(res / IND), where 17 is data, item 17
I have no idea what the list entries represent, and the tris filler seems to work fine for me.

Perhaps it's an issue with scratch - sometimes when copy+pasting scripts over, variables and duplicated and things and whatnot happen. Try deleting and re-pasting it into the sandbox.
I discovered the number when I decided to go into further detail with 0-5. I knew it worked at 6 and not at 5, but was it anything above 5, anything blow 6, or some number in between? So I tried trial and error one digit at a time, and discovered that it was that wild number that came up. I could easily so into further detail, but it would take some time, and as you said that it was a rounded/truncated version of 3√201, it wouldn't be important to continue.

For information on what the list entries mean as they correspond to the original triangle filler, see Data Encoding Information>Lists>data in the long sidebar-like comment on the side of the scripts. I have no idea what the original variables mean, I just converted all of them to list entries because I was making the project as a game engine, and game creators wouldn't want a bunch of variables already there when the found the project.

The triangle filler might seem to work fine for you because you're not understanding how it's supposed to work with the code I already have set up. It goes back and forth with 1 second intervals between my filler and the original filler that I backpacked and modded. Go into the code and look under the when green flag clicked block. See the repeat loop? Notice the custom block labeled fill with the 6 inputs that either have 5 or -5 in them and the block labeled render triangle from points with 3 inputs labeled 1, 2, and 3? The former is TheLogFather's block while the latter is my block. See the input on both blocks labeled resolution? Change the input on mine to 6, then change it to 5 while running the project. Lower resolutions are supposed to be higher quality (creates triangles with less rounded corners) but when it gets lower than the number I specified (the 5.8578…) it jumps up to a higher resolution number, creating what looks like a blob for such small triangles. Both blocks render the same until I get to 0-5.8578…, then they stop rendering the same. (Rendering at 0 is super laggy, and rendering at negative numbers creates a cool effect, though it's not what I'm looking for.) I might make the triangle bigger to make it easier to see soon.

I didn't copy-paste the code, I backpacked it from TheLogFather's project and moved it to my project. I would have made a remix, but I was already partway through the other scripts and didn't want to have to backpack all of my scripts to move them into the remix.

legendary34678 wrote:

Hello! What resolutions do work? Also, can you say exactly what changes you made to the original triangle fill block?
The first question is easy to answer, just reread my original post. To answer the second question, I made two major changes- I replaced all of the variables with list items and I replaced all of the block inputs with references to lists based on other block inputs.
HighlaneGamingStudio
Scratcher
100+ posts

Triangle Filler Has Resolution Issues

awesome-llama wrote:

Inside the repeat loop, the pen size is being multiplied by 10. This is not the case in TheLogFather's version that multiplies by the variable “td”.
Oh, that's probably the issue. 10 was the placeholder number behind all of the reporter inputs (try removing a different one and you'll find 10). When I was switching out the variables for list item blocks, I must have missed that one. No wonder setting the pen size to 5 made the project render as about size 50! I thought about that but never actually tested it. Thanks for the help!

Powered by DjangoBB