hm_findcirclefromthreepoints

Find the center and the radius of a circle that lies on three 2D points.

Syntax

hm_findcirclefromthreepoints u1 v1 u2 v2 u3 v3

Type

HyperMesh Tcl Query Command

Description

This command returns the center and the radius of a circle that lies on three 2D points: (u1,v1), (u2,v2), (u3,v3). The return value will be a list of three parameters: the u coordinate of circle center (uc), the v coordinate of circle center (vc) and the circle radius (rc).

Example

To get the center and the radius of a circle that lies on the points (3,5), (5,3) and (7,5) :

hm_findcirclefromthreepoints  3 5 5 3 7 5

The result will be "5 5 2". The center circle is (5,5) and the radius is 2.

Errors

Incorrect usage of hm_findcirclefromthreepoints results in a Tcl error. The function returns an error if it isn’t possible to define a circle using the given points.

set err [catch { hm_findcirclefromthreepoints $u1 $v1 $u2 $v2 $u3 $v3 } circle]
if {$err} {
#Handle error here //I can't find the new circle.
} 

If err is 0 "circle" contains the uc,vc,rc.