I have a color wheel domain which is used to describe complex numbers. I want to know is it possible to add a black spot which can be moved by mouse dynamically and return the complex number values of the spot's position?
Is it possible to do this by Manipulate or something similar? I'm not so familiar with the dynamically coding and I know how to make color wheel from the halirutan and others' answers.
Does anyone know this? Is it like adding a black bottom in the color wheel and then obtain the values when move the spot by mouse?
I appreciate all the comments and suggestions from you! Thank you very much!
--------------------additional question -----------------------------------
one additional thing: how to return the spot's complex values to a certain variables? I show the following example:
I have the following code, that I can adjust the angle phi1 and radial R1 which stands for a complex value and then automatically change the color.
RectangleC1 = Rectangle[{0, 0}, {3, 3}];
Manipulate[
With[
{RegionC1 = R1 (Cos[phi1] + I*Sin[phi1])},
Region1S = Abs[RegionC1]^2/4;
If[Re[RegionC1] == 0 && Im[RegionC1] == 0, Region1Phi = 0,
If[N[ArcTan[Re[RegionC1], Im[RegionC1]]] <= 0,
Region1Phi = N[ArcTan[Re[RegionC1], Im[RegionC1]]]/(2 Pi) + 1,
Region1Phi = N[ArcTan[Re[RegionC1], Im[RegionC1]]]/(2 Pi)];
];
Icolorstyle = {Hue[Region1Phi, 1, 1, Region1S]};
Graphics[{EdgeForm[{Thickness[0.001], Gray}], {Icolorstyle[[1]],
RectangleC1}}]
],
{phi1, 0, 2 Pi}, {R1, 0, 1}
]
So what I do is:
RectangleC1 = Rectangle[{2, -2}, {5, 3}];
With[
{pts = Append[#, First[#]] &@
Table[{r {Cos[phi], Sin[phi]}, phi/(2 Pi)}, {phi, 0,
2 Pi, .1}, {r, 0, 1, .1}]},
DynamicModule[
{pt = {.5, .5}},
Region1S = pt[[1]]^2 + pt[[2]]^2;
If[pt[[1]] == 0 && pt[[2]] == 0, Region1Phi = 0,
If[N[ArcTan[pt[[1]], pt[[2]]]] <= 0,
Region1Phi = N[ArcTan[pt[[1]], pt[[2]]]]/(2 Pi) + 1,
Region1Phi = N[ArcTan[pt[[1]], pt[[2]]]]/(2 Pi)];
];
Icolorstyle = {Hue[Region1Phi, 1, 1, Region1S]};
Graphics[
{Polygon[{{0, 0}, First[#1], First[#2]},
VertexColors -> (Hue /@ {{0, 0, 1}, Last[#1], Last[#2]})] & @@@
Partition[pts[[All, -1, {1, 2}]], 2, 1],
Locator[Dynamic[pt, (pt = If[Norm[#] < 1, #, Normalize[#]]) &],
Style["\[FilledCircle]", FontSize -> 10]], Icolorstyle[[1]],
RectangleC1}, PlotLabel -> Dynamic[Style[pt, 16]]]
]
]
It doesn't automatically change the color when I move the black spot in the color wheel. Which part is missing? Thank you so much for all your help!
figure out one solution:
RectangleC1 = Rectangle[{3, -2}, {6, 2}];
With[{pts =
Append[#, First[#]] &@
Table[{r {Cos[phi], Sin[phi]}, phi/(2 Pi)}, {phi, 0, 2 Pi, .1}, {r, 0, 2, .1}]},
DynamicModule[{pt = {.5, .5}},
{
Graphics[{Polygon[{{0, 0}, First[#1], First[#2]},
VertexColors -> (Hue /@ {{0, 0, 1}, Last[#1], Last[#2]})] & @@@
Partition[pts[[All, -1, {1, 2}]], 2, 1],
Locator[Dynamic[pt, (pt = If[Norm[#] < 2, #, Normalize[#]]) &],
Style["1\[FilledCircle]", FontSize -> 8]]},
PlotLabel -> Dynamic[Style[pt, 12]]],
Dynamic[
Region1S = (pt[[1]]^2 + pt[[2]]^2);
If[pt[[1]] == 0 && pt[[2]] == 0, Region1Phi = 0,
If[N[ArcTan[pt[[1]], pt[[2]]]] <= 0,
Region1Phi = N[ArcTan[pt[[1]], pt[[2]]]]/(2 Pi) + 1,
Region1Phi = N[ArcTan[pt[[1]], pt[[2]]]]/(2 Pi)];
];
Icolorstyle = {Hue[Region1Phi, 1, 1, Region1S]};
Graphics[{Icolorstyle[[1]], RectangleC1}]
]
}
]
]





