I'm putting in the rotation routine for my vector editor, but whilst everything rotates, it also gets smaller, for some reason. Here is the current code :
FUNCTION TGrid_Rotate%:angle
LOCAL loop%
LOCAL node AS tNode
LOCAL s,c,x,y,rx,ry
s=SIN(angle)
c=COS(angle)
FOR loop%=0 TO MAX_NODEGROUPS%-1
FOREACH node IN self.nodeGroup[loop%].nodes[]
x=(node.x%-self.handleX%)*1.0
y=(node.y%-self.handleY%)*1.0
node.x%=self.handleX%+INTEGER((c*x)-(s*y))
node.y%=self.handleY%+INTEGER((c*y)+(s*x))
IF node.x%<=0
node.x%=0
ELSEIF node.x%>=self.GRID_WIDTH%
node.x%=self.GRID_WIDTH%-1
ENDIF
IF node.y%<=0
node.y%=0
ELSEIF node.y%>=self.GRID_HEIGHT%
node.y%=self.GRID_HEIGHT%-1
ENDIF
NEXT
NEXT
ENDFUNCTION
Ah - sorted it! It appears that INTEGER was the cause (probably rounding down). Get rid of that and all is okay!
Ace!