Draw a rectangular patch defined by pos and curv.
The variable pos(1:2)
defines the lower left-hand corner of
the patch and pos(3:4)
defines its width and height. By
default, the value of pos is [0, 0, 1, 1]
.
The variable curv defines the curvature of the sides of the rectangle and may be a scalar or two-element vector with values between 0 and 1. A value of 0 represents no curvature of the side, whereas a value of 1 means that the side is entirely curved into the arc of a circle. If curv is a two-element vector, then the first element is the curvature along the x-axis of the patch and the second along y-axis.
If curv is a scalar, it represents the curvature of the shorter of the two sides of the rectangle and the curvature of the other side is defined by
min (pos(1:2)) / max (pos(1:2)) * curv
Additional property/value pairs are passed to the underlying patch command.
If the first argument hax is an axes handle, then plot into this axis,
rather than the current axes returned by gca
.
The optional return value h is a graphics handle to the created rectangle object.
See also: patch, line, cylinder, ellipsoid, sphere.
The following code
clf; axis equal; rectangle ("Position", [0.05, 0.05, 0.9, 0.9], "Curvature", [0.5, 0.5]); title ("rectangle() with corners curved");
Produces the following figure
Figure 1 |
---|
The following code
clf; axis equal; rectangle ("Position", [0.05, 0.05, 0.9, 0.4], "Curvature", 1.0); title ("rectangle() with sides as complete arcs");
Produces the following figure
Figure 1 |
---|
The following code
clf; axis equal; h = rectangle ("Position", [0.05, 0.05, 0.9, 0.4], "Curvature", 1.0); set (h, "FaceColor", [0, 1, 0]); title ("rectangle() with FaceColor = green");
Produces the following figure
Figure 1 |
---|
Package: octave