Untitled

mail@pastecode.io avatar
unknown
lua
3 years ago
1.8 kB
6
Indexable
Never
-- Written by Glory
-- DeltaMath Solver
-- 3/18/22

local function _CheckProportionality(X1, X2, Y1, Y2)
	return  (X1 / Y1) == (X2 / Y2) and true or false
end

local Math = {}

function Math.CalcAreaTrapezoid(Base1, Base2, Height)
	return 0.5 * (Base1 + Base2) * Height
end

function Math.CalcAreaParallelogram(Base, Height)
	return Base * Height
end

function Math.CalcAreaTriangle(Base, Height)
	return 0.5 * (Base * Height)
end

function Math.SSSSim(X1, X2, X3, Y1, Y2, Y3)
	local S1Proportional = _CheckProportionality(X1, Y1, X2, Y2)
	local S2Proportional = _CheckProportionality(X1, Y1, X3, Y3)

	return S1Proportional and S2Proportional or false
end

function Math.AASim(AngX1, AngX2, AngY1, AngY2)
	return AngX1 == AngY1 and AngX2 == AngY2 and true or false
end

function Math.SASSim(SideX1, SideX2, SideY1, SideY2, AngX1, AngX2)
	return _CheckProportionality(SideX1, SideY1, SideX2, SideY2) and AngX1 == AngX2 or false
end

function Math.GetAngleFromTriangle(Ang1, Ang2)
	return 180 - (Ang1 + Ang2)
end

function Math.FindLeg(Leg, Hypotenuse)
	return math.sqrt((Hypotenuse^2) - (Leg^2))
end

function Math.FindHypotenuse(A, B)
	return math.sqrt((A^2) + (B^2))
end

function Math.GetCircleArea(Radius)
	return math.pi * Radius ^ 2
end

function Math.GetCircumference(Radius)
	return 2 * math.pi * Radius
end

function Math.DilatePointFromOrigin(XCoord, YCoord, ScaleFactor)
	return tostring(XCoord * ScaleFactor).. ", ".. tostring(YCoord * ScaleFactor)
end

function Math.FindScaleFactor(PreimageSideLength, ImageSideLength)
    return ImageSideLength / PreimageSideLength
end

function Math.SimplifyRadical(RadNumber)
    
end

function Math.ConvertToSimplestRadical()
    
end

return Math