mouse

The command mouse may have several interpretations:
1) Invoked in interpreter mode allows it to enter graphic datas.
2) Invoked in interaction mode allows it returns the instantaneous state of the mouse.
3) As an option of graphic commands it lets you specify the input mode (continuous click, click or continuous).

Interpreter mode
Interaction mode
Dynamic mouse
mouse menu
mouse vol (designation)
See also

















































Interpreter mode

In interpreter mode mouse switches to mouse:
       Clic left: entering a point.
       Clic middle: removes the last point (in stream mode must move).

menu
Options
utilisation

Menu

       Clic right: gives a menu:
              keyboard: back to keyboard mode (or Esc).
              screen: clears the screen.
              click: entering by left click (default).
              stream: continous entering (left enfoncé).
              init: clears the screen and cancels the entry.

Options:

end
func
mouse(n)
poi
validate


mouse end("f"): switches to mouse, executes the function f () when returning to keyboard.

mouse func("f"): switches to mouse, executes the function f () at each image.
mouse func(0,"f"): switches to mouse, executes the function f () once at the begining.

mouse(n)

Switches to keyboard after capturing n points.
Exemple: mouse(1): to capture only one point.
mouse(s)poi(0): surrounds mouse.
mouse(s)poi(1): draws a frame between the the first position and the current position.
mouse(0)poi(2): draws a frame between the the first position and the current position, returns the firts and the last position if mouse is released, elswhere returns NIL.
Useful to capture an image in a frame (see demo1_image.func in function func_WIN()).
validate mouse returns the coordinates list of the clicked points.

Examples of use:

1) generate mouse image(id);
        switches to mouse, click 2 points, the inner portion of the image corresponding to the frame is stored in the image id.
2) mouse
        switches to mouse, click to capture points, ..., right bouton ->clavier to return interpreter mode.
p=validate mouse
        p returns the input polygonal line.

Interaction mode

mouse

Returns: x,y,0,num,down with:
       x,y: mouse coordinates -DX/2 <=x < DX/2 et -DY/2 <=y < DY/2
              where (DX,DY) = screen size (given by dim screen).
       num: number of the button pressed: 0 (left), 1 (middle), the right button gives acces to interaction menu.
       down: 1 (one button is pressed), 0 (no one button is pressed).
Options:
mouse(0): blocking read (default).
mouse(1): not blocking read .
mouse(2): continous read (without click).

mouse(x,y)

Changes the last position of the mouse in x,y.
Options:
mouse(x,y,n): changes the number of captured positions of the mouse in n.

acc      average      arc
col
dim      dist      draw
frame
ini      input
limit
mode      module
normal
poi
pull
radius
speed
traj
Examples

acc

Returns the mouse displacement acceleration with mode 2

mouse arc

Displays arcs center (0,0 and radius 90,110 and returne the coordinates of the clicked point between the arcs else retuens NIL.
Options:
arc(d): radius d-10 and d+10.
arc(d1,d2): radius d1 and d2.
col(r1,g1,b1,r2,g2,b2): color (white default).
mouse(m)
poi(x,y): center (x,y).
segment: displays segment(center,clicked point).
disk(r): displays disk radius r (6 default) at clicked point (color white or r2,g2,b2).

average(n)

Returns the average value of mouse along n images (1 <= n <= 250).

col(r,v,b)

Displays the frame (or the disk) in color (r,v,b) (white default).

dist(d)

Only captures points whose distance is > d. It is necessary do: ini mouse only once before capturing.
An example in function func_SOURIS_DISQUE() of file demo1_limit.func.
To capture several frames without ambiguity see l´option dist.

mouse draw

Displays a frame at the current position.
Options:
col(r,g,b): color r,g,b (white default).
frame(f): dont display a frame if f==0.
radius(rx,ry): sizes rx,ry (6,6 default).
segment: displays a cross.
Example:
mouse draw frame(0)segment col(0,1,0)radius(12,6);
       Displays a green cross size 24,12.

frame(rx,ry)

Frame size (rx,ry) is displayed at the up position of mouse.

ini

Must be invoked only once before mouse dist.

input

Allows capture a frame: click left then drga the mouse with left button pressed: a frame is displayed. Release the button, the command returne the 4 coordonates of the frame.
Options:
col(r,v,b): color of the frame (1,1,1 default).

limit (v1,v2)

If the value returned is 1-dimensional, they are limited in the interval (v1,v2).
Example: mouse acc module limit(2,8);
limit(x1,y1,x2,y2): if the value returned is 2-dimensional, they are limited in the box (x1,y1,x2,y2).
Example: mouse speed limit(-10,-10,0, 10,10,0);
mouse limit(x1,y1,x2,y2); processes only the interior points to the frame (x1,y1,x2,y2).
Options:
color(r,g,b[,rg,gg,bg]): in color r,g,b (white default).
dim(nx,ny): the value returned is a vertex of the grid nx,ny boxes which is displayed in color rg,gg,bg of the option color (white default).
displ(r,g,b): frame displaying in (r,g,b) colour (white default).
frame(x1,y1,x2,y2)exec: Returns (x1,y1,x2,y2) as amended (the corner nearest the mouse click takes this position).
validate: returns NIL if the mouse is outside the box (x1,y1,x2,y2), returns 0 if a button is pressed, otherwise returns -1.

Mode

mouse(0): no blocking click (default): returns s if left click (continous mode), otherwise NIL.
mouse(1): blocking click : returns s every clic left, else returns NIL.
mouse(2): continous without click: retourne s.

module

Returns the module.
Example:mouse acc module: returns the acceleration module.

normal

Returns (x,y,0).
x,y = The mouse normalized coordinates between -.5 and .5
down = 1 (one button is pressed), 0 (no button is pressed).

(-.5,-.5)--|---------(0,-.5,0)------|(.5,-.5)
----------|------------------------|
----------|------------------------|
(-.5,0)---|---------(0,0)----------|(.5,0)
----------|------------------------|
----------|------------------------|
(-.5,.5)---|----------(0,.5)--------|(.5,.5)

mouse normal(x1,y1,x2,y2) returns the mouse normalized coordinates between (x1,y1) and (x2,y2).
Example
mouse normal(0,0,1,1): returns the mouse normalized coordinates between 0 and 1.



mouse pull: displays segment(last position, mouse up).



mouse radius: returns the mouse radius.
mouse radius=r: sets the mouse radius (12 default).
Note: a circle radius r is displayed at the mouse location.

mouse speed: returns the speed of the mouse displacements (vx,vy,0) in mode 2.
Examples:
mouse speed limit(-10,-10,-10,10,10,10);
mouse speed module limit(2,8);
mouse speed(0) module limit(2,8);

mouse traj

mouse traj t vol(id)

        Returns the property mouse of trajectory type t of volume id.

mouse(c)traj t vol(id)

        Changes this property.
Note:
the trajectory type t of volume id is modulated by c * pos, where ppos is the normalized position of the mouse in continuous reading.

Exemples

1) mouse disk(50,75,100): returns the mouse position limited to the disk center (50,75) and radius 100.
2) See function func_func_SOURIS_DISQUE() of file demo1_limit.func.
To capture several disks radius without ambiguity see option dist.
limit(x1,y1,x2,y2): considers only the points inside the window (x1,y1,x2,y2).

