Tcl Library Source Code

Documentation
Login


[ Main Table Of Contents | Table Of Contents | Keyword Index | Categories | Modules | Applications ]

NAME

math::geometry - Geometrical computations

Table Of Contents

SYNOPSIS

package require Tcl ?8.5?
package require math::geometry ?1.3.0?

::math::geometry::+ point1 point2
::math::geometry::- point1 point2
::math::geometry::p x y
::math::geometry::distance point1 point2
::math::geometry::length point
::math::geometry::s* factor point
::math::geometry::direction angle
::math::geometry::h length
::math::geometry::v length
::math::geometry::between point1 point2 s
::math::geometry::octant point
::math::geometry::rect nw se
::math::geometry::nwse rect
::math::geometry::angle line
::math::geometry::angleBetween vector1 vector2
::math::geometry::inproduct vector1 vector2
::math::geometry::areaParallellogram vector1 vector2
::math::geometry::calculateDistanceToLine P line
::math::geometry::calculateDistanceToLineSegment P linesegment
::math::geometry::calculateDistanceToPolyline P polyline
::math::geometry::calculateDistanceToPolygon P polygon
::math::geometry::findClosestPointOnLine P line
::math::geometry::findClosestPointOnLineSegment P linesegment
::math::geometry::findClosestPointOnPolyline P polyline
::math::geometry::lengthOfPolyline polyline
::math::geometry::movePointInDirection P direction dist
::math::geometry::lineSegmentsIntersect linesegment1 linesegment2
::math::geometry::findLineSegmentIntersection linesegment1 linesegment2
::math::geometry::findLineIntersection line1 line2
::math::geometry::polylinesIntersect polyline1 polyline2
::math::geometry::polylinesBoundingIntersect polyline1 polyline2 granularity
::math::geometry::intervalsOverlap y1 y2 y3 y4 strict
::math::geometry::rectanglesOverlap P1 P2 Q1 Q2 strict
::math::geometry::bbox polyline
::math::geometry::pointInsidePolygon P polyline
::math::geometry::pointInsidePolygonAlt P polyline
::math::geometry::rectangleInsidePolygon P1 P2 polyline
::math::geometry::areaPolygon polygon
::math::geometry::translate vector polyline
::math::geometry::rotate angle polyline
::math::geometry::reflect angle polyline
::math::geometry::degToRad angle
::math::geometry::radToDeg angle
::math::geometry::circle centre radius
::math::geometry::circleTwoPoints point1 point2
::math::geometry::pointInsideCircle point circle
::math::geometry::lineIntersectsCircle line circle
::math::geometry::lineSegmentIntersectsCircle segment circle
::math::geometry::intersectionLineWithCircle line circle
::math::geometry::intersectionCircleWithCircle circle1 circle2
::math::geometry::tangentLinesToCircle point circle

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:

References

  1. Polygon Intersection

  2. http://en.wikipedia.org/wiki/Line-line_intersection

  3. http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/

Bugs, Ideas, Feedback

This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category math :: geometry of the Tcllib Trackers. Please also report any ideas for enhancements you may have for either package and/or documentation.

When proposing code changes, please provide unified diffs, i.e the output of diff -u.

Note further that attachments are strongly preferred over inlined patches. Attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar.

KEYWORDS

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

CATEGORY

Mathematics

COPYRIGHT

Copyright © 2001 by Ideogramic ApS and other parties
Copyright © 2010 by Andreas Kupries
Copyright © 2010 by Kevin Kenny
Copyright © 2018 by Arjen Markus