Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

In the documentation of FilledCurve, one can create a circle "cut-out" of a bigger circle using FilledCurve and Beziercurve. Is it also possible using two Circle commands and some Boolean operator, as can be done with Adobe Illustrator using the Pathfinder commands? Does some counterpart exist in Mathematica?

Edit: As asked in the comments: there exist a few Pathfinder operations, the most kwown are

  • Add two graphics
  • Substract one graphic from the oterh
  • Union of two graphics
  • "Exclusive" union of two graphics (without intersection)
  • Intersection of two graphics

Thanks for all inputs!

share|improve this question
    
I don't think so, but you can make your own circle based on Bezier curves and use that. –  Szabolcs Nov 30 '13 at 17:08
1  
There is a problem with Circle or Disc and one way I can think of would be to use image processing functions. As showed here: intersecting graphics, about Polygons I highly recommend PolygonIntersection which is also described there. At the end there is IMTEK MM suplement introduced by Szabolcs in the same Q&A which might be something what you need. –  Kuba Nov 30 '13 at 17:28
1  
In the November 2011 video referenced in the linked question in Kuba's comment above, Chris Carlson refers to the forthcoming Mathematica version 9 release as containing "polygon boolean operations, differences, unions, intersections, and so forth ...". So there's a possibility that in version 10 there may be a debugged and reliable set of geometry Boolean functions... :) –  cormullion Nov 30 '13 at 18:08

1 Answer 1

up vote 1 down vote accepted

Perhaps Disk is more appropriate than Circle, if you want it to be filled:

Graphics[{Black, Disk[{0, 0}, 3], White, Disk[{0, 0}, 2]}]

enter image description here

I don't think this works the same way as pathfinder, but it is getting at similar effects. One of the main reasons for using pathfinder is that it joins the multiple paths together in order to create a single object that is easy to manipulate. In Mathematica it might be more common to give the object a name and then use that name whenever you wish to reproduce, move, or modify the object.

As an example with circles (rather than disks), consider:

doubleCircle[{x_, y_}] := {Black, Circle[{x, y}, 3], Circle[{x, y}, 2]}

which creates a ``double circle'' function. You can draw lots of such objects:

rand = RandomInteger[{1, 15}, {5, 2}]
Graphics[doubleCircle[#] & /@ rand]

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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