performance boost for scalar

This commit is contained in:
2024-04-23 02:57:36 -04:00
parent 54ba0101af
commit cb6b7eb79c
2 changed files with 5 additions and 3 deletions

View File

@@ -159,8 +159,9 @@ local function RotationMatrix(X: number, Y: number, Z: number): RotationMatrix
end
local function Scalar(X1: number, Y1: number, X2: number, Y2: number): Scalar
local dX, dY = X1-X2, Y1-Y2
return {
Distance = math.sqrt((X1-X2)*(X1-X2)+(Y1-Y2)*(Y1-Y2));
Distance = math.sqrt(dX*dX+dY*dY),
Center = Vector2.new((X1+X2)/2,(Y1+Y2)/2);
Rotation = math.deg(math.atan2(Y1-Y2,X1-X2))
}

View File

@@ -59,9 +59,10 @@ function Math.RotationMatrix(X: number, Y: number, Z: number): RotationMatrix
end
function Math.Scalar(X1: number, Y1: number, X2: number, Y2: number): Scalar
local dX, dY = X1-X2, Y1-Y2
return {
Distance = math.sqrt((X1-X2)*(X1-X2)+(Y1-Y2)*(Y1-Y2));
Center = Vector2.new((X1+X2)/2,(Y1+Y2)/2);
Distance = math.sqrt(dX*dX+dY*dY),
Center = Vector2.new((X1+X2)/2,(Y1+Y2)/2),
Rotation = math.deg(math.atan2(Y1-Y2,X1-X2))
}
end