PostgreSQL box(circle) Function

The PostgreSQL box(circle) function computes and returns the inscribed rectangle of a specified circle.

A rectangle box is represented by a point in the upper right corner and a point in the lower left corner, for example: (1,1),(0,0).

box(circle) Syntax

This is the syntax of the PostgreSQL box(circle) function:

box(circle) -> box

Parameters

circle

Required. A circle, for example: circle '<(0,0),2>'.

Return value

The PostgreSQL box(circle) function returns a rectangle inscribed in a specified circle.

box(circle) Examples

The following statement shows how to use the PostgreSQL box(circle) function to calculate a inscribed box of the circle circle '<(0,0),1>'.

SELECT box(circle '<(0,0),1>');
                                        box
-----------------------------------------------------------------------------------
 (0.7071067811865475,0.7071067811865475),(-0.7071067811865475,-0.7071067811865475)

The following statement shows how to use the PostgreSQL box(circle) function to calculate a inscribed box of the circle circle '<(5,5),2>'.

SELECT box(circle '<(5,5),2>');
                                     box
-----------------------------------------------------------------------------
 (6.414213562373095,6.414213562373095),(3.585786437626905,3.585786437626905)