This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


3D line segments

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.


plot::Line3d([x1, y1, z1], [x2, y2, z2], <a = amin .. amax>, options)


plot::Line3d([x1, y1, z1], [x2, y2, z2]) creates a 3D line segment from (x1, y1, z1) to (x2, y2, z2).

The end points can be passed as lists or vectors.


AttributePurposeDefault Value
AffectViewingBoxinfluence of objects on the ViewingBox of a sceneTRUE
Colorthe main colorRGB::Blue
Extensionline extensionsFinite
Framesthe number of frames in an animation50
Fromstarting point of arrows and lines[0, 0, 0]
FromXstarting point of arrows and lines, x-coordinate0
FromYstarting point of arrows and lines, y-coordinate0
FromZstarting point of arrows and lines, z-coordinate0
Legendmakes a legend entry 
LegendTextshort explanatory text for legend 
LegendEntryadd this object to the legend?FALSE
LineColorcolor of linesRGB::Blue
LineWidthwidth of lines0.35
LineStylesolid, dashed or dotted lines?Solid
Namethe name of a plot object (for browser and legend) 
ParameterEndend value of the animation parameter 
ParameterNamename of the animation parameter 
ParameterBegininitial value of the animation parameter 
ParameterRangerange of the animation parameter 
TimeEndend time of the animation10.0
TimeBeginstart time of the animation0.0
TimeRangethe real time span of an animation0.0 .. 10.0
Titleobject title 
TitleFontfont of object titles[" sans-serif ", 11]
TitlePositionposition of object titles 
TitleAlignmenthorizontal alignment of titles w.r.t. their coordinatesCenter
TitlePositionXposition of object titles, x component 
TitlePositionYposition of object titles, y component 
TitlePositionZposition of object titles, z component 
Toend point of arrows and lines[1, 0, 0]
ToXend point of arrows and lines, x-coordinate1
ToYend point of arrows and lines, y-coordinate0
ToZend point of arrows and lines, z-coordinate0
Tubulardisplay 3D arrows and lines as tubes?FALSE
TubeDiameterdiameter of tubular arrows and lines. 1.0
VisibleAfterobject visible after this time value 
VisibleBeforeobject visible until this time value 
VisibleFromToobject visible during this time range 
VisibleAfterEndobject visible after its animation time ended?TRUE
VisibleBeforeBeginobject visible before its animation time starts?TRUE


Example 1

Plot two animated 3D line segments starting off parallel and ending up skew:

plot(plot::Line3d([0, 0, 0], [a, a, 1], a = 0..1),
     plot::Line3d([1, 0, 0], [a, 0, 1], a = 1..0))

In addition to LineStyle, LineColor and LineWidth, 3D line segments support the style option Tubular. If this is set to TRUE, the TubeDiameter can be set explicitly:

plot(plot::Line3d([0.1, 0, 0], [1, 0, 0]),
     plot::Line3d([0, 0.1, 0], [0, 1, 0]), 
     plot::Line3d([0, 0, -0.1], [0, 0,-1]), 
     ViewingBox = [-0.2..1.2,  -0.2..1.2, -1..0.2],
     Tubular = TRUE, TubeDiameter = 5.0*unit::mm)


x1, y1, z1

Coordinates of one end point: real numerical values or arithmetical expressions of the animation parameter a.

x1, y1, z1 are equivalent to the attributes FromX, FromY, FromZ.

x2, y2, z2

Coordinates of the other end point: real numerical values or arithmetical expressions of the animation parameter a.

x2, y2, z2 are equivalent to the attributes ToX, ToY, ToZ.


Animation parameter, specified as a = amin..amax, where amin is the initial parameter value, and amax is the final parameter value.

See Also

MuPAD Functions

MuPAD Graphical Primitives

Was this topic helpful?