VARKON Version 1.16 1998-09-24
VECTOR is one of 7 predefined datatypes. Variables of type VECTOR
have a X, Y and Z component and they are declared as
follows...
VECTOR p1,p2; ! Declares two vector variables with name p1 and p2
MBS also includes a number of built in functions returning a VECTOR
value. One example is the on function which returns the coordinates
of a position lying somewhere on a geometric entity....
p1:=on(#2,0.5);
This statement assigns the coordinates of the midpoint of #2 to the variable
p1. Lines and arcs have a relative arc length parameter ranging from 0
to 1 representing different positions on the entity. 0.5 is thus the midpoint.
Entities with no arclength like points and coordinate systems are accessed
without parameter..
p2:=on(#7);
if #7 is a point or coordinate system (or a 2D-drafting entity). A curve
has parameter ranging from 0 to a number equal to the number of segments
that make the curve. A curve with 5 segments will go from 0 to 5 in parameter.
For curves this parameter is not relative to arclength as it is for lines
and arcs. Instead it relates exactly to the internal parameter used in
the parametric curve representation. If relative arclength parametrisation
is wanted the function inv_arcl can be used to achieve that with
the price of extra computation.
Positions on b_planes and surfaces are calculated using two parameters
equal to the U and V parameters in the parametric surface representation.
Thus if #4 is a surface...
p1:=on(#4,vec(0.5,0.5));
then this statement would assign the coordinates of the parametric midpoint
of the first patch of surface #4 to p1. VECTOR:s can also
be used to hold a value representing a direction. The norm function
for example, returns the direction of the perpendicular normal for a given
position on a curve, b_plane or surface as a VECTOR.
MBS supports addition, subtraction, multiplication and scalar product in
expressions. The standard library includes functions for vector product,
vector length and normalization as well as the calculation of positions,
tangents, normals, curvatures, arclengths, and intersects. There is also
a low level eval routine for those who wish to know everything there is
to know. Inverse functions calculate parameter values for given geometric
values. inv_arcl for example calculates the parameter value for
a position with a given distance from the beginning of a curve. Other inverse
functions are inv_on, inv_tang and inv_curv
Copyright © Microform AB Henningholmsgatan 4 S-703 69 Örebro SWEDEN E-mail: info@microform.se
VARKON Homepage | Index |