plot::Scene3d

Use only in the MuPAD Notebook Interface.

This functionality does not run in MATLAB.

Syntax

plot::Scene3d(object3d1, object3d2, …, <a = amin .. amax>, options)

Description

plot::Scene3d is a container to display one or more coordinate systems containing graphical objects. Scene objects must be created when several graphical scenes are to be displayed simultaneously in a plot.

Usually, you do not need to create a scene object explicitly, because a plot command such as plot(object1, object2, …) creates a default scene object implicitly to display the graphical objects in.

The need for creating scene objects explicitly arises only when several scenes are to be displayed simultaneously in one plot.

The MuPAD® graphics makes a clear division between 2D and 3D. Scene objects of type plot::Scene2d do not accept 3D objects and plot::Scene3d objects do not accept 2D objects. When several scenes are displayed simultaneously in a single plot, all scenes must be of the same dimension.

Strictly speaking, a 3D scene object is a container for coordinate systems of type plot::CoordinateSystem3d. However, you do not have to bother about this technicality because a suitable default coordinate system is created internally, when graphical primitives are passed to plot::Scene3d.

Scene objects are always visible in the interactive object browser of the MuPAD graphics tool (see section Viewer, Browser, and Inspector: Interactive Manipulation of this document). Each scene contains one or more coordinate systems as its children. When the scene object is selected, it provides access to a variety of attributes that are associated with scenes. The scene attributes allow to

  • set annotations (Header, Footer) and control the Legend,

  • set layout parameters such as height and width (if the canvas attribute Layout is set to Absolute or Relative),

  • set a direction for the automatic camera in 3D (CameraDirection),

  • set various style parameters such as BackgroundColor etc.

A complete listing of the attributes associated with a scene is given below. Follow the links to the help pages of the attributes to find more detailed information.

Apart from these attributes of the scene object, also attributes for the coordinate system and the graphical objects inside the scene can be specified when generating a scene object. These attribute values are inherited to the coordinate system and the graphical objects as new default values.

A plot may contain more than one graphical scene. In such a case, separate scene objects must be created explicitly by the user and passed to a plot command (or inserted into an object of type plot::Canvas). For details on the layout of scenes inside the drawing area ("canvas"), see the help page of the canvas attribute Layout.

Cf. Example 1.

Attributes

AttributePurposeDefault Value
BackgroundColorbackground colorRGB::White
BackgroundColor2second background color for color blendsRGB::Grey75
BackgroundStylecolor blends in the backgroundFlat
BackgroundTransparentplot a scene on a transparent backgroundFALSE
BorderColorcolor of frame/border around canvas and scenesRGB::Grey50
BorderWidthwidth of frame/border around canvas and scenes0
Bottomdistance of bottom of scene to bottom of canvas0
BottomMarginbottom margin width1
CameraDirectionthe direction of the automatic camera 
CameraDirectionXthe direction of the automatic camera, x-component 
CameraDirectionYthe direction of the automatic camera, y-component 
CameraDirectionZthe direction of the automatic camera, z-component 
Footerfooter text 
FooterFontfont of footers (scene and canvas)[" sans-serif ", 12]
FooterAlignmentalignment of footer of canvas and scenesCenter
Headerheader text 
HeaderFontfont of headers (scene and canvas)[" sans-serif ", 12]
HeaderAlignmentalignment of header of canvas and scenesCenter
Heightheights of canvas/scenes80
Leftdistance of left of scene to left of canvas0
LeftMarginleft margin width1
LegendFontfont of legend entries[" sans-serif ", 8]
LegendVisibleswitch legend on/offFALSE
LegendPlacementlegend above or belowBottom
LegendAlignmentlegend at left, center, or rightCenter
Lightinglight schemes for 3D graphicsAutomatic
Marginmargins around canvas and scenes1
Namethe name of a plot object (for browser and legend) 
RightMarginright margin width1
TopMargintop margin width1
Widthwidths of canvas/scenes120
YXRatioscaling ratio between y and x axes1
ZXRatioscaling ratio between z and x axes2/3

Examples

Example 1

Scene objects have to be created explicitly only when several scenes are to be displayed simultaneously in one plot. The following call uses the automatic layout of several scenes in a canvas:

S1 := plot::Scene2d(plot::Function2d(sin(x), x = 0..2*PI),
                    Header = "the sine function"):
S2 := plot::Scene2d(plot::Function2d(cos(x), x = 0..2*PI),
                    Header = "the cosine function"):
S3 := plot::Scene2d(plot::Function2d(tan(x), x = 0..PI),
                    Header = "the tan function"):
S4 := plot::Scene2d(plot::Function2d(cot(x), x = 0..PI),
                    Header = "the cot function"):
plot(S1, S2, S3, S4, BorderWidth = 0.5*unit::mm)

We use the canvas attribute Layout = Relative to position 3 of these scenes in the canvas. The size of the scenes is set with the attributes Width and Height, specifying multiples of the canvas' width and height. The bottom left corner of each scene is positioned with the scene attributes Bottom and Left:

S1::Width := 0.475: S1::Height := 0.42:
S2::Width := 0.475: S2::Height := 0.42:
S3::Width := 0.475: S3::Height := 0.42:
S1::Bottom := 0.46: S1::Left := 0.02: 
S2::Bottom := 0.02: S2::Left := 0.02:
S3::Bottom := 0.26: S3::Left := 0.51: 
S3::HeaderFont := ["Times New Roman", Italic, 12]:
plot(S1, S2, S3, Layout = Relative,
     BorderWidth = 0.5*unit::mm,
     plot::Scene2d::BorderWidth = 0.2*unit::mm,
     Header = "trigonometric functions",
     HeaderFont = ["Times New Roman", Bold, 18]):

delete S1, S2, S3, S4:

Example 2

Conic sections are the curves that you get when intersecting a cone and a plane. The first scene displays a plane and a rotating cone, the second the corresponding conic section:

c := plot::Cone(1, [-sin(a), 0, -cos(a)], [sin(a), 0, cos(a)], 
                a = 0..2*PI):
s := plot::Surface([x, y, 0], x = -1..1, y = -1..1):
S1 := plot::Scene3d(c, s):
S2 := plot::Scene3d(c, ViewingBoxZRange = -0.01 .. 0.01):
plot(S1, S2, Layout = Horizontal)

delete c, s, S1, S2:

Parameters

object3d1, object3d2, …

3D coordinate systems or graphical 3D objects

See Also

MuPAD Functions

MuPAD Graphical Primitives

Was this topic helpful?