For example:
How can I draw such kinds of coordinates?
Thank you~
You build this in Mathematica like you would do in any other descriptive language (you might want to use TikZ for this): step by step. Choosing nicer colors,adjusting the distances etc. is left as an exercise to the reader.
cosy[labels_, labelstyle_] := Flatten@{
Arrow[{{0, 0, 0}, {1, 0, 0}}],
Arrow[{{0, 0, 0}, {0, 1, 0}}],
Arrow[{{0, 0, 0}, {0, 0, 1}}],
labelstyle,
Text[labels[[1]], {1.1, 0, 0}],
Text[labels[[2]], {0, 1.1, 0}],
Text[labels[[3]], {0, 0, 1.1}]
};
Graphics3D[{
{ (* Coordinate system 1 *)
cosy[{"X", "Y", "Z"}, Darker@Orange],
Darker@Orange,
Text["World", {-.3, -.3, .5}]
},
{ (* Coordinate system 2 *)
Rotate[cosy[{"x", "y", "z"}, Blue], -30 \[Degree], {-1, 0, 1}]~
Translate~{0, 0, -2}
},
{ (* Connecting arrow *)
Darker@Green,
Arrow[{{0, 0, 0}, {0, 0, -2}}],
Text["C(t)", {0, -.2, -1}]
},
{ (* Red stuff *)
Red,
Arrow[{{0, 0, 0}, {0, 3, -1}}],
Arrow[{{0, 0, -2}, {0, 3, -1}}],
Text["\!\(\*SubscriptBox[\(p\), \(world\)]\)",
1/2 {0, 3, -1} + {0, 0, .5}],
Text["\!\(\*SubscriptBox[\(p\), \(0\)]\)",
1/2 {0, 3, -1} + {0, 0, -1.5}],
Text["p(t)", {0, 3, -1} + {0, .5, 0}]
}
}, Boxed -> False]
Flatten
in Graphics3D
? It actually makes it more complicated as the inner lists act as scoping constructs: directives within them do not affect the directives outside of them. So, you can remove both Flatten
and the second Black
and get the same result as cosy
ensures that the color directive passed in does not affect anything after it.
$\endgroup$
This is a variation on David's answer.
o = {0, 0, 0};
Clear[axis];
axis[p_, label_] := {Arrowheads[0.025], Arrow[{o, p}], Text[label, p]}
Clear[axes];
axes[labels_List, labelSize_, labelColor_] :=
MapThread[axis, {IdentityMatrix[3], Style[#, labelSize, labelColor, Bold] & /@ labels}]
ct = 1. {0, 3, 3};
pt = {-0.5, -4, 2};
Graphics3D[{
axes[{"\!\(\*StyleBox[\"Z\",\nFontSlant->\"Italic\"]\)", "\!\(\*StyleBox[\"X\",\nFontSlant->\"Italic\"]\)", "\!\(\*StyleBox[\"Y\",\nFontSlant->\"Italic\"]\)"}, 17, Blend[{Orange, Yellow}]],
Translate[Rotate[axes[{"\!\(\*StyleBox[\"z\",\nFontSlant->\"Italic\"]\)", "\!\(\*StyleBox[\"x\",\nFontSlant->\"Italic\"]\)", "\!\(\*StyleBox[\"y\",\nFontSlant->\"Italic\"]\)"}, 17, Darker@Blue], -35 Degree, {1, 1, 0}], ct],
Arrowheads[0.015], Darker@Green, Arrow[{{0, 0, 0}, ct}],
Text[Style["C(\!\(\*StyleBox[\"t\",\nFontSlant->\"Italic\"]\))", 14, Bold], Mean[{o, ct}], {-1, 1}],
Red, Arrow[{ct, pt}], Text[Style["\!\(\*SubscriptBox[\(p\), \(O\)]\)", 14, Bold], Mean[{ct, pt}], {-.5, -2}],
Arrow[{o, pt}],
Text[Style["\!\(\*SubscriptBox[StyleBox[\"p\",\nFontSlant->\"Italic\"], \(World\)]\)", 14, Bold], Mean[{o, pt}], {1, 0}],
Text[Style["\!\(\*StyleBox[\"p\",\nFontSlant->\"Italic\"]\)(\!\(\*StyleBox[\"t\",\nFontSlant->\"Italic\"]\))", 14, Bold], pt, {-.5, -1}],
Text[Style["\!\(\*StyleBox[\"O\",\nFontSlant->\"Italic\"]\)", 20, Bold, Darker@Blue], ct + .1 (pt - ct), {0, -5}]},
Boxed -> False,
ViewVertical -> {0.37, 0.1, 2.1},
ViewPoint -> {1.7, 2.5, 1.6}]
The StyleBoxes appeared only because I formatted the fonts with italic and subscripts. The code looks cleaner in my notebook!
To choose values for the ViewVertical
and ViewPoint
options, I evaluated the expressions, then rotated the graphic to what I thought looked good, then evaluated FullOptions[]
on the graphic, using values close what that output gave. Further refinement would involve tuning the angles and positions of the axes labels.
Translate[]
andRotate[]
ought to do the trick... $\endgroup$