| Author |
Comment/Response |
Michael
|
12/09/12 3:21pm
The Arrowheads[] directive and Arrow[] automatically rotate the image. If your image is an Image instead of a Graphics, then you have to Inset in Graphics.
Say you'd like to use the Pentagon as an arrowhead. Load the image, crop it to the Pentagon, and rotate it so the a corner is pointing directly left. You can use Manipulate to determine the Module parameters.
arrowImage =
ColorReplace[
ImageCrop[
ImageRotate[
ImageSubtract[ExampleData[{"AerialImage", "Pentagon"}],
Module[{r = 0.774`, x = -0.1504`,
y = 0.0562`, \[Alpha] = 1.0562`},
Graphics[{Black,
Polygon[Table[{x, y} +
r {Cos[t + \[Alpha]], Sin[t + \[Alpha]]}, {t, 0,
2 \[Pi] - (2 \[Pi])/5, (2 \[Pi])/5}]]}, PlotRange -> 1,
ImageSize -> 1024]]], -1.0562`]], Black, 0.001]
Next Inset the Image into Graphics:
arrowHead =
Graphics[Inset[arrowImage, {0, 0}, Right, (1 + Cos[\[Pi]/5.])/2],
PlotRange -> {{-Cos[\[Pi]/5.] - 1, 0.}, {-Sin[2 \[Pi]/5.],
Sin[2 \[Pi]/5.]}}/2]
Then use it with Arrowheads:
{Graphics[{Arrowheads[{{0.2, Automatic, {arrowHead, 0.5}}}],
Arrow[{{0, 0}, {0.5, 1}, {1, 0.2}, {2, 0.7}}]}],
Graphics[{Arrowheads[{{0.2, Automatic, {arrowHead, 0.5}}}],
Arrow[BezierCurve[{{0, 0}, {1, 1}, {2, 0}}]]}]}
URL: , |
|