#import "p31m.h"

@implementation p31m
- clip: (NXCoord) x: (NXCoord) y 
{ 
  PSnewpath();
  PSmoveto(x,y);
  PSrlineto(bounds.size.width,bounds.size.height);
  PSrlineto(0,-2.0/3.0* bounds.size.height);
  PSclosepath();
  PSclip();
  return self;
}

- makeLatticeUnitAt: (NXPoint *) point fromImage: srcimg 
{
  id imgrep;
  int i;
  NXPoint pt;
  
  pt.x = - point->x ;
  pt.y = - point->y ;
  imgrep = [srcimg bestRepresentation];
  for(i=0;i<3;i++){
    PSgsave();
    PSrotate(120*i);
    PSgsave();
    [self clip:0.0:0.0];
    [imgrep drawAt: &pt];
    PSgrestore();
    reflect(60);
    [self clip:0.0:0.0];
    [imgrep drawAt: &pt];
    PSgrestore();
  }
  return self;
}
@end