dynamic mouse

Stockage        adjust
compute        col
dim        dynamic dist        dynamic displ
end        line        limit
normal
radius
smooth        speed
tan        time
var
speed

dynamic mouse

       Stores a sample.

Calculation

When samples n were stored n the analysis of dynamic properties of the mouse are computed

mouse dynamic displ

       The stored curve is displayed (white) and the tangent line (in red), normal (green) and the circle of curvature (centered at center of curvature radius and the radius of curvature).

mouse dynamic dim

       Returns the number of values ??displayed.

mouse dynamic dim(n)

       Changes this number.

mouse dynamic adjust

       Returns the adjustment coefficient.

mouse dynamic ajsut(1)

       Changes this coefficient.
Remarque: Entering a point is adjusted for two previous entries.

mouse dynamic col

       Returns the tangente and normal colors.

mouse dynamic col(rc,vc,bc, rt,vt,bt, rn,vn,bn)

       Changes these colors.

mouse dynamic dim

       returns the stored samples number.

mouse dynamic dim(n)

       Declare a buffer storing the dynamic analysis of the mouse on n samples (n >= 3).
Note:
It is necessary to invoke this command to launch the dynamic mouse (dim(15) is a good value).

mouse dynamic dist

       Returns the minimum distance of two samples (5 default). h3>mouse dynamic dist(d)        Changes this distance.

mouse dynamic end

       To exit cleanly from mouse mode dynamic.

mouse dynamic line

       Returns the 3D le buffer (t,x,y) of n stored values.

mouse dynamic limit

       Returns the capture limit.

mouse dynamic limit(x1,y1,x2,y2)

       Capture is limited to boxe (x1,y1,x2,y2).
Options:
limit(x1,y1,x2,y2,r,v,b): displays the frame with color (r,v,b) (white default).

mouse dynamic smooth

       Returns the smooth coefficient.

mouse dynamic smooth(d)

       Changes this coefficient.
Note: points located more than d will be smoothed

mouse dynamic normal

       Returns the unit vector of the mouse normal.

mouse dynamic radius

       Returns the radius of curvature.

mouse dynamic tan

       Returns the unit vector tangent to the mouse.

mouse dynamic time

       Returns the tempo (1000 default).

mouse dynamic time(t)

       Changes this tempo.
Notes:
1) The first component is the time in seconds 1/tempo at which was captured the sample.
2) This command changes the period.
3) A good value is 1000.

mouse dynamic var

       Returns the length of the stored curve.

mouse dynamic speed

       Returns the curvilinear velocity.

mouse menu

mouse menu("MEN")

       Returns the input mode of the mouse to the menu ("MEN") (1 by default, ie click).

mouse menu("MEN")=s

       Changes this mode.
Note:
mouse menu("MEN")=s1,s2,... to assign a particular mode for each box.

mouse vol

mouse vol

       Picking operation: returns (v, s) with v = volume number and s = clicked vertex number, otherwise NIL, and modifies the designated point by bringing the mouse position if the option pull is present.
Returns NIL if no designation.
Note:: designation is in no pers, for other views use one of the options pers left right front behind above below, see demo1_mouse.func.
Options:
above: bottom view.
abs: if does not run properly.
behind: behind view.
below: below view.
col(r,v,b): color of the capture frame.
disk(r,n): shows a circle center mouse, radius r and n sides (n = 12 by default).
displ: displays the vol number and the vertex number when click on it.
front: front view.
left: left view.
limit(x1,y1,x2,y2): Captures only points inside the frame (x1, y1, x2, y2) which is displayed in the color (r, g, b) (white by default).
number: displays the numbers of the designated volume and vertex.
pers: perspective. the search point takes place in the circle.
right: right view (default).
pull: the designated point is the position (xs, ys) of the mouse.
the numbers of the designated volume and vertex are returned.
vol(id): designates only the vertices of the volume id (default all volumes)
See demo1_pull.func to enter points in different views (front, behind, below, above, right et left).

See also:

ang mouse
dim mouse
displ mouse
edit mouse
generate image mouse
graphic mouse
interaction mouse
no mouse
tran inv vol mouse
validate mouse
yes mouse