[Top] [Prev] [Next]

point

Point - coordinate position

Synopsis

include  "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;
};

Description

The Point data type specifies a position in the integer grid.
x, y

The coordinate position. The coordinates increase to the right (x) and down (y).

p.add (q)

Returns the point (p.x+q.x, p.y+q.y).

p.sub (q)

Returns the point (p.x-q.x, p.y-q.y).

p.mul (i)

Returns the point (p.x*i, p.y*i).

p.div (i)

Returns the point (p.x/i, p.y/i).

p.eq (q)

Returns non-zero if the points' coordinates are equal and zero otherwise.

p.in (rect)

Returns 1 if point p is within rectangle rect, 0 if outside.

See Also
Limbo Draw Modules

Description of coordinate system



[Top] [Prev] [Next]

infernosupport@lucent.com
Copyright © 1996,Lucent Technologies, Inc. All rights reserved.