dim x1,y1,x2,y2 as integer
x1=10
x2=110
y1=50
y2=50
dim rotation as integer
rotation=45
//the origin location
dim originX,originY as integer
//the offsets from the origin
dim x3,y3,x4,y4 as integer
//the distance to the origin
dim distance1, distance2 as double
//the angle to the origin
dim angle1, angle2 as double
//our new coordinates
dim newx1, newx2, newy1, newy2 as integer
//find center
originX=x2
originY=y2
//get offsets
x3=x1-originX
y3=y1-originY
x4=x2-originX
y4=y2-originY
//get distance
distance1=sqrt(abs(x3)^2+abs(y3)^2)
distance2=sqrt(abs(x4)^2+abs(y4)^2)
//get angles
if x3>0 then
angle1=atan(y3/x3)*(180/PI)
elseif x3=0 then
angle1=0.0
elseif x3<0 then
angle1=atan(y3/x3)*(180/PI)+180
end if
if x4>0 then
angle2=atan(y4/x4)*(180/PI)
elseif x4=0 then
angle2=0.0
elseif x4<0 then
angle2=atan(y4/x4)*(180/PI)+180
end if
//offset angles
angle1=angle1+rotation
angle2=angle2+rotation
//convert to radians now to save latter
angle1=angle1*(pi/180)
angle2=angle2*(pi/180)
//get new corrdinates based on origin
newx1 = distance1*cos(angle1)
newy1 = distance1*sin(angle1)
newx2 = distance2*cos(angle2)
newy2 = distance2*sin(angle2)
//offset from the origin
newx1 = newx1+originX
newy1 = newy1+originY
newx2 = newx2+originX
newy2 = newy2+originY
//draw
canvas1.graphics.drawline(newx1, newy1, newx2,newy2)