Showing results for 
Search instead for 
Did you mean: 
Do you have the skills to make it to the top? Subscribe to our weekly challenges. Try your best to solve the problem, share your solution, and see how others tackled the same problem. We share our answer too.
Weekly Challenge
Do you have the skills to make it to the top? Subscribe to our weekly challenges. Try your best to solve the problem, share your solution, and see how others tackled the same problem. We share our answer too.
Unable to display your progress at this time. Please try again a little later, or contact an administrator if you continue to see this error.
Getting started with Designer? | Start your journey with our new Learning Path!

Challenge #161: Triangles, Triangles, Triangles

Director, Customer Enablement
Director, Customer Enablement
The idea of the challenge is simple, but it could be a little trick to execute!
Provided are a set of coordinates. With this set of triangles, you must create triangles. Each triangular spatial object must have exactly 3 non-collinear points. With this data set, you should create 516 unique triangles! How many of the 516 can you get?
This week's challenge was contributed by @CharlieS !

Fun challenge @CharlieS 

While I naturally reach for the spatial tools, the formula tools can accomplish the same tasks without transposing the data.

Fun challenge!  Last filter needed to match solution, but shouldn't tiny triangles still count?  Investigation of original data indicates these are non-linear points (Thank you Mr. Coss - High School Geometry Teacher)


 Workflow 161.GIF



Alteryx Certified Partner

I'm delighted that I could contribute to the awesome-ness that is the Weekly Challenges! I originally designed this with several sub-challenges if you want more:


- Draw a triangle using Spatial tools

- Draw a triangle without using Spatial tools

- Draw multiple triangles using only a single tool

- Draw multiple triangles using an iterative macro

- Draw all 516 unique triangles



A note on the "valid" solutions: due to how the points were drawn, it is possible to produce some very thin triangles that would be collinear if a grid was drawn on a Cartesian plane. Rather than adjusting the points, I was curious to see different approaches to handing these scenarios. 

Alteryx Certified Partner
Alteryx Certified Partner

Challenge #161, done.




I also removed the tiny triangles to get to the final answer - (unsure why they don't count)








Fun challenge!  Thanks @CharlieS 



Fun challenge! I had to look up (as I couldn't remember back to high school trigonometry how to determine if 3 points were collinear.

After doing some digging (looking at 3 points that are seemingly a straight line), I understood why I couldn't use 0 as the collinearity check. Some of the areas are basically 0, but are not really triangles as they appear to be lines on the plane.
Challenge 161.PNG

Fun challenge, I had troubles for the final filter :)

Alteryx Certified Partner

Interesting. Final filter was a challenge

First tried to filter triangles using ST_DIMENSION (should return 1 for lines)

OK so I got a bit hung up on the definition of "Non-Collinear", so my workflow actually has 2 solutions - one that gets 516 unique triangles (not the most efficient solution compared to others, but logically it got me there, and I feel like my high school math teacher wouldn't have been mortified, so I'm okay with it)... and then an alternate solution that I feel better matches the intention that all triangles be "non-collinear", which I defined to mean that there could be no point in the triangle that was at the same latitude or longitude plane as any other point in that triangle. Results in far fewer triangles (essentially, any triangle with a straight vertical or horizontal side is eliminated by this method).


Either way, super fun challenge @CharlieS!



Method #1: Create 516 unique triangles... realized after looking at a few other solutions that the Unique tool would have greatly simplified this, but it got me there eventually (basically reordered the points in ascending RecordID order and then grouped them to eliminate duplicates, achieving the same effect... with way too many tools haha).


Method #2: Create only triangles that do contain any points that are on the same plane (latitude or longitude). Again, a bit of a roundabout way to get there (once again finding an obscure reason to use one of my hidden favorite tools, Make Columns!)... but conceptually this one was actually easier for me to wrap my head around. And since I cheated a little by borrowing the Unique tool from other solutions as my method to get rid of duplicates, I opted to not use any Spatial tools for this method, using the Spatial formulas instead. BONUS: The resulting picture of triangles with this method is quite pretty! :)