Skip to Main Content Skip to Search
Product Documentation

plot::Line2d2D line segments

plot::Line3d3D line segments

plot::Line2d([x_1, y_1], [x_2, y_2]) creates a 2D line segment between the points (x_1, y_1) and (x_2, y_2).

plot::Line3d([x_1, y_1, z_1], [x_2, y_2, z_2]) creates a 3D line segment from (x_1, y_1, z_1) to (x_2, y_2, z_2).

→ Examples

Calls:

plot::Line2d([x1, y1], [x2, y2], <a = amin .. amax>, Options)

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

Parameters:

x1, y1, z1

the 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

the 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.

See Also:

plot, plot::copy, plot::Polygon2d, plot::Polygon3d, plot::Rectangle

Details:

The end points may be passed as lists or vectors.

Example 1

We create a 2D line segement:

plot(plot::Line2d([1, 2], [3,-1]))

MuPAD graphics

The LineStyle can be changed from Solid, as is the default, to Dashed or Dotted. Likewise LineColor and LineWidth can be set explicitly:

plot(plot::Line2d([1, 2], [3, -1],
                  LineStyle = Dashed,
                  LineWidth = 2.5*unit::mm,
                  LineColor = RGB::Green))

MuPAD graphics

Example 2

We plot two animated 3D line segements starting off parallel, 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))

MuPAD graphicsimage

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)

MuPAD graphics

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS