### How to write a textual description of a circumscribed circle to a triangle?

With Dr. Geo software, you can write source
code describing any sketch. Writing a description of the circumscribed circle
to a triangle is pretty simple and short as explained in the following
paragraphs.

First you define two local variables as reference to the whole sketch and
the circumcenter:

```
| sketch center |
sketch := DrGeoCanvas new fullscreen.
```

Then you define a triangle by specifying the coordinates of its summits
(vertices):

```
sketch polygon: {-2@0 . 2@0 . 1@3}.
```

As a note for the reader,

`-2@0`

should be understood as the
coordinates (-2;0). It is one way to define 2D coordinates in Pharo
language. Here we construct the triangle as a polygon with three summits,
defined as a list of coordinates separated by the period (.) characters
`{obj1 . obj2 . obj3}`

. Later on in the description of the sketch,
we refer to the triangle summits by its coordinates, Dr. Geo takes care to find
it back in the sketch.
The circumcenter is constructed as the intersection of two perpendicular
bisectors:

```
center := sketch
intersectionOf: (sketch perpendicularBisector: -2@0 to: 2@0)
and: (sketch perpendicularBisector: 2@0 to: 1@3).
```

Here, it is decided to keep a reference of the circumcenter in the

`center`

variable for later use in the construction of the
circumscribed circle:```
sketch circleCenter: center to: 2@0
```

The whole scketch description looks like this:```
| sketch center |
sketch := DrGeoCanvas new fullscreen.
sketch polygon: {-2@0 . 2@0 . 1@3}.
center := sketch
intersectionOf: (sketch perpendicularBisector: -2@0 to: 2@0)
and: (sketch perpendicularBisector: 2@0 to: 1@3).
sketch circleCenter: center to: 2@0
```

Copying and pasting this script in a Dr. Geo's workspace, then selecting it
and executing with Ctrl-d, will give you the following sketch:

The curious reader will try to describe the inscribed circle to the
triangle! The user manual will be very
helpful.

## No comments:

## Post a comment