Next: , Previous:   [Contents][Index]


2.3 Sets

A set consists in a finite ordered list of points. Thus a set can also be seen as an open path of line segments or as a polygon.

A set of two points is considered as a single line segment. When a parameter is expected to be a segment, any subsequent point is ignored.

Set operators

s.t

Concatenates s and t. Each operand can be either a set or a point.

s[i]

Point of index i in variable s, assuming s contains a set. Indices start at 0.

Set related functions

set(P)

Singleton containing point P.

card(s)

Number of elements of set s.

length(s)

Length of path s.

perimeter(s)

Perimeter of polygon s.

area(s)

Area enclosed by polygon s, provided s is not self-intersecting.

arg(s)

Polar angle of segment s (in degrees).

point(s, x)

Point of abscissa x on an axis containing segment s. The point is on segment s when x ranges from 0 to 1.

midpoint(s)

Midpoint of segment s.

bisector(s)

Perpendicular bisector of segment s.

isobarycenter(s)

Isobarycenter of set s.

centroid(s)

Centroid of polygon s.

element(s, i)

Point of index i in set s.

vector(s)

Vector going from first to second point of segment s.

sub(s, i, j)

Subset of set s from index i to j.

polygon(n, O, r, a)
pentagon(O, r, a)
hexagon(O, r, a)

Vertices of a n-sided (or 5-sided or 6-sided) convex regular polygon of center O. The first point has (r, a) as polar coordinates with respect to O. The vertices are ordered anticlockwise.

Set constant

empty

Empty set.

Set related assignments

Each element of a variable containing a set may be modified individually using its index enclosed in square brackets.

Example: S[1] = point(2, pi/3)

When using empty square brackets, the given point is added to the tail of the set.

Example: S[] = point(0, 0)

Several elements of a set may be assigned at once to a dot separated list of variables. Exceeding points, if any, are ignored.

Example: A.B.C.D.E = pentagon(O, 1, 0°)


Next: , Previous:   [Contents][Index]