Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #7906 > unrolled thread
| Started by | John Fultz <jfultz@wolfram.com> |
|---|---|
| First post | 2012-01-17 08:35 +0000 |
| Last post | 2012-01-17 08:35 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
Re: Locator points not working in Manipulate calling RegionPlot, etc. John Fultz <jfultz@wolfram.com> - 2012-01-17 08:35 +0000
| From | John Fultz <jfultz@wolfram.com> |
|---|---|
| Date | 2012-01-17 08:35 +0000 |
| Subject | Re: Locator points not working in Manipulate calling RegionPlot, etc. |
| Message-ID | <jf3bt2$ndp$1@smc.vnet.net> |
Manipulate only supports one Locator control at a time, but your Manipulate has
two. You need to reformulate it so that all four Locator points are in a single
Locator control.
The reason for this is because Manipulate doesn't actually use Locator, but
LocatorPane, and overlapping LocatorPanes makes no sense. In an ideal world,
Manipulate might attempt to combine the controls into a single LocatorPane, but
there would still be limitations (for example, adding and deleting locators
would make much less sense).
Sincerely,
John Fultz
jfultz@wolfram.com
User Interface Group
Wolfram Research, Inc.
On Mon, 16 Jan 2012 17:03:47 -0500 (EST), Chris Young wrote:
> No matter what I do, in terms of wrapping with DynamicModule, avoiding
> using variables from a module in an enclosed Dynamic or Manipulate, I
> can't get this very basic example to work. I just want to be able to
> drag around 4 points to set the quadrilateral, and then hatch all the
> subtriangles formed by drawin lines to the sides of the quadrilateral
> from the point T. House of trying everything I could think of have
> failed to get the Locator points to work.
>
> Any help hugely appreciated.
>
> http://home.comcast.net/~cy56/PolyHatchFromTestPt.nb
> http://home.comcast.net/~cy56/PolyHatchFromTestPt.png
>
> Chris Young
> cy56@comcast.net
>
>
> _TriHatch[P1_, P2_, P3_, mesh_, light_, plotPts_, opts___] :=
> Module[
> {
> orient, (* orientation of the triangles *)
> interior, (*
> inequalities for interior of triangle *)
> Q (*
> projection of first vertex onto opposite side *)
> },
> orient = Sign[Det[{P2 - P1, P3 - P1}]];
>
> interior[P_] :=
> And @@ (If[orient > 0, # > 0, # < 0] & /@
> {Det[{P2 - P1, P - P1}], Det[{P3 - P2, P - P2}],
> Det[{P1 - P3, P - P3}] });
>
> Q = Projection[P1 - P2, P3 - P2] + P2;
>
> RegionPlot[
> interior[{x, y}], {x, -2, 2}, {y, -2, 2},
> PlotStyle -> Opacity[0.1],
> ColorFunction -> (White &),
> Mesh -> Round[mesh Norm[P3 - P2], 1],
> MeshStyle -> If[orient > 0, Lighter[Green, light], Lighter[Red, light]],
> MeshFunctions -> {{x, y} =E2=C5 , Det[{Q - P1, {x, y} - P1}]},
> PlotPoints -> plotPts,
> BoundaryStyle -> None,
> Evaluate[opts]
> ]
> ]
>
>
> \[HorizontalLine]Ctr[P_] := Plus @@ P/Length[P]
>
> \[HorizontalLine]PolyHatch[P_, T_, mesh_, light_, plotPts_] :=
> Module[
> {C, n},
>
> C = \[HorizontalLine]Ctr[P];
> n = Length[P];
>
> (*Print["n == ",n];*)
>
> Show[
> Table[
> \[HorizontalLine]TriHatch[T, P[[j]], P[[If[j < n, j + 1, 1]]],
> mesh, light, plotPts],
> {j, 1, n}
> ],
> Graphics[
> {
> Table[
> {Hue[0.85 (j - 1)/n], Thick,
> Line[{P[[j]], P[[If[j < n, j + 1, 1]]]}]},
> {j, 1, n}
> ],
> Gray, PointSize[Large], Point[C]
> }
> ]
> ]
> ]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web