Use a transformation
Source file: Intro08
This example shows how to display a ready-made cube from the
Primitives class. It also includes the code necessary to stretch the cube using a scaling transformation. The method
createFullSceneGraphComponent() is a utility method which creates a SceneGraphComponent which contains an appearance and transformation. Notice also the use of the
MatrixBuilder class; it contains a variety of convenience methods for creating and concatenating 4x4 matrices together.
SceneGraphComponent myscene = SceneGraphUtility.createFullSceneGraphComponent("myscene"); myscene.setGeometry(Primitives.coloredCube()); MatrixBuilder.euclidean().scale(2,.8,1).assignTo(myscene); JRViewer.display(myscene);
This code should result in an image like this one from the User Tutorial: