Annotation of researchv10dc/630/man/src/p_man/man3/ptarith.3r, revision 1.1.1.1

1.1       root        1: .ds ZZ DEVELOPMENT PACKAGE
                      2: .TH PTARITH 3R "630 MTG"
                      3: .XE "add()"
                      4: .XE "sub()"
                      5: .XE "mul()"
                      6: .XE "div()"
                      7: .SH NAME
                      8: ptarith: add, sub, mul, div \- arithmetic on Points
                      9: .SH SYNOPSIS
                     10: .ft B
                     11: #include <dmd.h>
                     12: .sp
                     13: Point add (p, q)
                     14: .sp
                     15: Point sub (p, q) 
                     16: .sp
                     17: Point mul (p, a)
                     18: .sp
                     19: Point div (p, a)
                     20: .sp
                     21: Point p, q;
                     22: .br
                     23: int a;
                     24: .SH DESCRIPTION
                     25: The
                     26: .I add
                     27: function
                     28: returns the Point sum of its arguments:
                     29: .sp
                     30: .ce
                     31: .ft CM
                     32: { p.x+q.x, p.y+q.y }
                     33: .sp
                     34: .ft R
                     35: The
                     36: .I sub
                     37: function
                     38: returns the Point difference of its arguments:
                     39: .sp
                     40: .ce
                     41: .ft CM
                     42: { p.x-q.x, p.y-q.y }
                     43: .sp
                     44: .ft R
                     45: The
                     46: .I mul
                     47: function
                     48: returns the Point:
                     49: .sp
                     50: .ce
                     51: .ft CM
                     52: { p.x*a, p.y*a }
                     53: .sp
                     54: .ft R
                     55: The
                     56: .I div
                     57: function
                     58: returns the Point:
                     59: .sp
                     60: .ce
                     61: .ft CM
                     62: { p.x/a, p.y/a }.
                     63: .sp
                     64: .ft R
                     65: .SH EXAMPLE
                     66: The following routine returns the center Point of a \f2window\f1.
                     67: .PP
                     68: .RS 3
                     69: .nf
                     70: .ft CM
                     71: #include <dmd.h>
                     72: Point add();
                     73: Point sub();
                     74: Point div();
                     75: Point
                     76: getcenter()
                     77: {
                     78:     Point offset;
                     79:     offset = div (sub
                     80:         (Drect.corner,Drect.origin), 2);
                     81:     return add (Drect.origin, offset);
                     82: }
                     83: \fR
                     84: .fi
                     85: .RE
                     86: .SH SEE ALSO
                     87: globals(3R), rectarith(3R),  transform(3R/3L).

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.