The basic geometric objects used in funct are points,
vectors, lines, circles and polygons.
Points are defined using the command point :
- funct -> point A
creates a point whose name is A. The default coordinates of this point are (0,0). The command coord can then be used to change them :
- funct -> coord A 2.2 3.1
will change the coordinates to (2.2,3.1). The numerical parameters can be expressions understood by the expression evaluator of the command interpreter. For example
- funct -> coord A x+sin(t) 3*y
The command show is used to print the coordinates of a point :
- funct -> show A
will print something like
x = 2.2
y = 3.1
and the variables point_x and point_y will contain the coordinates of the point. They can be used in arguments of subsequent commands. For example
- funct -> point B
- funct -> coord B point_x+1 point_y-1
Point can be drawn on graphics using the command draw :
- funct -> draw A X F
will draw the point A on an X window with respect to the frame F (cf. 3.5.3). This command is mainly used to start drawing a segment :
- funct -> draw_to B X F
will draw the segment from A to B, and B will be the beginning of another segment, if any.
Several commands involving other types of geometric objects can determine the coordinates of points, for example one of these compute the intersection of two lines. In this case the points must have been defined previously, the command will only compute their coordinates.
Vectors are defined using the command vector :
- funct -> vector U
creates a vector whose name is U. The default coordinates of this vector are (0,0). The command coord can then be used to change them :
- funct -> coord U 2.2 3.1
will change the coordinates to (2.2,3.1). The numerical parameters can be expressions understood by the expression evaluator of the command interpreter. For example
- funct -> coord U x+sin(t) 3*y
The command show is used to print the coordinates of a vector :
- funct -> show U
will print something like
x = 2.2
y = 3.1
and the variables vector_x and vector_y will contain the coordinates of the point. They can be used in arguments of subsequent commands.
Addition, substraction, multiplication by a scalar can be used for vectors as for usual numerical objects (see the documentation of interpcom). For example, if U, V, W are vectors,- funct -> add U V W
will add U to V and put the result in W. It is possible to define the vector from one point to another :
- funct -> vector_p A B U
Here A, B are points and U a vector, previously defined. This command puts in U the vector from A to B. Conversely, given a point and a vector, there is a command to compute the point obtained by adding the vector to the point :
- funct -> point_v A U B
will add U to B and put the result in B.
Vectors can be acted on by linear transforms (cf. 3.8.2). The scalar and exterior product of two
vectors can be computed using the commands
int_prod and ext_prod respectively (cf. 3.9).
Lines are defined using the command line :
- funct -> line L
creates a line whose name is L. A line is defined by a point on it and a unit vector. The default parameters for a line are (0,0) for the point and (1,0) for the vector. The command coord can then be used to change them :
- funct -> coord L A U
will make A the origin of L and U divided by its length its unit vector. If U is zero the unit vector is not changed. Of course in the preceeding command A and U must have been previously defined.
The command show is used to print the coordinates of a line :
- funct -> show L
will print something like this
x = 1
y = -1
u = 0.4472135954999579
v = 0.8944271909999159
meaning that the origin of L is the point of coordinates (1,-1) and
its unit
vector
(0.4472135954999579,0.8944271909999159). After this command the
variables line_p_x and line_p_y will contain the
coordinates
of the origin of the line and line_v_x, line_v_y
those of
its unit vector.
They can be used in arguments of subsequent commands.
Circles are defined using the command circle :
- funct -> circle C
creates a circle whose name is C. A circle is defined by its center and its radius. The default parameters for a circle are (0,0) for the center and 1 for the radius. The command coord can then be used to change them :
- funct -> coord C A 0.7
will make A the center of C and 0.7 its radius. Of course A must have been defined before the preceeding command. Instead of 0.7 we could put a numerical expression understood by the expression evaluator.
In the definition of a circle only the coordinates of its center are kept : it is possible to destroy the point A and the center of C will not be changed.
The command show is used to print the coordinates of a circle :
- funct -> show C
will print something like this
x = 1
y = -1
R = 0.7
meaning that the center of C is the point of coordinates (1,-1) and
its radius
is 0.7. After this command the
variables center_x and center_y will contain the
coordinates
of the center and Radius the radius.
Polygons are sequences of points, called vertices. Polygons are defined using the command polyg :
- funct -> polyg P 100
creates a polygon whose name is P, with 100 vertices. The number of vertices can be changed by subsequent commands. The default coordinates for the vertices of a polygon are (0,0). The command coord can then be used to change them :
- funct -> coord P 52 0.7 2.4
will give the coordinates (0.7,2.4) to the 52th vertex of P. Instead of 52, 0.7, 24 we could put numerical expressions understood by the expression evaluator.
The command show is used to give informations about a polygon :
- funct -> show P
will print something like this
number of vertices : 100
not curvilinear
sides not computed
and the variables pol_nb, pol_curv, pol_calc, pol_step will contain respectively 100, 0, 0, 0.
The command polyg_curv can be used to transform a polygon in a curvilinear one :
- funct -> polyg Q 10
- funct -> polyg_curv P Q 1000
will first define a new polygon Q, with 10 vertices. The second instruction will change this number of vertices to 1001, and will use P to compute the vertices of Q : they are equally spaced and on P, the first and last ones beeing the same as P. Moreover the unit tangent vectors and acceleration vectors at each vertex of Q will be computed. The command
- funct -> show Q
will then print something like this
number of vertices : 1001
curvilinear
length : 23.35688555774
sides computed
and the variables pol_nb, pol_curv, pol_calc, pol_step will contain respectively 1001, 1, 1, 0.02335688555774.
The command length_pol is used to compute the length of a curvilinear polygon :
- funct -> length_pol Q
will set the value of the variable length_pol to the length of Q.
It is possible to define polygons from real functions. They can be used to define and draw parametric curves. Two real double precisions must be used for this : one for the x coordinate and the other for the y coordinate. They must have the same xrange. So a parametric curve is defined as follows : first define the functions
- funct -> xrange xr 1 1001
- funct -> fix_xrange xr 0 pi/500
- funct -> function X xr
- funct -> function Y xr
(cf. 3.1). This creates two
functions X, Y, defined
on the interval on 1001 equally spaced points. One must
then fill these functions. For example :
- funct -> fill_func X sin(3*x)
- funct -> fill_func X sin(4*x)
We must then define a polygon and associate it to the preceeding functions :
- funct -> polyg P 10
- funct -> polyg_funct P X Y
We have then a polygon P with 1001 vertices whose i-th
vertex is the
point of coordinates
.
Three transforms can be used in funct : linear, affine
or
general transforms.
They are defined using the command transform_lin. They can act only on vectors, using the command act, and can be used to define affine transforms. In
- funct -> transform_lin Tlin
- funct -> coord_lin Tlin 1 2 3 4
the first command defines a linear transform Tlin. The
second instruction
defines its matrix :
.
They are defined using the command transform_aff. They can act on points, lines, circles and polygons, using the command act. They are defined by a point (the image of (0,0)) and a linear transform. In
- funct -> transform_aff Taff
- funct -> point A
- funct -> coord A 2.5 -0.5
- funct -> coord_aff Taff Tlin A
the first command defines the affine transform Taff. The
second and
third command define the point A of coordinates (2.5,-0.5).
The last
command sets the linear part of Taff to Tlin (the
linear transform
defined in 3.8.2), and the image of (0,0) to A.
They are defined by formulas, using the command transform_gen,
and can act on points, lines, circles and polygons, using the command act.
They are given by formulas defining
formulas for the and
coordinates,
depending on the variables x,
y :
- funct -> transform_gen Tgen x*cos(x*y-exp(y)) x*x+y*y
It is also possible to perform the action of a general transform on a line segment defined by its end strings, using the command act_s. The result is stored in a polygon :
- funct -> point A
- funct -> point B
- funct -> coord A 1 2
- funct -> coord B -2 5
- funct -> polyg Pol 250
- funct -> act_s T A B Pol