The VECTOR
datatype represents a two-dimensional geometric vector, i.e.
an oriented segment that represents a quantity with: module (or magnitude),
as the length of the segment, which indicates the magnitude of the quantity;
direction: the line on which the segment lies, i.e. the orientation of the
segment on the line.
In a Cartesian coordinate system, a two-dimensional vector is defined by a
pair of numbers (x, y), which represent its components along the x and y axes.
These components can be viewed as the coordinates of the vector's endpoint,
assuming that the initial point is the origin (0, 0).
Given a variable of VECTOR
data type, you can access to coordinates
using the X()
and Y()
functions.
Vectors can be added or subtracted, and they are performed by adding or
subtracting the corresponding components; you can do a scalar product,
where both components are multiplied by the scalar; you can do a dot
product, an operation that returns a number related to the angle between
two vectors.
Two-dimensional geometric vectors are a fundamental tool in many areas of
mathematics, physics, and computer science, especially in computer graphics
and the simulation of physical phenomena.
DIM v AS VECTOR
PLOT X(v),Y(v), RED
Join BASIC 10Liner Contest with ugBASIC!
An interesting competition is held at the beginning of each year: the
BASIC 10Liner Contest.
It is possible to use ugBASIC to participate in the next
"BASIC10Liner" competition, in the following categories:
VECTOR (data type) ↔ Vec
If you have found a problem with this keyword, if you think there is a bug or, more
simply, you would like it to be improved, open an issue for this example on GitHub.
Thank you!
open an issue
BACK TO KEYWORDS