plot::Curve3d
-- graphical
primitive for a three-dimensional curveplot::Curve3d
([x, y, z], t = a..b)
represents a plot of the curve defined by t -> (x(t); y(t);
z(t)) with t in [a,b].
plot::Curve3d([x, y, z], t = a..b <, option1,
option2...>)
x, y, z |
- | arithmetical expressions in t |
t |
- | identifier |
a, b |
- | arithmetical expressions |
option1, option2, ... |
- | plot option(s) of the form OptionName =
value |
plot::Curve2d
,
plot::Function3d
,
plot::Surface3d
,
RGB
plot::Curve3d
represent graphical
primitives for three-dimensional curves that can be displayed via
plot(...)
, or used with other graphical primitives of the
plot
library.plot::Curve3d
has the type
"graphprim"
, i.e., if o
is such an object,
then the result of type(o)
is the string
"graphprim"
.option1
, option2
... are specified
by equations OptionName = value
. The following table gives
an overview of the available options:
OptionName |
admissible values | default value |
Color | [Flat] , [Flat, [r,g,b]] , [Height] , [Height, [r,g,b], [R,G,B]] , [Function, f] |
[Height] |
Grid | [ integer] |
[100] |
LineStyle | SolidLines, DashedLines | SolidLines |
LineWidth | positive integers | 1 |
PointStyle | Circles, FilledCircles, FilledSquares, Squares | FilledSquares |
PointWidth | positive integers | 30 |
Smoothness | [ integer] |
[0] |
Style | [Points] , [Lines] , [LinesPoints] , [Impulses] |
[Lines] |
Title | strings | |
TitlePosition | [x, y] |
|
plot3d
for further
details on each option.Scene options for the parameters
option1
, option2
... are not allowed! One may
pass scene options to the call of plot
, or use plot::Scene
to create an object
representing a graphical scene. Cf. example 1.
::
.
Each attribute has the property ``read'', i.e., the value of an
attribute attr
of a graphical primitive o
can
be read with o::attr
. If the attribute also has the
``write'' property, then the value of the attribute can be changed with
o::attr := new_value
.
The following attributes are available for a curve primitive:
attribute | meaning | properties |
options |
A table of plot options of the curve primitive. Note
that if you change the value of this attribute, the entries of the
assigned table are not checked to be valid plot options for curve
primitives. Invalid entries lead to runtime errors.
The initial value of this attribute is the table stored under the
domain entry |
read/write |
plotdata |
List of the plot data of the curve primitive in a
plot3d conforming
syntax (see the method "getPlotdata" below). Note that the
value of this attribute should only be used if the attribute
refreshPlotdata has the value FALSE (see
below). |
read |
range |
The parameter of the curve and its range. The initial
value is the parameter t = a..b . |
read/write |
refreshPlotdata |
A boolean value which signals whether the plot data of
the curve primitive must be (re-)build with the method
"getPlotdata" (see below). If its value is
FALSE , then the plot data of the curve primitive is stored
in the attribute plotdata . The initial value is
TRUE . See the help page of plot::Curve2d for an example. |
read/write |
term |
The term of the curve. The initial value is the
parameter [x, y, z] . |
read/write |
An object of plot::Curve3d
consists of two operands.
The first operand is the term of the curve specified as the list
[x, y, z]
. The second one is the parameter of the curve
and its range in the form t = a..b
.
Operands of a curve primitive can be accessed either using the
system function op
, the
index operator [ ]
, or
using the attributes described above. For example, if
curve
is such an object, then the calls
op(curve,1)
, curve[1]
and
curve::term
return the list [x, y, z]
.
Via curve[1] := [new_x, new_y, new_z]
or
curve::term := [new_x, new_y, new_z]
, the term of a curve
primitive can be changed.
See the methods "op"
, "_index"
,
"set_index"
and "slot"
below.
Use the slot operator ::
to get or set plot options of
such objects afterwards, i.e., when they have been created. For
example, if curve
is such an object, then
curve::Color := RGB::Red
changes the color of the curve
primitive curve
to red.
Evaluating an object of type plot::Curve3d
returns
itself.
Calling an object of plot::Curve3d
as a function yields
the object itself, regardless of the arguments. The arguments are
not evaluated.
is a table of plot options for curve primitives and their default
values. Each entry has the form OptionName =
default_value
.
When an object of the domain plot::Curve3d
is created,
then a copy of this table is stored under the attribute
options
(see the table of attributes above), where those
options are added and replaced, respectively, which are given by the
(optional) parameters option1
, option2
... of
the creating call (see ``Creating Elements'' above).
Plot options, which are not contained in the table stored under the
attribute options
will not be included in the plot data of
the object created by the method "getPlotdata"
(see
below).
For those options, the corresponding default value either is set by
a graphical scene, if the option also
exists as a scene option (such as the option PointWidth), or it is internally set by the function
plot3d
which is used to
plot the object. See the table of plot options above, which gives a
summary of the available plot options for curve primitives and their
default values. See example 2.
To change the default value of some plot options, the option name
and its default value may be added to the table
"defaultOptions"
, or replaced by a new value,
respectively.
is a set of the available option names for plots of three-dimensional curves.
_index(dom curve, positive integer i)
i
th operand of curve
. See
``Operands'' above for a description of the operands of
curve
. If i
is greater than 2,
then FAIL
is returned._index
, i.e., one may use it in the
form curve[i]
, or in functional notation
_index(curve, i)
.dimension(dom curve)
getPlotdata(dom curve)
curve
in a plot3d
conforming syntax, i.e., it
has the form [Mode = Curve, [...], ...]
.
For example, with s :=
plot::Curve3d::getPlotdata(curve)
the call
plot3d(s[1])
gives a plot of curve
.
options
(see the table of attributes above). For any other
plot option not contained in this table, the corresponding default
value set by the function plot3d
for curves is used when
plotting the object.plotdata
of curve
.refreshPlotdata
of curve
to
FALSE
.plot::Scene
to build the plot data of
the graphical scene.nops(dom curve)
nops
, i.e., one may use it in the form
nops(curve)
.op(dom curve, positive
integer i)
i
th operand of curve
. See
``Operands'' above for a description of the operands of
curve
. If i
is greater
than 2, then FAIL
is returned.op
, i.e., one may use it in the form
op(curve, i)
.set_index(dom curve, positive integer i, any val)
i
th operand of curve
by the
value val
. See ``Operands'' above for a description of the
operands of curve
.i
is greater than 2, or if
val
is not an admissible value for the i
th
operand, then a warning message is issued. In this case the call of
this method has no effect on the object curve
.refreshPlotdata
of curve
to
TRUE
.slot(dom curve, string slotname)
slotname
of
curve
. slotname
may either be the name of an
attribute or the name of a plot option. See the tables of available
plot options and attributes above.slotname
is the name of a plot option, but the
option is not contained in the table stored under the attribute
options
, then FAIL
is returned.
If slotname
is an invalid attribute or option, then an
error message is issued.
slot
, i.e., one may use it in the form
curve::slotname_id
(here, slotname_id
must be
the identifier corresponding to the string slotname
), or
in functional notation slot(curve, slotname)
.slot(dom curve, string slotname, any val)
slotname
to the value val
.slotname
, or if val
is not an admissible
value for slotname
, then a warning message is issued. In
this case, the value of slotname
remains unchanged.slot
, i.e., one may use it in the form
curve::slotname_id := val
(here, slotname_id
must be the identifier corresponding to the string
slotname
), or in functional notation slot(curve,
slotname, val)
.refreshPlotdata
of
curve
is set to TRUE
.checkOption(equation OptionName =
value)
OptionName
is an available
plot option for curve primitives (see the table of available plot
options above), and value
is an admissible value for this
option.[TRUE, OptionName,
newValue]
is returned. Note that the value of the option could
have been converted into an admissible format. Thus,
newValue
must be used as the value of the option
OptionName
instead of value
.[FALSE, error_msg]
is returned.
The string error_msg
is a description of the located
problem, which can be passed, for example, to the system function
error
to raise a
user-specified exception.copy(dom curve)
curve
.plot::copy
. See its help page for
details.modify(dom curve, equation(s) Name1 = value1...)
curve
and changes the
slots Name1
... of this copy to the new values
value1
...Name1
... must be names of attributes
or plot options of the domain plot::Curve3d
. Otherwise a
warning message is issued, and the slot remains unchanged. Also, if one
of the values value1
... is not an admissible value for the
corresponding attribute or plot option, respectively, the change of the
slot is ignored.
See the tables of available options and attributes above.
refreshPlotdata
of the copy of curve
to
TRUE
.plot::modify
.print(dom curve)
plot::Curve3d([x, y, z], t = a..b)
. It is used to print
objects of plot::Curve3d
to the screen.print
for details.The following call returns an object representing the graph of a spiral:
>> c1 := plot::Curve3d([sin(t), cos(t), t], t = 0..2*PI)
plot::Curve3d([sin(t), cos(t), t], t = 0..2 PI)
To plot this curve in a graphical scene, call plot
:
>> plot(c1)
Plot options of the curve can be given as additional parameters in the creating call, such as increasing the width of the lines of a graph and plotting the graph in green color:
>> c2 := plot::Curve3d([sin(t), cos(t), t], t = 0..2*PI, Color = RGB::Green, LineWidth = 50 )
plot::Curve3d([sin(t), cos(t), t], t = 0..2 PI)
>> plot(c2)
To change default values of some scene options, pass the
scene options to the function plot
as additional arguments. For
example, change the scaling of the plot and change the number of ticks
on the axes:
>> plot(c2, Scaling = Constrained, Ticks = [3, 3, 10])
See the help page of plot::Scene
for available scene
options.
If a curve primitive is created, values of some plot options of the created object can be read, or replaced by new values.
To illustrate this, we create the following curve:
>> c1 := plot::Curve3d([t*sin(t), t*cos(t), t], t = 0..4*PI)
plot::Curve3d([t sin(t), t cos(t), t], t = 0..4 PI)
We create a copy of this curve, change some plot options of the copied object, and plot both objects in a graphical scene:
>> c2 := plot::copy(c1): c2::Style := [Points]: c2::Grid := [30]: plot(c1, c2)
Plot options, which are explicitely set for a curve
primitive, are stored under the attribute options
and can
be read with the slot operator ::
. The plot options for
the first created object are:
>> c1::options
table( Grid = [100] )
These are default values of some plot options of
two-dimensional curve primitives, defined by the entry
"defaultOptions"
of the domain
plot::Curve3d
:
>> plot::Curve3d::defaultOptions
table( Grid = [100] )
When the plot data of a curve primitive is created
(calling the method "getPlotdata"
), only those plot
options are used that are contained in the table
c1::options
. Here these are:
>> plot::Curve3d::getPlotdata(c1)
[[Mode = Curve, [t sin(t), t cos(t), t], t = [0.0, 12.56637061], Grid = [100]]]
This means that for any other available plot option not
contained in the table c1::options
, the default value is
either set by plot::Scene
,
if the option also exists as a scene option, or internally set by the
function plot2d
when
plotting the object.
The curve primitive c2
contains the following
options:
>> c2::options
table( Style = [Points], Grid = [30] )
As you see, the option Style was
added to this table, and the default value of the option Grid was replaced by the new value [30]
. Use
delete
to remove plot
options:
>> delete c2::options[Style]: c2::options
table( Grid = [30] )
This example illustrates how to read and write attributes of curve primitives (see the table of available attributes in ``Details'' above).
In the last example, we already used the attribute
options
, which stores plot options defined individually
for a curve primitive and which overrides the corresponding default
values set by MuPAD.
The attribute term
holds the term of a curve primitive.
For example, if curve
is an object of
plot::Curve3d
such as:
>> c := plot::Curve3d([cos(t)*sin(t), t, t], t = -5..5, Color = RGB::Blue)
plot::Curve3d([cos(t) sin(t), t, t], t = -5..5)
then curve::term
returns the list:
>> c::term
[cos(t) sin(t), t, t]
We plot this curve:
>> plot(c)
Because the attribute term
has the
``write'' property, you can change the value of this attribute as
follows:
>> c::term:= [t, t, sin(t)*cos(t)]: plot(c)
The value of term
must be a list of three
arithmetical expressions, otherwise an error message is issued.