Documentation

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.

From, To, FromX, FromY, FromZ, ToX, ToY, ToZ

Starting point of arrows and lines

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.

Value Summary

FromLibrary wrapper for “[FromX, FromY]” (2D), “[FromX, FromY, FromZ]” (3D)List of 2 or 3 expressions, depending on the dimension
ToLibrary wrapper for “[ToX, ToY]” (2D), “[ToX, ToY, ToZ]” (3D)List of 2 or 3 expressions, depending on the dimension
FromX, FromY, FromZ, ToX, ToY, ToZMandatoryMuPAD® expression

Graphics Primitives

ObjectsDefault Values
plot::Arrow2d, plot::Line2d

From: [0, 0]

To: [1, 0]

FromX, FromY, ToY: 0

ToX: 1

plot::Arrow3d, plot::Line3d

From: [0, 0, 0]

To: [1, 0, 0]

FromX, FromY, FromZ, ToY, ToZ: 0

ToX: 1

plot::Reflect2d 

Description

The vectors From and To determine the starting point and the end point, respectively, of arrows and lines.

From is a vector determining the position of the starting point of arrows and lines. Depending on the dimension, it is given by a list or vector of 2 or 3 components.

FromX etc. refer to the x, y, z components of this vector.

To is a vector determining the position of the end point of arrows and lines. Depending on the dimension, it is given by a list or vector of 2 or 3 components.

To etc. refer to the x, y, z components of this vector.

The values of these attributes can be animated.

Examples

Example 1

We define an arrow:

p := plot::Arrow2d([0, 0], [1, 2]):
plot(p):

The arguments are the starting point and the end point of the arrow. Internally, they are stored as the attributes From and To. We can access the object's attributes and change them:

p::From, p::To

p::From := [1, 0]:
p::To := [0, 1]:
plot(p):

delete p:

Example 2

The values of From and To can be animated. Here is a simple clock:

plot(plot::Circle2d(1, [0, 0], Color = RGB::Black),
     plot::Line2d([0.9*cos(a*PI/6), 0.9*sin(a*PI/6)], 
                  [1.0*cos(a*PI/6), 1.0*sin(a*PI/6)], 
                  Color = RGB::Black, LineWidth = 0.8*unit::mm)
                 $ a = 0 .. 11,
     plot::Line2d([0.95*cos(a*PI/30), 0.95*sin(a*PI/30)], 
                  [1.0*cos(a*PI/30), 1.0*sin(a*PI/30)], 
                  Color = RGB::Black, LineWidth = 0.5*unit::mm)
                 $ a = 0 .. 59,
     plot::Arrow2d([0, 0], [0.85*sin(12*a), 0.85*cos(12*a)], 
                   a = 0 .. 2*PI, LineWidth = 2*unit::mm),
     plot::Arrow2d([0, 0], [0.6*sin(a), 0.6*cos(a)], 
                   a = 0 .. 2*PI, LineWidth = 3*unit::mm),
     Axes = None, Frames = 600, TimeRange = 0..120):

Was this topic helpful?