| Home | Trees | Indices | Help |
|
|---|
|
|
Geometry functions.
Rectangle is a utility class for working with rectangles (unions and intersections)
A point is represented as a tuple (x, y).
Version: $Revision: 1794 $
| Classes | |
|
Rectangle Python Rectangle implementation. |
|
| Functions | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
| Function Details |
Return the distance from point point1 to point2. This version is faster than distance_point_point(), but less precise. >>> distance_point_point_fast((0,0), (1,1)) 2 |
Calculate the distance of a point from a line. The line is marked by begin and end point line_start and line_end. A tuple is returned containing the distance and point on the line. >>> distance_line_point((0., 0.), (2., 4.), point=(3., 4.)) (1.0, (2.0, 4.0)) >>> distance_line_point((0., 0.), (2., 4.), point=(-1., 0.)) (1.0, (0.0, 0.0)) >>> distance_line_point((0., 0.), (2., 4.), point=(1., 2.)) (0.0, (1.0, 2.0)) >>> d, p = distance_line_point((0., 0.), (2., 4.), point=(2., 2.)) >>> '%.3f' % d '0.894' >>> '(%.3f, %.3f)' % p '(1.200, 2.400)' |
Find the point where the lines (segments) defined by (line1_start, line1_end) and (line2_start, line2_end) intersect. If no intersecion occurs, None is returned. >>> intersect_line_line((0, 0), (10, 10), (3, 0), (8, 10)) (6.0, 6.0) >>> intersect_line_line((0, 0), (0, 10), (3, 0), (8, 10)) >>> intersect_line_line((0, 0), (0, 10), (3, 0), (3, 10)) |
Return the clipped rectangle of recta and rectb. If they do not intersect, None is returned. >>> rectangle_clip((0, 0, 20, 20), (10, 10, 20, 20)) (10, 10, 10, 10) |
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0 on Mon Mar 03 08:52:21 2008 | http://epydoc.sourceforge.net |