Message Boards Message Boards

[✓] Insert a moving circle divided in slice inside of an image?

GROUPS:

Dear All, I wish to insert a moving circle divided in slice inside of an image

A couple of examples (partially finished) are shown below. The are only ideas. I will apreciate a only solution.

img = ExampleData[{"TestImage", "House"}];

(Example 1.- Problem: the sector moving is not fluid)

Manipulate[ ImageCompose[img, SectorChart[{{0, 0}, {0, r1}}, ChartBaseStyle -> Thick, PolarAxes -> Automatic, PolarGridLines -> Automatic, 
   PolarTicks -> {"Degrees", Automatic}, ChartStyle -> Opacity[1]],  Scaled[{x1, y1}]], {{r1, 0.2}, 0.1, 2}, {{x1, 0.5}, 0.1, 1},
 {{y1, 0.5}, 0.1, 1}]

(Example 2.-Problem: the circle is not divided in slice)

Manipulate[
 DynamicImage[img, ImageSize -> {600, 600}, 
  Epilog -> {Orange, Thickness[0.01], Circle[{Dynamic[xx], Dynamic[yy]}, Dynamic[r]]} ], {{xx, 100}, 20, 500}, {{yy, 100}, 20, 500}, {{r, 30}, 10, 100}, FrameMargins -> 0]
POSTED BY: San J
Answer
1 month ago

Something like this would work:

Manipulate[
 HighlightImage[img, 
  Inset[SectorChart[{{0, 0}, {0, 1}}, ChartBaseStyle -> Thick, 
    PolarAxes -> Automatic, PolarGridLines -> Automatic, 
    PolarTicks -> {"Degrees", Automatic}, ChartStyle -> Opacity[1], 
    PlotRange -> All], {x1, y1}, Center, r1]], {{r1, 150}, 50, 
  256}, {{x1, 100}, 0, 256}, {{y1, 100}, 0, 256}]

I like to use HighlightImage as it is very flexible, supports all graphics primitives and directives and keeps the vector graphics as vector (plots, ticks, grid lines, etc). ImageCompose rasterizes everything into raster graphics. Also note that in HighlightImage you can specify all coordinates and sizes in the "standard image coordinate system".

POSTED BY: Shadi Ashnai
Answer
1 month ago

Group Abstract Group Abstract