For the latest version of JMP Help, visit JMP.com/help.


Scripting Guide > Three-Dimensional Scenes > Drawing Text > Using Text with Rotate and Translate
Publication date: 11/29/2021

Using Text with Rotate and Translate

The following example uses the text command in conjunction with the Translate and Rotate commands.

scene = Scene Box( 600, 600 ); // make a scene box...holds an OpenGL scene
New Window( "Example 2", scene ); // put the scene in a window
 

// the "lens" is 45 degrees, near is 3 units from the camera, far is 7

scene << Perspective( 45, 3, 7 );
 

// move the world so that 0,0,0 is visible in the camera

scene << Translate( 0.0, 0.0, -4.5 );
 

// rotate the first text about the Y (vertical on screen) axis

scene << Rotate( 30, 0, 1, 0 );
scene << Color( 1, 0, 2 ); // magenta
scene << Text( "center", "baseline", .2, "Top magenta string" );
 

// the next string is even farther away from the camera

scene << Translate( 0.0, 0.0, -2.0 );
 

// rotate the second text about the Y (vertical on screen) axis

scene << Rotate( 30, 0, 1, 0 );
scene << Color( 0, 1, 1); // aqua blue
scene << Text( "center", "baseline", .2, "Back aqua blue very long string" );
 

// update the display box in the window using the current display list

scene << Update;

Figure 13.14 Rotating and Translating Text StringsĀ 

Rotating and Translating Text Strings

Note that the aqua blue string extends backward beyond the far clipping plane. Change the 7 to 10 in the Perspective command to see the complete string.

Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).