Group Abstract Group Abstract

Message Boards Message Boards

Create Interactively "VoronoiFying" images?

Posted 9 years ago
POSTED BY: Erik Mahieu
2 Replies
Posted 9 years ago

I tried to make the function:

result[polygon_, loc_, n1_, n2_] := Module[{polys, activePoly, polys1},
  polys = voronoiFy[Polygon[{{0., 0}, {0, 1}, {1, 1}, {1, 0}}], n1];
  activePoly = SelectFirst[polys, RegionMember[#, loc] &];
  polys1 = 
   RegionIntersection[#, activePoly] & /@ voronoiFy[activePoly, n2];
  {FaceForm[],
   EdgeForm[{AbsoluteThickness[1], Black}], polys,
   EdgeForm[{AbsoluteThickness[2], Red}], activePoly, polys1}]

and put it inside the manipulate but to no avail:

Manipulate[
 Graphics@result[Polygon[{{0., 0}, {0, 1}, {1, 1}, {1, 0}}], pt, n1, 
   n2],
 {{pt, {.55, .5}},(*{0.,0},{1.,1},*)Locator, LocatorRegion -> Full, 
  Appearance -> None},
 {{n1, 16}, Range[6, 24]},
 {{n2, 12}, Range[4, 16]}, Deployed -> True, 
 SynchronousUpdating -> True, TrackedSymbols :> {pt, n1, n2}]

So, maybe it has nothing to do with Evaluation order? Thank for your help...

POSTED BY: Erik Mahieu

Perhaps just save your output in a variable (say called result). Then inside your updating function, just overwrite this variable, rather than saying result = UpdateVoronoi[......]

POSTED BY: Sander Huisman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard