# Rotate the label when rotating the output image with graphics3D

I am interested in drawing a labelled dashed line through points p1 and p2 with Graphics3D. The code doing this job is the following:

p1 = {0, 0, 0};
p2 = {0, 1, 0};
Graphics3D[{Text[Style["DUMA", 30], (p1 + p2)/2], {Dashed, Line[{p1, p2}]}}, Boxed -> False]


This code provides the following output: However, when I rotate the output image (highlighted in orange box in the above figure) by 90 degrees clockwise, I receive the following result: Could you please help me how to modify my code to rotate the label simultaneously with the output image. The result that I expect is as follows: • Nov 6, 2021 at 20:44
• @RohitNamjoshi OK, but what is the answer to this question? Nov 6, 2021 at 20:52

Edit

p1 = {0, 0, 0}; p2 = {0, 1, 0};
label = Rotate[Text[Style["DUMA", 100]], π/2];
vtc = {{0, 0}, {1, 0}, {1, 1}, {0, 1}};
center = Mean[{p1, p2}]; dir = .1 Normalize[p2 - p1]; normal = {1, 1,
1}; conormal = .05 Normalize@Cross[dir, normal]; frame = {conormal,
dir}; coords = {{center + {-1, -1} . frame,
center + {1, -1} . frame, center + {1, 1} . frame,
center + {-1, 1} . frame}}; Graphics3D[{{Dashed, Line[{p1, p2} ],
Red, Point[p2]}, {Texture[label], EdgeForm[Cyan],
Polygon[coords, VertexTextureCoordinates -> {vtc}]}},
Boxed -> False, Lighting -> {{"Ambient", White}}] Original

p1 = {0, 0, 0};
p2 = {0, 1, 0};
label = Text[Style["DUMA", 100]];
vtc = RotateLeft[{{0, 0}, {0, 1}, {1, 1}, {1, 0}}, 1];
center = Mean[{p1, p2}];
dir = .1 Normalize[p2 - p1];
normal = .1 Normalize@{1, -1, 1};
conormal = Cross[dir, normal];
coords = {{center + {-1, -1} . {dir, normal},
center + {1, -1} . {dir, normal}, center + {1, 1} . {dir, normal},
center + {-1, 1} . {dir, normal}}};
Graphics3D[{Dashed,
Line[{p1, p2}], {Texture[label], EdgeForm[Cyan],
Polygon[coords, VertexTextureCoordinates -> {vtc}]}},
Boxed -> False, Lighting -> {{"Ambient", White}}] • p1 = {0, 0, 0}; p2 = {0, 1, 0}; label = Text[Style["DUMA", 100]]; vtc = RotateLeft[{{0, 0}, {1, 0}, {1, 1}, {0, 1}}, 1]; center = Mean[{p1, p2}]; dir = .1 Normalize[p2 - p1]; normal = .1 Normalize@{1, -1, 1}; conormal = .05 Normalize@Cross[dir, normal]; frame = {conormal, dir}; coords = {{center + {-1, -1} . frame, center + {1, -1} . frame, center + {1, 1} . frame, center + {-1, 1} . frame}}; Graphics3D[{Dashed, Line[{p1, p2}], {Texture[label], EdgeForm[Cyan], Polygon[coords, VertexTextureCoordinates -> {vtc}]}}, Boxed -> False, Lighting -> {{"Ambient", White}}] Nov 7, 2021 at 4:07
• It is nice, thanks. The commands you posted below your answer provide "Duma" rotated in a strange way which is unreadable without changing the orientation of our head. ;) Can you give a solution which rotates the text by 180 degrees counterclockwise in this particular case and in general case, such that one can read the text without rotating her head? Nov 7, 2021 at 11:43
• @TobiR set vtc = RotateLeft[{{0, 0}, {1, 0}, {1, 1}, {0, 1}}, 3]; instead of vtc = RotateLeft[{{0, 0}, {1, 0}, {1, 1}, {0, 1}}, 1]; Nov 7, 2021 at 11:53
• @cvgmnt After replacing the row you mentioned, I still can get line oritentations where "AMUD" (with "inverted" D) is shown instead of "DUMA". Nov 7, 2021 at 11:57
• @TobiR See the updated. Nov 7, 2021 at 12:14