Talk:Divide a rectangle into a number of unequal triangles: Difference between revisions

From Rosetta Code
Content added Content deleted
Line 15: Line 15:


:Similar triangles have a precise mathematical definition that is probably going too far as I think it means having the same angles, allowing rotation, flipping and scaling. Just not having the lengths of each side the same would be enough I think, so scaled triangles would not be classed as similar in this task. --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 17:08, 18 December 2021 (UTC)
:Similar triangles have a precise mathematical definition that is probably going too far as I think it means having the same angles, allowing rotation, flipping and scaling. Just not having the lengths of each side the same would be enough I think, so scaled triangles would not be classed as similar in this task. --[[User:Paddy3118|Paddy3118]] ([[User talk:Paddy3118|talk]]) 17:08, 18 December 2021 (UTC)

==Work in pixels?==
Fairly obviously if the vertices can be defined using (ir)rational numbers then (as long as at least one exists, aka n>=3) there are an infinite number of possible solutions.<br> If instead every point has to be an exact pixel (or grid vertex) then there are a finite number of solutions, manageable and countable at least for relatively small rectangle sizes and n, and that opens up the possiblility of finding all of them rather than being constrained to one or two methods. Determining non-similarity when none of the sides are horizontal/vertical might be a little bit more challenging? Maybe it could just rely on all areas and/or angles differing by at least some given epsilon? I doubt there is any real-world need for a "fast find any" so making this a "slow find all" should not be an issue. --[[User:Petelomax|Pete Lomax]] ([[User talk:Petelomax|talk]]) 12:35, 19 December 2021 (UTC)

Revision as of 12:36, 19 December 2021

Task

The idea for the task I developed from a StackOverflow question that was closed. --Paddy3118 (talk) 11:04, 18 December 2021 (UTC)

Extra Algo.

I'm guessing that you could drop a point P inside the rectangle where its distances to the corners are all different. Add random points around the outside edges, then go around the circumference in one direction and make trianges of c[i], c[i+1] and P.

You would then get triangles with edges on all four sides of the rectangle.

--Paddy3118 (talk) 10:10, 18 December 2021 (UTC)

What does random and not-similar mean?

The minimum number is three. First bisect the rectangle into two equal triangles. The problem is now reduced to splitting one of these triangles into n-1 unequal triangles, which is trivial. Is this random? The triangles are all different, are they non-similar? --Nigel Galloway (talk) 12:12, 18 December 2021 (UTC)

Similar triangles have a precise mathematical definition that is probably going too far as I think it means having the same angles, allowing rotation, flipping and scaling. Just not having the lengths of each side the same would be enough I think, so scaled triangles would not be classed as similar in this task. --Paddy3118 (talk) 17:08, 18 December 2021 (UTC)

Work in pixels?

Fairly obviously if the vertices can be defined using (ir)rational numbers then (as long as at least one exists, aka n>=3) there are an infinite number of possible solutions.
If instead every point has to be an exact pixel (or grid vertex) then there are a finite number of solutions, manageable and countable at least for relatively small rectangle sizes and n, and that opens up the possiblility of finding all of them rather than being constrained to one or two methods. Determining non-similarity when none of the sides are horizontal/vertical might be a little bit more challenging? Maybe it could just rely on all areas and/or angles differing by at least some given epsilon? I doubt there is any real-world need for a "fast find any" so making this a "slow find all" should not be an issue. --Pete Lomax (talk) 12:35, 19 December 2021 (UTC)