Previous Page Next Page Contents

plot::Ellipse2d -- graphical primitive for a two-dimensional ellipse

Introduction

plot::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 Elements

plot::Ellipse2d(m, l1, l2 <, option1, option2...>)
plot::Ellipse2d(p, l1, l2 <, option1, option2...>)

Parameters

m - 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 Domains

plot::Point, plot::Rectangle2d, plot::Scene, RGB

Related Functions

plot, plot2d, plot::copy

Details

Option: Filled =

value

Operands

An object of plot::Ellipse2d consists of the three operands m, l1 and l2.

Important Operations

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.

Result of Evaluation

Evaluating an object of type plot::Ellipse2d returns itself.

Function Call

Calling an object of plot::Ellipse2d as a function yields the object itself, regardless of the arguments. The arguments are not evaluated.

Entries

defaultOptions

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.

optionNames

is a set of the available option names for plots of two-dimensional ellipses.

Method _index: indexed access to the operands of an ellipse primitive

Method dimension: dimension of an ellipse primitive

Method getPlotdata: create the plot data of an ellipse primitive

Method nops: number of operands of an ellipse primitive

Method op: extract operands of an ellipse primitive

Method set_index: set operands of an ellipse primitive

Method slot: read and write attributes and plot options

Method checkOption: check a plot option

Method copy: create a copy of an ellipse primitive

Method modify: modify a copy of an ellipse primitive

Method print: print an ellipse primitive

Example 1

We 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 2

The 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 3

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

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000