I want to generate a number of ellipses, rotate each ellipse using random angle, and then test each ellipse if it intersects with any other regions within arbitrary geometry.

I can create my ellipses, and rotate each ellipse using random angle. However, the methods I use don't seem to be compatible when used inside RegionIntersection

How could I generate, rotate and test the rotated ellipses to check for intersections with other members of the geometric composition?


  {data,r1, r2},
  (*Variable declaration*)
  data = RandomInteger[{1,100},{100,2}];

  r1[origin_,radius_, angle_]:=GeometricTransformation[Disk[origin,{radius,radius /7}],RotationTransform[angle,origin]];
  r2[origin_,radius_,angle_] :=Rotate[Disk[origin,{radius,radius/7}],angle,origin];

  (*Visual Representation*)
    Graphics @ {FaceForm @ None, EdgeForm @ Red,r1[data[[1]],2.5,Pi/6]},
    Graphics @ {FaceForm @ None, EdgeForm @ Blue,r2[data[[1]],2.5,Pi/4]},
    Graphics @ {Opacity @ .5,FaceForm @ Gray, Disk[data[[1]],1]},
    Axis-> True,
    Frame-> True

Following are the lines which would crash my code due to ,what I suspect, argument incompatibility

(*Intersection [Fail]*)
  • $\begingroup$ Try TransformedRegion instead of GeometricTransformation $\endgroup$
    – Carl Woll
    Commented Feb 16, 2017 at 1:25
  • $\begingroup$ @CarlWoll, thank you for your reply. I think the method works. I am happy to accept it as an answer if you'd like to post one below? $\endgroup$ Commented Feb 16, 2017 at 10:31

1 Answer 1


The problem is that GeometricTransformation doesn't produce an object that is RegionQ:

    Disk[{0, 0}, {1, 2}],
    RotationTransform[Pi/2, {0, 0}]
] //RegionQ


Instead of GeometricTransformation, you should use TransformedRegion:

r1 = TransformedRegion[
    Disk[{0, 0}, {1, 2}],
    RotationTransform[Pi/2, {0, 0}]
r1 //RegionQ


Using RegionIntersection with r1:

int = RegionIntersection[r1, Disk[{1, 1}, 1]];

enter image description here


  • $\begingroup$ Yeah I figured it doesn't return True when tested with RegionQ hence the incompatibility error. I was unaware of TransformedRegion function. Thank you for providing an answer to my question. I learned something new :) (y) $\endgroup$ Commented Feb 16, 2017 at 17:06
  • $\begingroup$ But this is all a little broken. GeometricTransformation can (and should, where possible) produce RegionQ objects. For example, Normal@GeometricTransformation[Cylinder[], ScalingTransform[{2, 2, 2}]]. But this does not work properly in 2D (reported bug). $\endgroup$
    – TheDoctor
    Commented Aug 14, 2017 at 4:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.