# RegionIntersection Using an Arrow and a Circle

This works:

RegionIntersection[Line[{{0, 0}, {1, 1}}], Circle[{0, 0}, 0.6, {30 °, 80 °}]]


returning a point:

Point[{0.424264, 0.424264}]


But this doesn't:

RegionIntersection[Arrow[{{0, 0}, {1, 1}}], Circle[{0, 0}, 0.6, {30 °, 80 °}]]


It returns:

RegionIntersection::reg: Arrow[{{0,0},{1,1}}] is not a correctly specified region.


Any thoughts? Is this something we would like to work?

• Do you have concrete examples of situations where it would be useful to be able to use Arrow as a region? Jul 9, 2017 at 18:43
• @C.E. I was constructing the bisector of an angle of two arrows that met at vertex A. I was creating an image that shows how to do this with a ruler and a compass for my students. Jul 9, 2017 at 21:45
• I'd like to thank my colleagues for their excellent help. Jul 10, 2017 at 19:15

## 3 Answers

You could include a special treatment for Arrow whenever it is found as an argument to RegionIntersection, so that it is converted into the corresponding Line object:

Unprotect[RegionIntersection];
RegionIntersection[OrderlessPatternSequence[Arrow[pts_], region_]] :=
RegionIntersection[Line[pts], region]
Protect[RegionIntersection];

RegionIntersection[Arrow[{{0, 0}, {1, 1}}], Circle[{0, 0}, 0.6, {30 °, 80 °}]]
(* Out: Point[{0.424264, 0.424264}] *)


... or in the opposite order (thanks to OrderlessPatternSequence):

RegionIntersection[Circle[{0, 0}, 0.6, {30 °, 80 °}], Arrow[{{0, 0}, {1, 1}}]]
(* Out: Point[{0.424264, 0.424264}] *)


Honestly, however, I don't see much of a use for this apart from one-off convenience.

• +1 ! i added a slightly modified version of your answer separately Jul 10, 2017 at 12:51

You can just use rules,e.g.:

roi = {Circle[{0, 0}, 0.6, {30 \[Degree], 80 \[Degree]}],Arrow[{{0, 0}, {1, 1}}]}
Graphics[{roi, PointSize[0.02], Red,RegionIntersection @@ (roi /. Arrow[x__] :> Line[x])}]


• Even simpler: just use Arrow -> Line as the replacement rule. Jul 10, 2017 at 9:33

a slight variant of @MarcoB 's answer (we can do without Unprotect):

roi = {Circle[{0, 0}, 0.6, {30 \[Degree], 80 \[Degree]}], Arrow[{{0, 0}, {1, 1}}]};
SetAttributes[regInt, HoldAllComplete];
regInt[OrderlessPatternSequence[region_, arrow : Arrow[_]]] :=
RegionIntersection[region, Line @@ arrow];

Graphics[{roi, PointSize[0.02], Red, regInt @@ roi}]