man geometry () - Geometrical computations

NAME

math::geometry - Geometrical computations

SYNOPSIS

package require Tcl ?8.3? package require math::geometry ?1.0.2? ::math::geometry::calculateDistanceToLine P line ::math::geometry::calculateDistanceToLineSegment P linesegment ::math::geometry::calculateDistanceToPolyline P polyline ::math::geometry::findClosestPointOnLine P line ::math::geometry::findClosestPointOnLineSegment P linesegment ::math::geometry::findClosestPointOnPolyline P polyline ::math::geometry::lengthOfPolyline polyline

DESCRIPTION

The math::geometry package is a collection of functions for computations and manipulations on two-dimensional geometrical objects, such as points, lines and polygons.

The geometrical objects are implemented as plain lists of coordinates. For instance a line is defined by a list of four numbers, the x- and y-coordinate of a first point and the x- and y-coordinates of a second point on the line.

The various types of object are recognised by the number of coordinate pairs and the context in which they are used: a list of four elements can be regarded as an infinite line, a finite line segment but also as a polyline of one segment and a point set of two points.

Currently the following types of objects are distinguished:

•
point - a list of two coordinates representing the x- and y-coordinates respectively.
•
line - a list of four coordinates, interpreted as the x- and y-coordinates of two distinct points on the line.
•
line segment - a list of four coordinates, interpreted as the x- and y-coordinates of the first and the last points on the line segment.
•
polyline - a list of an even number of coordinates, interpreted as the x- and y-coordinates of an ordered set of points.
•
polygon - like a polyline, but the implicit assumption is that the polyline is closed (if the first and last points do not coincide, the missing segment is automatically added).
•
point set - again a list of an even number of coordinates, but the points are regarded without any ordering.

PROCEDURES

The package defines the following public procedures:

::math::geometry::calculateDistanceToLine P line
Calculate the distance of point P to the (infinite) line and return the result
P list List of two numbers, the coordinates of the point
line list List of four numbers, the coordinates of two points
on the line
::math::geometry::calculateDistanceToLineSegment P linesegment
Calculate the distance of point P to the (finite) line segment and return the result.
P list List of two numbers, the coordinates of the point
linesegment list List of four numbers, the coordinates of the
first and last points of the line segment
::math::geometry::calculateDistanceToPolyline P polyline
Calculate the distance of point P to the polyline and return the result.
P list List of two numbers, the coordinates of the point
polyline list List of numbers, the coordinates of the
vertices of the polyline
::math::geometry::findClosestPointOnLine P line
Return the point on a line which is closest to a given point.
P list List of two numbers, the coordinates of the point
line list List of four numbers, the coordinates of two points
on the line
::math::geometry::findClosestPointOnLineSegment P linesegment
Return the point on a line segment which is closest to a given point.
P list List of two numbers, the coordinates of the point
linesegment list List of four numbers, the first and last
points on the line segment
::math::geometry::findClosestPointOnPolyline P polyline
Return the point on a polyline which is closest to a given point.
P list List of two numbers, the coordinates of the point
polyline list List of numbers, the vertices of the polyline
::math::geometry::lengthOfPolyline polyline
Return the length of the polyline (note: it not regarded as a polygon)
polyline list List of numbers, the vertices of the polyline
Other functions: Pro Memorie

KEYWORDS

angle, distance, line, math, plane geometry, point

COPYRIGHT

Copyright (c) 2004 by Ideogramic ApS and other parties