ActiveTcl User Guide

[ Main table Of Contents | Tcllib Table Of Contents | Tcllib Index ]

math::geometry(n) 1.0.2 "Math"

NAME

math::geometry - Geometrical computations

TABLE OF CONTENTS

    TABLE OF CONTENTS
    SYNOPSIS
    DESCRIPTION
    PROCEDURES
    KEYWORDS
    COPYRIGHT

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:

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

list P
List of two numbers, the coordinates of the point

list line
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.

list P
List of two numbers, the coordinates of the point

list linesegment
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.

list P
List of two numbers, the coordinates of the point

list polyline
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.

list P
List of two numbers, the coordinates of the point

list line
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.

list P
List of two numbers, the coordinates of the point

list linesegment
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.

list P
List of two numbers, the coordinates of the point

list polyline
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)

list polyline
List of numbers, the vertices of the polyline


Other functions: Pro Memorie

KEYWORDS

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

COPYRIGHT

Copyright © 2004 by Ideogramic ApS and other parties

Copyright © 2004 for compilation: ActiveState