Advent of Code is back! Unwrap daily challenges to sharpen your Alteryx skills and earn badges along the way! Learn more now.
Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

What is the easiest way to cut off a segment of a circle?

PVousden121
8 - Asteroid

Hi,

 

I have a problem in that I have a circle and a triangle as defined by my data such that the triangle is made up of the centre of the circle and two points on the circumference as shown below:

20221129 - PV - Shape Cut Out].png

 

So, if I overlay the shapes as shown above it forms 3 distinct areas the main part of the circle shaded pink, the triangle shaded white (or not shaded might be more accurate), and then the smaller segment of the circle that I have shaded yellow.  What I am looking to have as a result is the area of the circle minus the yellow segment which means that it will consist of the pink and white areas.

 

Is this possible without resorting to advanced maths and creating arcs etc....  I am not confident enough with the spatial processing tool's capabilities to not dismiss that there is just this functionality hiding somewhere within the capabilities of Alteryx.  Or perhaps as part of the Formula functionality.

 

Any help or pointers gratefully received.

Peter  

 

12 REPLIES 12
Christina_H
14 - Magnetar

Can you provide sample data?  If the shapes are in there as spatial objects you can use a Spatial Info tool to find the areas.  Otherwise, it depends on the data you have.

CharlieS
17 - Castor
17 - Castor

Well this is a fun spatial problem, and a great application to learn about the Spatial Process tool!

https://help.alteryx.com/20221/designer/spatial-process-tool

 

In the attached workflow, I start by creating two polygons: the circle and the triangle (which I believe is your starting set of data). The Spatial Process tool can be used to cut the triangle section from the circle, leaving two polygons, the pink and yellow sections in your image. I use the area of the two polygons to determine the smaller (yellow) area and sample my records to only that polygon. Now that we have the yellow area, we can use the Spatial Process tool again to cut the yellow section from the original circle, leaving what would be the pink+white areas of your above image. I believe this is what you were looking for.

 

20221129-CircleTriangleSolution.PNG

 

Now this may not always work as there are several conditions that must be met regarding how the triangle is defined (if you have points or a polygon) and if the radius points lie exactly on the circle perimeter or not. It should also be possible to Spatial Process to merge the pink and white areas. We can discuss further for any of these cases, but this should help get the conversation started!

PS: The workflow has browses in important places that I recommend viewing to follow along what's happening. 

PVousden121
8 - Asteroid

Hi,

 

Just wanted to write a quick thanks for solving my issue.  I am not completely sure why you seem to have some duplicate steps in the workflow, but I am working my way through it and trying to understand why as it is very effective.

 

Many thanks again,
Peter

CharlieS
17 - Castor
17 - Castor

Happy to help! Is there something in the workflow that I can help clarify? The container names should describe what each section is doing. 

PVousden121
8 - Asteroid

Hi,

 

No, it's just that my points aren't exact, so the two other points do not lie on the circle's circumference which is causing some problems as you predicted. 

 

The radius is 5.75389725 miles.

 

Point         Lat                Long     

No 1          53.39194      0.23167
No 2          53.49222      0.08417
Centre       53.47500      0.22083

 

But thanks again,

Peter

CharlieS
17 - Castor
17 - Castor

Ah yes, that would cause an issue. I took another crack at it and came up with some ideas about how to work with that situation.

 

I started by building a circular polygon. This could be done by using the defined value you provided (5.75389725 miles), or the average distance of the two points if you want to use them as much as possible. This polygon is then converted to a ring/line using the ST_Boundary( function in the Formula tool and use the Distance tool function "Create the nearest point" checkbox to create a point along the ring nearest the original points. Now we have points along the circle which we can use to build the triangle object from.

20221130-CircleTriangle_Nearest.PNG

 

Once we have the circle and triangle polygons built, I used the same process from the first workflow to create the desired object.

 

20221130-CircleTriangle_Solution.PNG

 

I hope this helps!

PVousden121
8 - Asteroid

Hi,

 

What a great solution and very inventive thinking....

 

Still looking through it but was very clear and very well worked out.

 

Many, many thanks again,

Peter

PVousden121
8 - Asteroid

Hi,

 

Hope that are not too bored yet but found an edge case of a straight line across the circle which seems to 'break' the solution.

 

The points are:

 

No 1      51.63750            -4.73000

No 2      51.63750            -4.83667

Centre  51.63750            -4.78333

 

Thoughts welcomed....

 

Kind regards,

Peter

 

 

 

PVousden121
8 - Asteroid

PS - I am looking for the southern half as the desired output...

 

Labels
Top Solution Authors