Facing text in 3D graphics with full options

I’m seeking a refinement/extension of the excellent and very valuable solution appearing here.

That solution indeed allows you to place text anywhere in a 3D graphics and then rotate it (by Euler angles) so it faces any direction you like.

However… it has two important limitations for my application:

  • For some reason it does not handle subscripts and superscripts: they are lost and not rendered
  • The solution does not allow a background color, such as Background -> White. (I need this when I’m placing a label atop a black line and want to hide a short section of the line.)

In sum: I’m hoping to get a version of text3D that could work with Style, of the form:

text3D[Style[Subscript[x, o], Italic, 24, Background->Yellow],  {x-position, y-position, z-position},  EulerAngle1, EulerAngle2, EulerAngle3] 

Minor point: I think the Euler angles should be grouped into a List… but again, minor suggestion:

text3D[Style[Subscript[x, o], Italic, 24, Background->Yellow],  {x-position, y-position, z-position},  {EulerAngle1, EulerAngle2, EulerAngle3}] 

Pass equations into shaders to define graphics – HLSL or other shaders

Is it possible with HLSL (or other popular shader languages) to pass instead of an image, an equation that would define the pixel color / position output by the shader? This would allow for more dynamic drawing of smooth shapes that could be sampled with infinite detail. They would also by able to change and morph in real time.

Not sure how this is possible without passing a string with the eq to the shader and having it parse it. Seems like that might lose all the performance gained by putting it onto the GPU.

Cannot get aspect ration to 1 with simple Graphics

I am learning Mathematica and doing a simple animation project which animates the harmonic motion of a pendulum. For some reason, I cannot get the simplest thing to work — the aspect ratio for my pendulum graph will not go to 1. I have whittled my code down to something extremely simple that illustrates my problem:

Graphics[Line[{{0, 0}, {.5, -.5}}], Axes -> True, PlotRange -> {{-1.1, 1.1}, {-1.1, 0}}, AspectRatio -> 1]

Output of the code above

Stretchable parentheses in text labels in Graphics

I’m trying to annotate a plot with points of the form $ \left(\frac{1}{2},\frac{1}{2}\right)$ ; my problem is that the parentheses don’t stretch to cover the fraction. I think that what I want to do is to use a StyleBox inside the Graphics primitive to allow me to format the string using SpanMaxSize, but StyleBox is not a text string. I cannot figure out how to make this work. Is there an easier way?

So for example, if I use

Graphics[Text[Style["(1/2,sqrt(3)/2)", Black, 12], {-1.1, .8}]] 

with the 1/2 and sqrt(3)/2 formatted in OutputForm, I get enter image description here

Using fewer mesh lines, 3D graphics

    I want to make the Final use fewer mesh lines,      the ideal version will look like the second image.     Where the triangle shape is more clear and clean. Can anyone give me some advice on how to fix my code?  

ex1 = ParametricPlot3D[{(3 + Cos[v]) Cos[u], (3 + Cos[v]) Sin[u], Sin[v]}, {u, 0, 2 Pi}, {v, 0, 2 Pi}, Boxed -> False, Axes -> False]

mesh = Import[Export[NotebookDirectory[] <> "ex1.stl", ex1]]

edges = MeshPrimitives[mesh, 1]

Final = Graphics3D[Map[Tube[#, .05] &, edges[[All, 1]]],Boxed -> False]

First image

Second image

Placing text over a rectangle using graphics

I need to add some text to rectangles that I am using as a scale bar. I want the text right above the rectangle and centered. Here’s my code:

Show[{Graphics[{Red, Rectangle[{0, 0}, {45, 15}]}, ImageSize -> 48],    Graphics[Text[Style["TEXT", 12, "TR", Black, Bold]]]}] 

enter image description here

Desired result:

enter image description here

How can I do that?

Edit: Ideally it should also work if the text is longer than the scale bar, like so:

Graphics[{Red, Rectangle[{0, 0}, {19, 15}],    Text[Style["TEXT", 14, "TR", Black, Bold], {10, 22}]},   ImageSize -> 19] 

The bar crops some of the text: enter image description here

slow and jerky Graphics in 12.1 compared to older version 9.0

Consider the following piece of code

Manipulate[ Graphics[ {{Gray, Line@Table[RandomReal[1.5 {-1, 1}, {2, 2}], {10000}]}, Dynamic[Disk[{0.1 a Cos[a], 0.12 Sin[a]}, 0.1]]}, PlotRange -> 1.5, FrameTicks -> False, Frame -> True], {a, 0, 4 \[Pi]}] 

Running the above code I find that the Graphics in newer versions of Mathematica (e.g. version 12.1) are jerky and are rendered considerably slower. I ran the same code in version 9.0 and it runs relatively smoothly.

Does someone know why this is so? and what changed between the older and the newer versions of Mathematica?

Map two input streams, one graphics objects and the other characters through Show

The question is how to sequentially execute Show with two streams of input. The first is graphics object stream and the second is a character stream for supplying labelling for the graphics. I tried

ss={{ListPlot[x1]},{ListPlot[x2],…};labelling={aa,bb,cc,dd….}; Map[Show[#1,PlotLabel->StringJoin[#2,”…”,”…”]]&,{ss,labelling}]

I tried both Map and MapThread to inconsistent results, i.e., works sometimes and not work some other times. It became consistent when I put the labelling elements into individual curly brackets, i.e., labelling={{aa},{bb},{cc},(dd)) Wonder why is this the case?

Can I convert my SMTShowMesh Object into a mathematica graphics object in AceFem?

My question is related to a string of questions Ive asked in the last few days. I’m trying to superimpose a vectorplot on a3D plot that I’ve produced on AceFem using the SMTShowMesh Command. I’m trying to get the vector field on the surface of the block to describe fibre directions at each node. I keep getting a “Could not combine the graphics objects in ” and . “Skeleton is not a Graphics3D primitive or directive.” the following graphics:enter image description here

I’m just trying to superimpose the graphics so that the vector field plot is on top the block. Without putting my whole code up, this command and a few other things is what I have tried so far.

SCnodes = StratumCorneumNodes; info = SMTNodeData[SCnodes, "X"]; Show[SMTShowMesh["BoundaryConditions" -> True] (*this is the command I used to produce the main block*),   Epilog \[RightArrow]    Inset[VectorPlot3D[{Cos[41], Sin[41], 0}, {x, MeshXmin,        MeshXmax}, {y, MeshYmin, MeshYmax}, {z, MeshZmin, MeshZmax},       Boxed -> False, Axes -> None, VectorPoints -> info,       VectorStyle -> Black, VectorScale -> Small] /.      Arrow[x_] :> Arrow[{Mean[x], Mean[x] + Last[x] - First[x]}],     StratumCorneumMastermesh[     "Wireframe"[      "MeshElementStyle" ->        Directive[{EdgeForm[], FaceForm[LightGray]}]]]]] 

I agree that the object I have produced in AceFem is not recognized as a £D graphics object in Mathematica. Is there any way I can convert it to an object? Any help would be much appreciated. Thank you