scale

scale

In interaction mode scale allows display and graphically read some informations with the means of 2D and 3D scales.
Default is continuous click, see the mouse(s) option to change the mode.

When invoked first time scale(id)type propr(p) ... creates the object type scale type with properties propr(p) ....
Then scale(id)type displays the scale each time it is invoked.
Thoses properries can be changed by scale(id)type propr(p) ... at any time.

See examples in file demo1_scale.func.

adjust        aim        ang        ascii        attach        audio
back
col
directory
Examples        eye
foc        font        func        format
input        illum
line        list
memory        move
number
obj        options
particle        period
radius        roll
scale
text        time
view
See also

Linear scale

scale

       Displays a scale in window (0,0, 100,115), and returns a float between 0.0 and 1.0 when clicking in the box, otherwise returns NIL.
The following Options allow to specify the parameters.

Scale options

scale("eee"): left displays the text "eee".
Notes:
the scale as well as its text, are displayed between x1 and x2, so it is necessary to provide texts the same dimension for scales displayed on several lines.
space and coma are illegal characters in the name of a scale.

add
abs
alphabet
coe
displ
ent
int
force
format
frame
law
message
mouse
poi
rectangle
rem
scale
validate



add: allows decrement or increment by clicking on <- or on ->.

abs: displays the scale even if no scale is active.

alphabet(r,g,b,rr,gr,br,rf,gf,bf): (r,g,b): text color (white default), (rr,gr,br): rectangular color, (rf,gf,bf): frame color.

center: the scale is centered in c0 ((c1+c2)/2 default).

coe(c1,c2,c): returns the clicked value (between c1 and c2) and keep if you do not click.
coe(c1,c2,c,c0): initializes c to c0 (marked) when clicking the small left frame.

displ: displays the clicked value.

ent: graduates the scale with integers and return an integer.
ent(1): graduates the scale with integers and displays the values.

int: returns an integer.
shows teh scale even if no scale is active.

format:
format(n,1): displays n scales on n lines and returns n clicked values.
format(1,n): displays n scales on one line and returns n clicked values.
format(2): displays a 2D scale and returns 2 clicked values.

format(3,0): displays a 3D scale and returns 3 clicked values.
Click on INI,initializes all scales.

frame(r1,v1,b1,r2,v2,b2): displays 2 frames colors (r1,v1,b1) and (r2,v2,b2) left and right of the clicked value (white and black default).

acc dec pend law(L): The scale is graduated in accelerated, decelerated,pendulum or according to law L (linear by default).

message:
message("eee"): right displays the text "eee".

mouse
mouse(0): non-blocking read (default).
mouse(1,id): blocking read, id is the identifier.
mouse(2): continuous read (without click).

poi(x1,y1,x2): in window (x1,y1-D_Fonte_y,x2,y1+3).
(x1=-200, y1=0, x2=200 by default).

rectangle(r1,g1,b1,r2,g2,b2): displays a small color (r1,g1,b1)on the clicked position on the color (r2,g2,b2) rectangle.

rectangle(r1_1,g1_1,b1_1,r1_2,g1_2,b1_2, r2_1,g2_1,b2_1,r2_2,g2_2,b2_2, ...): for option format.

rem(c0,c1,...); boxes c0,c1,... are not displayed nor executed (for scale number)..

scale(id): id is the identifier (displayed in the box) of an object type scale invoked by scale(id).
To change the parameters p of a property propr of this object simply write scale(id)proprp(p).

validate(v): returns the clicked value only v frames otherwise returns NIL.

scale ang

scale ang coe(a1,a2,a)

