# Geometry Utilities

### Functions

Returns the distance between points pt1 and pt2. The pt1 and pt2 arguments are three-dimensional points.
Returns the angle between the line from point pt1 to point pt2 and the X axis of the current UCS, with the angle increasing in counterclockwise direction. The pt1 and pt2 arguments are two-dimensional points (the Z coordinates are ignored). The angle is returned in radians.
Finds a point by means of polar coordinates. The point argument and result are three-dimensional points. The angle is expressed in radians, measured from the X axis with the value increasing in the counterclockwise direction.
ads.inters(line1, line2 [, teston]) -> point
Examines two lines and returns the point where they intersect. The line arguments are tuples of two points each. The optional teston argument is an int and specifies that the intersection must lie on the given line segments when non zero. If teston is not given or zero, then the two lines are considered to be of infinite length for intersection testing.

Finds the coordinates of a box that encloses a text entity. If the argument is an acad_ename object specifying an existing text, attdef or attrib entity in the current drawing, then the bounding box of this entity is returned. If the argument is an assoc list (a sequence of ads_cons objects) that describes the properties of a text entity, then the bounding box of this virtual text entity is returned. If the first element of the assoc list specifies an existing text, attdef or attrib entity (with code -1), then the properties of this entity will be used, while each of the following ads_cons objects overrides a overrides the entity's acutal attributes.

If the association list doesn't begin with a -1 ads_cons object, it must begin with a 0 (entity type) element, and it must contain an element that contains the string itself. This is a 1 (value) element for a text or attrib entity, or a 2 (tag string) element for an attdef entity. Other values are assumed to be the default values unless they are explicitly specified. The defaults are as follows:

 Style (7) the current text style Size (40) the size of the style if that is fixed; otherwise the current default size of the style Width factor (41) the default width of the style Obliquing angle (51) the default angle of the style

Note: This function does not work with paragraph text (mtext) or mtext formatting characters.

ads.trans(point, from, to, [, displ]) -> point

Translates a point or a displacement from one coordinate system into another. The point argument is a 3D point or a 3D displacement vector. The from argument specifies the coordinate system in which pt is expressed, and the to argument specifies the coordinate system of this function's result. If the disp argument is nonzero, pt is treated as a displacement vector; otherwise, it is treated as a point.

The from and to arguments can specify a coordinate system in any of the following ways:

• an integer out of:

 ads.CS_WCS the world coordinate system ads.CS_UCS the current user coordinate system ads.CS_DCS the display coordinate system. this is: the current viewport when the other system is CS_WCS or CS_UCS the current model space viewport when the other system is CS_PSDCS ads.CS_PSDCS the world coordinate system Warning: The paper space DCS (CS_PSDCS) can be transformed only to or from the model space DCS. Therefore, if the from argument equals CS_PSDCS, the to argument must equal CS_DCS, and conversely.
• an acad_ename object to specify the entity coordinate system For planar entities, the ECS can differ from the WCS. If the ECS does not differ, conversion between ECS and WCS is an identity operation.

• a 3D extrusion vector (a tuple of three floats) Extrusion vectors are always represented in World coordinates; an extrusion vector of (0,0,1) specifies the WCS.