Herror ::gen_ellipse (
    Hobject *Ellipse,
    const HTuple &Row,
    const HTuple &Column,
    const HTuple &Phi,
    const HTuple &Radius1,
    const HTuple &Radius2
)
HRegion HRegion::GenEllipse (
    const HTuple &Row,
    const HTuple &Column,
    const HTuple &Phi,
    const HTuple &Radius1,
    const HTuple &Radius2
)
HRegionArray HRegionArray::GenEllipse (
    const HTuple &Row,
    const HTuple &Column,
    const HTuple &Phi,
    const HTuple &Radius1,
    const HTuple &Radius2
)

Create an ellipse.

The operator ::gen_ellipse generates one or more ellipses with the center (Row, Column), the orientation Phi and the half-radii Radius1 and Radius2. The angle is indicated in arc measure according to the x axis in mathematically positive direction. More than one region can be created by passing tuples of parameter values.

The center must be located within the image coordinates. The coordinate system runs from (0,0) (upper left corner) to (Width-1,Height-1). See ::get_system and ::reset_obj_db in this context. If the ellipse reaches beyond the edge of the image it is clipped to the current image format according to the value of the system flag 'clip_region' (::set_system).


Parameters

Ellipse (output_object)
region(-array) -> Hobject * : HRegion(Array)
Created ellipse(s).

Row (input_control)
ellipse.center.y(-array) -> HTuple.double / long
Line index of center.
Default value: 200.0
Suggested values: 0.0, 10.0, 20.0, 50.0, 100.0, 256.0, 300.0, 400.0
Typical range of values: 1.0 <= Row <= 1024.0 (lin)
Minimum increment: 1.0
Recommended increment: 10.0

Column (input_control)
ellipse.center.x(-array) -> HTuple.double / long
Column index of center.
Default value: 200.0
Suggested values: 0.0, 10.0, 20.0, 50.0, 100.0, 256.0, 300.0, 400.0
Typical range of values: 1.0 <= Column <= 1024.0 (lin)
Minimum increment: 1.0
Recommended increment: 10.0

Phi (input_control)
ellipse.angle.rad(-array) -> HTuple.double / long
Orientation of the longer radius (Radius1).
Default value: 0.0
Suggested values: -1.178097, -0.785398, -0.392699, 0.0, 0.392699, 0.785398, 1.178097
Typical range of values: -1.178097 <= Phi <= 1.178097 (lin)
Minimum increment: 0.01
Recommended increment: 0.1

Radius1 (input_control)
ellipse.radius1(-array) -> HTuple.double / long
Longer radius.
Default value: 100.0
Suggested values: 2.0, 5.0, 10.0, 20.0, 50.0, 100.0, 256.0, 300.0, 400.0
Typical range of values: 1.0 <= Radius1 <= 1024.0 (lin)
Minimum increment: 1.0
Recommended increment: 10.0
Restriction: Radius1 > 0

Radius2 (input_control)
ellipse.radius2(-array) -> HTuple.double / long
Shorter radius.
Default value: 60.0
Suggested values: 1.0, 2.0, 4.0, 5.0, 10.0, 20.0, 50.0, 100.0, 256.0, 300.0, 400.0
Typical range of values: 1.0 <= Radius2 <= 1024.0 (lin)
Minimum increment: 1.0
Recommended increment: 10.0
Restriction: (Radius2 > 0) && (Radius2 <= Radius1)


Example
open_window(0,0,-1,-1,"root","visible","",&WindowHandle);
set_insert(WindowHandle,"xor");
do {
  get_mbutton(WindowHandle,&Row,&Column,&Button);
  gen_ellipse(&Ellipse,(double)Row,(double)Column,Column / 300.0,
         (Row % 100)+1.0,(Column % 50) + 1.0);
  disp_region(Ellipse,WindowHandle);
  clear_obj(Ellipse);
} while(Button != 1);

Complexity

Runtime complexity: O(Radius1 * 2)

Storage complexity (byte): O(Radius1 * 8)


Result

If the parameter values are correct, the operator ::gen_ellipse returns the value H_MSG_TRUE. Otherwise an exception handling is raised. The clipping according to the current image format is set via the operator ::set_system('clip_region',<'true'/'false'>).


Possible Successors

::paint_region, ::reduce_domain


Alternatives

::gen_circle, ::gen_region_polygon_filled, ::draw_ellipse


See also

::disp_ellipse, ::set_shape, ::smallest_circle, ::reduce_domain


Module

Region processing



Copyright © 1996-2002 MVTec Software GmbH