CANON(3R)

NAME
canon - return canonical Rectangle format from two corner Points

SYNOPSIS
#include <dmd.h>

Rectangle canon (p1, p2)
Point p1, p2;

DESCRIPTION
The canon function returns a Rectangle created from two Points p1 and p2 such that:

    r.origin.x equals the minimum of p1.x and p2.x
    r.origin.y equals the minimum of p1.y and p2.y
    r.corner.x equals the maximum of p1.x and p2.x
    r.corner.y equals the maximum of p1.y and p2.y

In other words, the rectangle defined by the two corner points, p1 and p2, is returned in the standard format of (upper left, lower right).

EXAMPLE
Each of the following cases will yield the Rectangle.

    { 0, 0, 32, 32}
    canon( Pt(0, 32), Pt(32, 0) )
    canon( Pt(32, 32), Pt(0, 0) )
    canon( Pt(32, 0), Pt(0, 32) )

SEE ALSO
structures(3R).