Displays three circles radius (d1,d2,d3) center (x,y) and color (rt,vt,bt).
Displays three segments respectively (r1,v1,b1, (r2,v2,b2 and (r3,v3,b3) from (x,y) and module r2 showing angles a1,a2,a0.
Displays the segment color (rt,vt,bt) and module d1 showing angle a.
Click inside circle center a change the value which is returned.
Click in the circle d3 reset the value to a0 which is returned.
Options:
col(r1,v1,b1,r2,v2,b2,r3,v3,b3): colors of the three segments (red, green, yellow by default).
dim(d): width of the segments (1 default).
disk(rd,vd,bd): color of the full disk (black default).
displ: displays the angle value.
frame(rf,gf,bf): displays frame color (rf,gf,bf) for option displ.
poi(x,y): center (0,0 default).
radius(d1,d2,d3): default d1=100, d2=.75*d1, d3=.25*d1;
rectanglee(rr,gr,br): displays rectangle color (rr,gr,br) for option displ.
scale("ttt": diplays message ttt in color (rt,vt,bt) (white default).
text(rt,vt,bt): circles and message color (white default).
mouse(s) option to change the mode.

scale ascii

scale(id)ascii

Displays a frame(0,0,200,25) (color white), when the mouse is inside this frame, a second white frame is displayed, one can enter a string, when ENTER is pressed this string is retuirned.
Note: id is needed.
Options:
col(r,g,b): text color.
frame(r,g,b): frame color.
rectangle(r,g,b): rectangle color.

scale attach

scale attach coe(num)

num is of the form 1,-1,1,...,1 (array of n items 1 or -1).
A linear scale of integers is displayed with numb. click on box i between 0 and n-1) changes the signe of num[i]. Boxes whose contents are positive are displayed with the color of rectangle(rr,vr,br) (black by default) and text is displayed in the text(rt,vt,bt) color (white default). The colors of boxes whose the contents are negative are reversed.
The command returns num (possibly modified).
The scales options are available.
Others options:
char("c"): char separator (; semi-colon default).
inv(v1,v2): exchanges values v1 and v2 instead of values -1 and 1.
text("t1;t2;...tn"): displays text t1 t2 ... tn instaed of numbers.
text(""): does not display the numbers.

scale audio

scale(id)audio("nnn.wav")

Reads file nnn.wav and create object type scale, identifier id and properties:
audio: audio signal.
max list of amplitudes each 1/25 second.
inv inv list of frequencies each 1/period second.
Options:
edit: displays informations when loading the file.
number(n): number of channels.
period(p): period (25 default).

scale(id)audio

Displays the content of the file.
Options:
coe(c): multiplier coefficient (-1 default).
col(r,g,b): color (white default).
frame(r,g,b): color of the frame (white default).
ini(start): first second displayed (0 default).
play(t): number of seconds (4 default).
poi(x1,y1,x2,y2): defining the window (0,0,100,100 default).
rectangle(r,g,b): color of the rectangle (black default).
Scales (seconds):
ini: start (first second).
play: duration (seconds).

Notes:
NP max scale("nnn.wav")audio returns np with np = number of items.
max(num)scale("nnn.wav")audio returns amp amplitude at image num.
inv(num)scale("nnn.wav")audio returns freq frequency at image num.
time scale(id)">time scale(id) returns the 1 / 25 seconds number of scale id.

Example: see record_play.func

scale illum

scale illum

Options are those of scales, with more:
radius(r): thickness axes (5 default) if option format(3).
vol(id): the volume id illum will be modified. Displays 5 scales:
illum: type 0 (linear), 1(flat), 2(Gouraud).
ref: reflexion between 0.0 and 1.0.
spe: spacular between 0.0 and 10.0.
bri: brightness between 0.0 and 10.0.
tran: transparency between 0.0 and 1.0.
The clicked values are assigned to illum and to volume id. Clicked values are assigned to illum and to volume id.
Examples:
scale("illum;ref;spe;bri;tran")poi(x1,y1,x2)illum format(1,5)rectangle(1,0,0, 0,0,0) vol(1);
Displays the 5 scales named illum, ref, spe, bri and tran in 5 windows on the same line (x1,y1-D_Fonte_y,x2,y1+3) red and black and assign the clicked values to illum and to volume 1.
scale("illum;ref;spe;bri;tran")poi(x1,y1,x2)illum format(1,5)rectangle(1,0,0, 0,0,0) vol(1);
The same on 5 lines.
scale illum; interactiely changes the illum coefficients and assign them to default volume displayed by displ illum (see an example in file demo1_illum.func).

scale col

scale col

Displays 3 scales red green and blue on black background and returns the clicked valued (r,g,b) which are assigned to col.
The scales options are available, in partucular:
displ: displays the 3 color components and INI (click on: default values 1.0).
format(1,3) 3 linear scales on one line (default).
format(3,1) 3 linear scales on one column.
format(3) 1 3D scale.
displ: displays the 3 components and the color at left top corner, click on INI in order to initialize the color.

Examples

Reading a float

f=scale("float")poi(x1,y1,x2,y2)coe(f1,f2,f,0)displ rectangle(1,0,0, 0,0,1);

Reading an integer on a graduated scale

e==scale("ent")poi(x1,y1,x2,y2)coe(e1,e2,e,0)displ ent rectangle;

Reading an integer on a non graduated scale

e==scale("int")poi(x1,y1,x2,y2)coe(e1,e2,e,0)displ int;

Reading an integer on a graduated scale with display

e=scale("ent(1)")poi(x1,y1,x2,y2)coe(e1,e2,e,0)ent(1)rectangle;

Reading a centered scale

c=scale("center")poi(x1,y1,x2,y2)coe(c1,c2,c,0)rectangle frame center displ;

scale directory

scale("sss")directory("ddd")

sss is the scale identifier (needed).
Displays the names of all the files of directory ddd click on one of them returns this name.
A little grey square allows resize and trnaslate the scale.
With option directory displays the names of the directories in the color green (click on one of them enter this directory), and the names of files in the color white (click on one of them returns this name).
Click the vertical arrow pops.
Click on reset returns to the main directory.
Options:
col(r1,g1,b1, r2,g2,b2):
       r1,g1,b1 = name file color (white default)
       r2,g2,b2 = name directory color (green default)
directory: displays the name of the directories (recommanded).
directory(0): reset root as directory.
format(f): allows resizing the window with f control points (1, 2 or 4).
frame(rc,vc,bc): displays the frame color (rc,vc,bc).
ini: returns the clicked name with absolute path, allowing acces to any file.
mouse(m): m=1 is default.
name("*.eee"): only files *.eee.
name("*.*"): all files.
poi(x1,y1,x2,y2): top left corner (x1=0, y1=0, x2=x1+200, y2=y1+300 by default).
rectangle(rr,vr,br): displays rectangle color (rr,rv,br).
text(r,g,b): displays the text in color (r,g,b) (white default).
validate(v): activates (v=1) or inhibits (v=0) the access to files of extension eee of folder ddd.
You can also type the name of the file after the > character is displayed over the names.
click on a directory name: loads thr names of the files of this directory.
click on the up arrow returns to the previous directory.
For long list a right vertical scale allows navigate.

See an application in function func_DIR() of the demo demo1_scale.func.
Examples: nn=scale("image")poi(0,y1,X1_SCA+200,Ye2-60)directory("*")directory name("*.*");
Allows read any file from any directory.

nn=scale("wav")directory("ima/")name("*.wav")poi(X1_ECH,y1,X2_ECH,y1+Dy1)rectangle(0,0,0);
if(nn!=NIL)
       {
       EXEC=compile message("system(nn)");
       }

Displays a vertical scale at point (X1_ECH,y1,X2_ECH,y1+Dy1), with black rectangle, of files ima/*.wav and plays the clicked file.

scale foc

scale foc poi(x1,y1,x2,y2)

Displaying 1 scale's choice of focal.

scale font

Displays scale font names with options. When clicking on a name returns this name and sets font accordingly.

scale func

scale coe(0,10,c)func("f")

Executes the function f(n) with n = number (>=0) of the clicked box.

scale back

scale back

Displays 3 red green blue scales and returns (r, g, b) clicked values which are affected to background color.
Options:
poi(x1,y1,x2,y2): in window (x1,y1,x2,y2).
format(f1,f2): format f (1,3 by default: 3 linear scales on one line).

scale format

line        column        2D        3D

scale format(1,n)poi(x1,y1,x2,y2)coe(C1,C2,...,Cn)

Ci=ci1,ci2,ci,ci0
Displays, in window (x1,y1,x2,y2) (0,0,100,15 default):
     n linear scales on one line allowing to choose the ci between ci1 and ci2 (ci0 initial value).
Options:
rectangle(c1, c2, ...): option rectangle(ci) for each scale, with ci=r1i,g1i,b1i, r2i,g2i,b2i for each scale i.

scale format(n,1)poi(x1,y1,x2,y2)coe(C1,C2,...,Cn)

Ci=ci1,ci2,ci,ci0
Displays, in window (x1,y1,x2,y2):
       n linear scales &on one allowing to choose the ci between ci1 and ci2 (ci0 initial value).
Options:
scale("ttt"): left displays the text "ttt".
"ttt" may be of ethe form: "t1 t2 ...", each word will be displayed on a sacle.
rectangle(k1,k2, ..., kn): each ki is a pair of colors (r1,v1,v1,r2,v2,b2) left and right of the clicked value.
text(rt,vt,bt)>: text color (white default).
Returna n clicked values c1,c2,...,cn.
Example:
R=V=B=0,1,.5,.5;red=1,0,0;green=0,1,0;blue=0,0,1;black=0,0,0;
K=red,black, green,black, blue,black;
w=scale format(1,3)poi(-200,0,200)coe(R,V,B)rectangle(K);
R[2]=w[0];V[2]=w[1];B[2]=w[2];

Displays 3 scales (red, green and blue) on one line and returns 3 values between 0.0 and 1.0 initialized to 0.5,0.5,0.5.

scale format(2)poi(x1,y1,x2,y2)coe(A,B)

A=a1,a2,a,a0, B=b1,b2,b,b0
Displays, in window (x1,y1,x2,y2) (-100,-100,100,100 default):
     2 axes with cursors to choose x and y.
Options:
abs: click on the axis, else in the plane (default).
rectangle(r1,v1,b1,r2,v2)
     r1,v1,b1 = x axis color (1,0,0 red default).
     r2,v2,b2 = y axis color (0,1,0 green default).
text(rt,vt,bt)>: text color (white default).
Returns the clicked values a,b.

scale format(3)poi(x1,y1,x2,y2)coe(A,B,C)

A=a1,a2,a,a0, B=b1,b2,b,b0, C=c1,c2,c,c0
Displays, in window (x1,y1,x2,y2) (-100,-100,100,100 default):
     3 axes with cursors to choose x, y and z.
Options:
frame(rc,vc,bc)>: text box color.
rectangle(r1,v1,b1,r2,v2,r3,v3,b3)
     r1,v1,b1 = x axis color (1,0,0 red default).
     r2,v2,b2 = y axis color (0,1,0 green default).
     r3,v3,b3 = z axis color (0,0,1 blue default).
text(rt,vt,bt)>: text color (white default).
Returns the 3 clicked values a,b,c.

scale adjust

scale adjust audio poi(x1,y1,x2,y2)

Shows five scales for changing the coefficients min max time c1 c2 of adjust audio and a scale showing the coefficient in boxes (x1,y1,x2,y1+x2-x1) (Xe1+20,0,Xe2-20,D_Fonte_y default).

scale aim

scale aim poi(x1,y1,x2)

Displays three scales of the choice of coordinates for the aim point in box (x1,y1,x2,y1+x2-x1) (0,0,100,100 default).
The format options are available.

scale input

scale("sss")input

     Builds the scale name sss, must be made only once.

scale("sss")input poi(x1,y1,x2,y2)

     Displays the scale name sss in the window (x1,y1,x2,y2).
returns the text typed in the window.
Options:
col(rr,gr,vr): text color.
frame(rr,gr,vr): frame color.
period(p): period of the first flicking character of the text.
rectangle(rr,gr,vr): rectangle color.
text("sss"): set the text.
Notes:
text scale("sss")input="": erases the text.
col scale("sss")input=r,g,b; encapsulates the text color.
frame scale("sss")input=r,g,b; encapsulates the frame color.
rectangle scale("sss")input=r,g,b; encapsulates the rectangle color.

Allows enter text from several windows.

scale line

scale("t")line(L)poi(x1,y1,x2,y2)

     Displays the 3D line L=x1,y1,z1, ...,xn,yn,zn (normalized between 0.0 and 1.0) in window (x1,y1,x2,y2), x are fixed, y are modified with the mouse.
Options:
frame(r,v,b): frame of color (r,v,b) (white default).
radius(r): clicking in the frame (side r) surrounding a vertex of L, otherwise the nearest vertex.
vertex(d): surrounding vertices with frames side d (6 default).
See displ line to change a line.

scale list

scale(id)list coe(v1,v2,...,vn)poi(x,y)

     Displays the list of v1,v2 ... vn and return the clicked value with the options, else returns NIL.

scale(id)list coe("ttt")poi(x1,y1,x2,y2)

     Displays text ttt in window (x1,y2,x2,y2) which can be resized and translated.
Note: id is required.

scale(id)list coe("w1\nw2\n ... wn")poi(x,y)

     displays the lines w1 w2 ... wn and returns the clicked line with options, else returns NIL.
Notes:
id is required.
Click on the for little squares at the corners of the window allows resize it.

scale list directory("ddd")name("*.eee")poi(x,y)

     Displays the list of files *.eee of directory ddd and return the clicked name with the options, else returns NIL.
Click on the for little squares at the corners of the window allows resize it.

scale list coe("w1 w2 ... wn")poi(x,y)

     Displays the list of words w1 w2 ... wn and return the clicked word with the options, else returns NIL.

scale memory

scale("t")memory(id)dim(n)

       Displays a scale, changes the content of the memory id at the index of the clicked box (between 0 and n-1) (switches from 0 to 1 and the reverse) and returns this index. The memory of dimension n is created if does not exist.
Useful to select objects.

scale("t")memory(num)dim(n)coe(c)

       The boxes flown by the mouse take value c (without clicking).

scale move

scale("t1 t2...")move(id)poi(x1,y1,x2,y2)[dim(d)]coe(C1,C2,..,Cn)[options]

     Builds the object scale move(id) which is a set of n overlapping scales in windows (x1, y1, x2, y2), moved by left clicking on the small square entry (top and left).
scales Ci=ci1,ci2,ci,ci0 of text ti.
With the scales options.
If dim(d) is present the small square of the input is of dimension d (y2-y1 default).
To do only once (for example in function F0 of interaction func(0,"F0")).

scale move(id)coe(C1,C2,..,Cn)

     Displays the scales and returns the C coefficients of ´scale("...")move(id) poi(...)coe(C1,C2,...,Cn)´. Moving the group by clicking on the small gray square dimension changed by the option dim(d) (y2-y1 default)
Called for each image.

scale number

scale number(num)coe(n1,n2,...numn)poi(x1,y1,x2,y2)

Displays a linear scale in window (x1,y1,x2,y2) of n boxes containing the values ni, the box value num is marked, returns the index of the box clicked.
Options
Example:
Ind=scale("num")poi(x1,y1)number(Ind)coe(Num_s)rectangle(KR)frame;
Num=Num_s[Ind];

scale obj

scale obj(num)poi(x1,y1,x2)

Displays a vertical scale whose boxes contain the names (or the numbers) of the objects obj. Returns the number corresponding to the clicked box, otherwise return NIL.
frame(rc,vc,bc): displays frames color (rc,vc,bc) (white default).
scale("eee"): displays the text eee (otherwise obj) above.
rectangle(rr,vr,br):displays rectangles color (rr,vr,br) (black default).
text(rt,vt,bt): text color (white default).
Example:
n=scale vol(number vol)poi(-200,-300,0)rectangle frame;
if(n!=NIL && n!=Num)Num=n;

scale eye

scale eye poi(x1,y1,x2)

Displays three scales of the choice of coordinates for the eye in box (x1,y1,x2,y1+x2-x1) (0,0,100,100 default).
The format options are available.

scale particle genetic

scale particle genetic(id)

       Returns the evaluations of all particles of genetic id.

scale particle(num) genetic(id)

       Returns the evaluation of particle num of genetic id.

scale particle average genetic(id)

        Returns the average evaluation of particles of the genetic id.
Notes:
1) The evaluation is done by the function func genetic(id).
2) generate genetic(id) evaluates all individuals.

scale period

scale period

     Displays a scale to change the periode display images with the options scales.

scale radius

scale("t1;t2;t3;...;tn")radius(r)poi(x,y)

     Displays a polygon center (x,y), radius r (100 default) and n sides. At each vertex i is displayed the text ti.
Options:
displ: display n barycentric coordinates of the mouse.
inside: displays only points inside the circle.
rectangle: opaque.
frame: wireframe.
col(r,v,b,rf,vf,bf) color.
Returns the n barycentric coordinates of the mouse (left click).

scale roll

scale roll poi(x1,y1,x2,y2)

Displays 1 scale of the choice of roll.

scale text

scale text("ak")coe(0,10,c)

     Displays a characters scale (between a and k) and returns the number c of the clicked box (between 0 et 10).

scale coe(0,nb-1,c)text("word_0 word_1 ...word_nb-1")

     Displays a words scale of nb words (mot0 mot1 ..) and returns the number c of the clicked box (between 0 and nb-1).
Notes:
For the boxes change color must the option rectangle rectangle(r1,v1,b1,r2,v2,b2)
For example rectangle(.5,.5,.5, 0,0,.5)
option frame(rc,vc,bc) displays frames of color (rc,vc,bc), allowing a better reading of the words.
option format(1) verticaly displays the scale.
attach mouse(1): keeps the clicked boxes.
Example:
In main program: T="A BC DEF";np=NP(T);Num=calloc(np,-1);
in F5 function: num=scale("sss")text(T)poi(-300,-200)coe(Num)attach rectangle(1,0,0, 0,0,1) frame frame mouse(1);
     Displays scales named sss with text A BC DEF, returns the flags num (1 if clicked otherwise -1).
character ; may be bspace or tab or , (comma) or <\n.

scale time

scale("ttt")time

Displays scale of the display rate (number of images per second) with the options.
Note:
("ttt") is requiered.

scale view

scale view poi(x1,y1,x2)

Changes the current view by displaying 3 lines in the box (x1,y1,x2,y1+2*(x2-x1)+60) (0,0,100,260 default):
     line 1: 3 scales to choose the eye coordinates.
     line 2: 3 scales to choose the aim direction coordinates
     line 3: scale to choose the foc
     line 4: scale to choose the roll.
     Click on rectangle marked INI: initializes.
Options:
Celles des échelles.
scale("eye aim foc roll"): left displays one of these messages of the corresponding scale.
format(1,4): scales on 4 lines and one column (default).
format(3,1): 3D scales for the eye and the aim, foc and le roll are on 2 scales on 2 lines.
view(id): changes the view id.

Examples:
scale view poi(-300,0,300,15)rectangle(1,0,0, 0,0,0)format(1,0);
     Displays 8 scales:
      &nbs; 3 for the eye on the 1st line.
          3 for the aim on a second line.
          1 for the focal on a 3rd line.
          1 for the roll 4th line.
scale view poi(-300,0,300,15)rectangle(1,0,0, 0,0,0)format(3,0);
     Displays 2 3D scales, one for the eye and one for the aim.
     Displays 2 linear scales, one for the focal and one for the roll.

See also:

dim scale
edit scale
ini scale
no scale
poi scale
yes scale