Code covered by the BSD License  

Highlights from
Ellipseselect

5.0

5.0 | 2 ratings Rate this file 4 Downloads (last 30 days) File Size: 4.38 KB File ID: #12569
image thumbnail

Ellipseselect

by Rajiv Narayan

 

08 Oct 2006 (Updated 09 Oct 2006)

An interactive ellipse selection tool

| Watch this File

File Information
Description

ELLIPSESELECT An interactive ellipse selection tool
 
    HE = ELLIPSESELECT('init', A, B, X0, Y0, PHI, STYLE)
Creates the ellipse and initialzes callbacks. Returns the handle of the ellipse HE.
    Ellipse parameters:
        A Length of the semi-major axis
        B Length of the semi-minor axis
        X0 Abscissa of the center of the ellipse
        Y0 Ordinate of the center of the ellipse
        PHI Angle (in radians) between x-axis and the major axis
        STYLE Definition of the plotted line style
    Usage:
    Once created, the ellipse shape can the adjusted interactively using the mouse.
    The center can be moved by dragging the 'x' at the center of the ellipse. The lengths of the axes can be adjusted by dragging on the red and black control points on the ellipse. The ellipse can be rotated through an arbitrary angle by left clicking and dragging on the ellipse boundary.
    The ellipse parameters are saved in the ellipse handle's userdata roperty and can be obtained using:
    PARAMS = ELLIPSESELECT('params', HE), where PARAMS is a structure with the ellipse parameters.
    The ellipse can be deleted by right clicking on the ellipse boundary and selecting 'delete' from the context-menu. Alternatively, the ellipse can be deleted programmatically by using the following call to ELLIPSESELECT.
    STATUS = ELLIPSESELECT('deletehandle',HE)
    STATUS returns 0 if the delete operation was successful, -1 otherwise.
   
    Example:
        %generate some data
        x=randn(500,2).*repmat([0.1,0.05],500,1);
        phi=pi/4; rotmat = [cos(phi),sin(phi);-sin(phi),cos(phi)];
        y=rotmat*x';
        scatter(y(1,:),y(2,:),'c.'); hold on
        axis([-1,1,-1,1])
        %create an ellipse
        he = ellipseselect('init',1,1,0,0,pi/4,'r-.');
        % modify ellipse line style
        set(he,'LineWidth',2);
        % get current ellipse parameters
        params = ellipseselect('params',he);
        % delete the ellipse
        status = ellipseselect('deletehandle',he);

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
EllipseDraw1.0

MATLAB release MATLAB 6.5.1 (R13SP1)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
16 Apr 2007 Tripti Bhaskaran

I found this code very useful and well documented.

13 Jan 2012 Anathea Pepperl

This code was very helpful and easy to use.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
data exploration Rajiv Narayan 22 Oct 2008 08:43:02
ellipse Rajiv Narayan 22 Oct 2008 08:43:02
selection Rajiv Narayan 22 Oct 2008 08:43:02
interactive Rajiv Narayan 22 Oct 2008 08:43:02
plot Rajiv Narayan 22 Oct 2008 08:43:02
gui Rajiv Narayan 22 Oct 2008 08:43:02
cluster Rajiv Narayan 22 Oct 2008 08:43:02

Contact us at files@mathworks.com