addpt man page on Plan9

Printed from

ADDPT(2)							      ADDPT(2)

       addpt, subpt, mulpt, divpt, rectaddpt, rectsubpt, insetrect, canonrect,
       eqpt, eqrect, ptinrect, rectinrect, rectXrect,  rectclip,  combinerect,
       Dx, Dy, Pt, Rect, Rpt - arithmetic on points and rectangles

       #include <u.h>
       #include <libc.h>
       #include <draw.h>

       Point	 addpt(Point p, Point q)

       Point	 subpt(Point p, Point q)

       Point	 mulpt(Point p, int a)

       Point	 divpt(Point p, int a)

       Rectangle rectaddpt(Rectangle r, Point p)

       Rectangle rectsubpt(Rectangle r, Point p)

       Rectangle insetrect(Rectangle r, int n)

       Rectangle canonrect(Rectangle r)

       int	 eqpt(Point p, Point q)

       int	 eqrect(Rectangle r, Rectangle s)

       int	 ptinrect(Point p, Rectangle r)

       int	 rectinrect(Rectangle r, Rectangle s)

       int	 rectXrect(Rectangle r, Rectangle s)

       int	 rectclip(Rectangle *rp, Rectangle b)

       void	 combinerect(Rectangle *rp, Rectangle b)

       int	 Dx(Rectangle r)

       int	 Dy(Rectangle r)

       Point	 Pt(int x, int y)

       Rectangle Rect(int x0, int y0, int x1, int y1)

       Rectangle Rpt(Point p, Point q)

       The  functions  Pt,  Rect and Rpt construct geometrical data types from
       their components.

       Addpt returns the Point sum of  its  arguments:	Pt(p.x+q.x,  p.y+q.y).
       Subpt  returns  the Point difference of its arguments: Pt(p.x-q.x, p.y-
       q.y).  Mulpt returns the Point Pt(p.x*a,	 p.y*a).   Divpt  returns  the
       Point Pt(p.x/a, p.y/a).

       Rectaddpt  returns  the	Rectangle  Rect(add(r.min, p), add(r.max, p));
       rectsubpt returns the Rectangle Rpt(sub(r.min, p), sub(r.max, p)).

       Insetrect returns the Rectangle Rect(r.min.x+n,	r.min.y+n,  r.max.x-n,

       Canonrect  returns a rectangle with the same extent as r, canonicalized
       so that min.x ≤ max.x, and min.y ≤ max.y.

       Eqpt compares its argument Points and returns 0 if unequal, 1 if equal.
       Eqrect does the same for its argument Rectangles.

       Ptinrect returns 1 if p is a point within r, and 0 otherwise.

       Rectinrect returns 1 if all the pixels in r are also in s, and 0 other‐

       RectXrect returns 1 if r and s share any point, and 0 otherwise.

       Rectclip clips in place the Rectangle pointed to by rp so  that	it  is
       completely  contained  within  b.  The return value is 1 if any part of
       *rp is within  b.   Otherwise,  the  return  value  is  0  and  *rp  is

       Combinerect  overwrites	*rp  with the smallest rectangle sufficient to
       cover all the pixels of *rp and b.

       The functions Dx and Dy give the width (Δx) and height (Δy) of  a  Rec‐
       tangle.	They are implemented as macros.



                             _         _         _ 
                            | |       | |       | |     
                            | |       | |       | |     
                         __ | | __ __ | | __ __ | | __  
                         \ \| |/ / \ \| |/ / \ \| |/ /  
                          \ \ / /   \ \ / /   \ \ / /   
                           \   /     \   /     \   /    
                            \_/       \_/       \_/ 
More information is available in HTML format for server Plan9

List of man pages available for Plan9

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
Vote for polarhome
Free Shell Accounts :: the biggest list on the net