plot::Ellipse2d -- graphical
primitive for a two-dimensional ellipse
Introductionplot::Ellipse2d(p, l1, l2) represents a
plot of a two-dimensional ellipse with center point p = (px;
py) and semi-axes of lengths l1 and l2.
Creating
Elementsplot::Ellipse2d(m, l1, l2 <, option1,
option2...>)
plot::Ellipse2d(p, l1, l2 <, option1,
option2...>)
Parametersm |
- | a list of two arithmetical expressions |
p |
- | a two-dimensional point, i.e., an object of the domain
plot::Point or DOM_POINT |
l1, l2 |
- | arithmetical expressions |
option1, option2, ... |
- | plot option(s) of the form OptionName =
value |
Related
Domainsplot::Point, plot::Rectangle2d, plot::Scene, RGB
Related
Functions
Detailsplot::Ellipse2d represent
graphical primitives for two-dimensional ellipses that can be displayed
via the call plot, or
used with other graphical primitives of the plot library. See example 1.plot::Ellipse2d
is a point p, then it is converted into a list containing
the two coordinates of p. Specified plot options for
p are ignored! (Cf. example 2.)plot::Ellipse2d 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] |
[Flat, RGB::Red]
|
| Filled | TRUE, FALSE |
FALSE |
| Grid | [n] |
[100] |
| LineStyle | SolidLines, DashedLines | SolidLines |
| LineWidth | positive integers | 1 |
| PointStyle | Circles, FilledCircles, FilledSquares, Squares | FilledSquares |
| PointWidth | positive integers | 30 |
| Smoothness | [n] |
[0] |
| Style | [Points], [Lines], [LinesPoints], [Impulses] |
[Lines] |
| Title | strings | |
| TitlePosition | [x, y] |
|
plot2d for further
details on each option, except of the option Filled, which is described in detail below.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 an ellipse primitive:
| attribute | meaning | properties |
center |
A list of two arithmetical expressions describing the
center point of the ellipse. The initial value is the parameter
m, or the list of the coordinates of p,
respectively. |
read/write |
options |
A table of plot options of the ellipse 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 ellipse
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 ellipse primitive in a
plot2d 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 |
radius1 |
The length of the first semi-axis (an arithmetical
expression). The initial value is the parameter l1. |
read/write |
radius2 |
The length of the second semi-axis (an arithmetical
expression). The initial value is the parameter l2. |
read/write |
range |
A range of the form a..b specifying the
range of the parameter of the ellipse in parametrized form.
a and b must be arithmetical expressions. The
initial value is 0..2*PI. Cf. example 3. |
read/write |
refreshPlotdata |
A boolean value which signals whether the plot data of
the ellipse primitive must be (re-)build with the method
"getPlotdata" (see below). If its value is
FALSE, then the plot data of the ellipse is stored in the
attribute plotdata. The initial value is
TRUE. |
read/write |
Option: Filled =value
TRUE the ellipse
is filled with the color specified with the option Color.
In this case, the ellipse is approximated by a (filled) polygon. The
number of the vertices of the polygon is the value n of
the option Grid(see the table of options
above).
Note that drawing a filled polygon with more than three vertices is quite time consuming in MuPAD!
The default is Filled =
FALSE.
An object of plot::Ellipse2d consists of the three
operands m, l1 and l2.
Operands of an ellipse primitive can be accessed either using the
system function op, the
index operator [ ], or
using some attributes described above. For example, if
ellipse is such an object, then the calls
op(ellipse,1), ellipse[1] and
ellipse::center return the center point of the
ellipse.
Via ellipse[1] := new_point or ellipse::center :=
new_point, the center point of an ellipse 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 ellipse is such an object, then
ellipse::Color := RGB::Red changes the color of
ellipse to red.
Evaluating an object of type plot::Ellipse2d returns
itself.
Calling an object of plot::Ellipse2d as a function
yields the object itself, regardless of the arguments. The arguments
are not evaluated.
is a table of plot options for ellipse primitives and their default
values. Each entry has the form OptionName =
default_value.
When an object of the domain plot::Ellipse2d 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
plot2d 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.
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 two-dimensional ellipses.
_index(dom ellipse, positive integer i)ith operand of ellipse. See
``Operands'' above for a description of the operands of
ellipse. If i is greater
than 3, then FAIL is returned._index, i.e., one may use it in the
form ellipse[i], or in functional notation
_index(ellipse, i).dimension(dom ellipse)getPlotdata(dom ellipse)ellipse in a plot2d conforming syntax. If the
option Filled of ellipse is set to
FALSE, then the plot description has the form [Mode
= Curve, [...], ...]. Otherwise, it has the form [Mode =
List, [polygon(...)], ...].
For example, with s :=
plot::Ellipse2d::getPlotdata(ellipse) the call
plot2d(s[1]) gives a plot of ellipse.
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 plot2d for curves is used when
plotting the object.plotdata of ellipse.refreshPlotdata of ellipse to
FALSE.plot::Scene to build the plot data of
the graphical scene.nops(dom ellipse)nops, i.e., one may use it in the form
nops(ellipse).op(dom ellipse, positive
integer i)ith operand of ellipse. See
``Operands'' above for a description of the operands of
ellipse. If i is greater
than 3, then FAIL is returned.op, i.e., one may use it in the form
op(ellipse, i).set_index(dom ellipse, positive integer i, any val)ith operand of ellipse to the
value val. See ``Operands'' above for a description of the
operands of ellipse.i is greater than 3, or if
val is not an admissible value for the ith
operand, then a warning message is issued. In this case the call of
this method has no effect on the object ellipse.refreshPlotdata of ellipse to
TRUE.slot(dom ellipse, string slotname)slotname of
ellipse. 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
ellipse::slotname_id (here, slotname_id must
be the identifier corresponding to the string slotname),
or in functional notation slot(ellipse, slotname).slot(dom ellipse, string slotname, any val)slotname to the value val. See the Details
above for existing attributes and options of an ellipse primitive.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
ellipse::slotname_id := val (here,
slotname_id must be the identifier corresponding to the
string slotname), or in functional notation
slot(ellipse, slotname, val).refreshPlotdata of
ellipse is set to TRUE.checkOption(equation OptionName =
value)OptionName is an available
plot option for ellipse 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 ellipse)ellipse.plot::copy. See its help page for
details.modify(dom ellipse, equation(s) Name1 = value1...)ellipse 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::Ellipse2d. 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 ellipse to
TRUE.plot::modify.print(dom ellipse)plot::Ellipse2d(p, l1, l2. It is used to print objects of
plot::Ellipse2d to the screen.print for details.
Example
1We create a plot of an ellipse with center point (1;2) and semi-axes of length 3 and 4:
>> ellipse := plot::Ellipse2d([1, 2], 3, 4)
plot::Ellipse2d([1, 2], 3, 4)
The center point can also be an object of the domain
plot::Point. The following
example creates the unit circle around the point (-1; -1),
filled with green color:
>> circle := plot::Ellipse2d(
plot::Point(-1, -1), 1, 1, Filled = TRUE, Color = RGB::Green
)
plot::Ellipse2d([-1, -1], 1, 1)
We plot these two objects in a graphical scene, where the scaling of the plot is changed to be constrained:
>> plot(ellipse, circle, Scaling = Constrained)
Example
2The attribute center, which specifies the
center point of the ellipse, is a list of two arithmetical expressions.
This is also the case if the center point of the created object was
given as an object of the domain plot::Point or DOM_POINT:
>> c := plot::Point([-1, 1]): ellipse := plot::Ellipse2d(c, 2, -2): ellipse::center
[-1, 1]
If you replace the value of the attribute
center, then the point must be given as a list of two
arithmetical expressions, otherwise a warning message is issued:
>> ellipse::center:= point(0, 0)
Warning: attribute 'center': expecting a list of two arithmeti\
cal expressions; assignment ignored [plot::Ellipse2d::slot]
point(0, 0)
>> ellipse::center
[-1, 1]
Note that if you specify an object of the domain
plot::Point or DOM_POINT as the center point
of the ellipse, then plot options of the point are ignored. For
example, if we change the color of the point c created
above to blue and create a new ellipse:
>> c::Color := RGB::Blue: ellipse := plot::Ellipse2d(c, 1, 1): plot(ellipse)
then the ellipse is still drawn in red color (the
default color of objects of the domain plot::Ellipse2d).
You must use the color option of the object ellipse to
change the color of the object:
>> ellipse::Color := RGB::Blue: plot(ellipse)
Example
3The value of the attribute range specifies
the range of the parameter of the ellipse in parametrized form. For
example, if we create a plot of the unit circle arount the point
(0; 0):
>> circle := plot::Ellipse2d([0, 0], 1, 1)
plot::Ellipse2d([0, 0], 1, 1)
and restrict the parameter of the circle to the interval [0, PI], we get the following plot:
>> circle::range := 0..PI: plot(circle)
See the help page of plot::Curve2d for more examples for
working with attributes of graphical primitives.