ID:2011441
 
(See the best response by Ter13.)
Code:
Line(mob/a,mob/b)
var/obj/T = new/obj/Line
var/angle=a.AngleTo(b)
var/scale=get_dist_sq(a,b)
while(1)
sleep(0.25)
angle=a.AngleTo(b)
scale=get_dist_sq(a,b)
T.transform=turn(matrix()*2*scale,angle)
CopyLoc(T,a)


Problem description:

Is it possible to scale only the X/Y values as needed in order to keep the width of the line relatively similar? If so, what sort of math should I utilize?

Best response
The correct process is to scale on a single axis, and then rotate it. See matrix.Scale():

Line(mob/a,mob/b)
var/obj/T = new/obj/Line
var/angle=a.AngleTo(b)
var/scale=get_dist_sq(a,b)
var/matrix/m
while(1)
sleep(0.25)
angle=a.AngleTo(b)
scale=get_dist_sq(a,b)
m = matrix()
T.transform=turn(m.Scale(1,scale),angle)
CopyLoc(T,a)
In response to Ter13
Ah, okay. Thanks! I wasn't sure if rotations would do anything to the scaling and make everything all wonky or not.