plot::Point
-- graphical primitive
for a pointplot::Point
(x, y)
represents a plot of a
two-dimensional point with the coordinates (x; y).
plot::Point
(x, y, z)
represents a plot of
a three-dimensional point with the coordinates (x; y;
z).
plot::Point(x, y <, option1, option2...>)
plot::Point(x, y, z <, option1, option2...>)
x, y, z |
- | arithmetical expressions |
option1, option2, ... |
- | plot option(s) of the form OptionName =
value |
DOM_POINT
,
plot::Pointlist
,
plot::Scene
, RGB
plot
, plot2d
, plot3d
, plot::copy
, point
plot::Point
represent graphical
primitives for two- or three-dimensional points that can be displayed
via the call plot(...)
, or used with other graphical
primitives of the plot
library.plot::Point
, in difference to the standard
graphical primitive point
, allows arbitrary arithmetical
expressions. These expressions must evaluate to numbers at the time
where you plot the points.plot::Point
has 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] |
LineStyle | SolidLines, DashedLines | SolidLines |
LineWidth | positive integers | 1 |
PointStyle | Circles, FilledCircles, FilledSquares, Squares | FilledSquares |
PointWidth | positive integers | 30 |
Title | strings | |
TitlePosition | [x, y] |
|
plot2d
and plot3d
, respectively, 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.
::
.
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 point primitive:
attribute | meaning | properties |
coords |
The list of the coordinates of the point (list of two
or three arithmetical expressions). The initial value is the list
[x, y] and x, y, z] , respectively. |
read/write |
options |
A table of plot options of the point 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 point
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 point primitive in a
plot2d and plot3d conforming syntax,
respectively (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 |
refreshPlotdata |
A boolean value which signals whether the plot data of
the point primitive must be (re-)build with the method
"getPlotdata" (see below). If its value is
FALSE , then the plot data of the point primitive is stored
in the attribute plotdata . The initial value is
TRUE . |
read/write |
plot::Curve2d
for examples for working
with attributes of graphical primitives.An object of plot::Point
has either two or three
operands, namely the coordinates x
, y
and
z
, respectively.
Operands of a point primitive can be accessed either using the
system function op
, the
index operator [ ]
, or
using the attribute coords
described above. For
example, if point
is such an object, then the calls
op(point,1)
, point[1]
and
point::coords[1]
return the first coordinate of
point
.
Via point[1] := x_new
or point::coords[1] :=
x_new
, the first coordinate of point
is replaced by
x_new
.
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 point
is such an object, then
point::Color := RGB::Red
changes the color of the point to
red.
Evaluating an object of type plot::Point
returns
itself.
Calling an object of plot::Point
as a function yields
the object itself, regardless of the arguments. The arguments are
not evaluated.
is a table of plot options for point primitives and their default
values. Each entry has the form OptionName =
default_value
.
When an object of the domain plot::Point
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
and plot3d
, respectively, which are
used to plot the object. See the table of plot options above, which
gives a summary of the available plot options for point 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 points.
_index(dom point, positive integer i)
i
th coordinate of point
. If
i
is greater than the number of coordinates of
point
, then FAIL
is returned._index
, i.e., one may use it in the
form point[i]
, or in functional notation
_index(point, i)
.dimension(dom point)
point
.getPlotdata(dom point)
point
in a plot2d
and plot3d
conforming syntax,
respectively, i.e., it has the form [Mode = List, [point(...)],
...]
.
For example, with s := plot::Point::getPlotdata(point)
the call plot2d(s[1])
and plot3d(s[1])
,
respectively, gives a plot of point
.
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
and plot3d
, respectively, for lists of
primitives is used when plotting the object.plotdata
of point
.refreshPlotdata
of point
to
FALSE
.plot::Scene
to build the plot data of
the graphical scene.nops(dom point)
point
, i.e., the
integer 2 or 3.nops
, i.e., onemay use it in the form
nops(point)
.op(dom point, positive
integer i)
i
th coordinate of point
. If
i
is greater than the number of coordinates of
point
, then FAIL
is returned.op
, i.e., one may use it in the form
op(point, i)
.set_index(dom point, positive integer i, arithm. expr.
x)
i
th coordinate of point
to
the value x
.i
is greater than the number of coordinates of
point
, or if x
is not an arithmetical
expression, then a warning message is issued. In this case the call of
this method has no effect on the object point
.refreshPlotdata
of point
to
TRUE
.slot(dom point, string slotname)
slotname
of
point
. 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
point::slotname_id
(here, slotname_id
must be
the identifier corresponding to the string slotname
), or
in functional notation slot(point, slotname)
.slot(dom point, 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
point::slotname_id := val
(here, slotname_id
must be the identifier corresponding to the string
slotname
), or in functional notation slot(point,
slotname, val)
.refreshPlotdata
of
point
is set to TRUE
.convert(any p)
p
into an object of the
domain plot::Point
. If this is not possible, then
FAIL
is returned.p
is an object of the domain DOM_POINT
. If p
does
not have a color specification, then the default color for objects of
plot::Point
is used (see ``Details'' above).p
is a list of two or three arithmetical
expressions.convert_to(dom point, domain T)
point
into an object of
the domain T
. If this is not possible, then
FAIL
is returned.T
is the domain DOM_LIST
. Then the result is a list
of the coordinates of point
.T
is the domain DOM_POINT
. Then the result is a
system point primitive, i.e., an object of the domain type
DOM_POINT
.
Note that plot options can not be stored in such an object, except
of the option Color. However, the color
specification is used only if it is contained in the attribute
options
of the point primitive point
(see the
table of attributes above). Otherwise the default color specification
for system point primitives is used (see the help page of DOM_POINT
).
expr(dom point)
point
into an object of the
domain type DOM_POINT
. See the method
"convert_to"
above for details.checkOption(equation OptionName =
value)
OptionName
is a known plot
option for point 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 point)
point
.plot::copy
. See its help page for
details.modify(dom point, equation(s) Name1 = value1...)
point
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::Point
. 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 point
to
TRUE
.plot::modify
.print(dom point)
plot::Point([x, y]
and plot::Point([x, y, z]
,
respectively. It is used to print objects of plot::Point
to the screen.print
for details.We create the points (1; 2) and (3; -1), setting the color of the second point to green and its size to 50:
>> p1 := plot::Point([1, 2]); p2 := plot::Point([3, 1], Color = RGB::Blue, PointWidth = 50)
plot::Point(1, 2) plot::Point(3, 1)
To plot these two points in a graphical scene, enter:
>> plot(p1, p2)
Scene options may be given to the call of plot
, such as changing the style of the
axes and drawing grid lines in the background of the plot:
>> plot(p1, p2, Axes = Box, GridLines = Automatic)
Objects of the domain plot::Point
, and
objects of the basic domain DOM_POINT
are graphical primitives
for two- or three dimensional points. The main difference between
objects of these two domains is, that objects of
plot::Point
can be used together with other graphical
primitives of the library plot
such as function graphs, surface plots, point-list plots, and more.
To ease the use of such different objects, you can easily convert
objects of one domain into the other. For example, an object of the
domain plot::Point
such as:
>> p := plot::Point([1, 2])
plot::Point(1, 2)
can be converted into the domain DOM_POINT
as follows:
>> plot::Point::convert_to(p, DOM_POINT)
point(1.0, 2.0)
Note that because objects of the domain
DOM_POINT
only know the plot option Color, any other plot option set for the object
p
is lost by this conversion.
With the method "convert"
, objects can be converted
into the domain plot::Point
. For example, we convert the
list [1, 2, 3]
into the point (1; 2; 3) as an
object of the domain plot::Point
:
>> l := [1, 2, 3]: p:= plot::Point::convert(l)
plot::Point(1, 2, 3)
One may now override default values of some plot options
for the object p
as follows:
>> p::Color := RGB::Blue: p::PointWidth := 50: plot(p, Axes = None)