forsyth20121205-174063a80cc13 years agoHistory
66 lines · 1.2 KB · Text
RawDownload
.TH DRAW-POINT 2.SH NAMEPoint \-coordinate position.SH SYNOPSIS.EXinclude    "draw.m";draw := load Draw Draw->PATH; Point: adt{    x:    int;    y:    int;     add:  fn(p: self Point, q: Point):  Point;    sub:  fn(p: self Point, q: Point):  Point;    mul:  fn(p: self Point, i: int):    Point;    div:  fn(p: self Point, i: int):    Point;    eq:   fn(p: self Point, q: Point):  int;    in:   fn(p: self Point, r: Rect):   int;};.EE.SH DESCRIPTION.PPThe.B Pointdata type specifies a position in the integer grid..TP 10.BR x ", " yThe coordinate position. The coordinates increase to the right.RI ( x )and down.RI ( y )..TP.IB p .add( q )Returns the point.BI ( p .x+ q .x,.IB p .y+ q .y)\fR..TP.IB p .sub( q )Returns the point.BI ( p .x\- q .x,.IB p .y\- q .y)\fR..TP.IB p .mul( i )Returns the point.BI ( p .x* i ,.IB p .y* i )\fR..TP.IB p .div( i )Returns the point.BI ( p .x/ i ,.IB p .y/ i )\fR..TP.IB p .eq( q )Returns non-zero if the points' coordinates are equal and zero otherwise..TP.IB p .in( r )Returns non-zero if point.I plies within rectangle.I rand zero otherwise..SH SEE ALSO.IR draw-intro (2),.IR draw-rect (2)