function Triangle.SetParent(L,V)L.WedgeA.Parent=V L.WedgeB.Parent=V L.Parent=V end function Triangle.SetWedgeProperties(L,V)for V,B in next,V do L.WedgeA[V]=B L.WedgeB[V]=B end end function Triangle.Draw(U,V,L,B)V=V or U.a L=L or U.b B=B or U.c U.a=V U.b=L U.c=B local A=U.WedgeA local m=U.WedgeB local X,d,i=L-V,B-V,B-L local f,Z,h=X:Dot(X),d:Dot(d),i:Dot(i)if f>Z and f>h then B,V=V,B elseif Z>h and Z>f then V,L=L,V end X,d,i=L-V,B-V,B-L local g=(d:Cross(X)).Unit local q=(i:Cross(g)).Unit local Y=i.Unit local I=math.abs(X:Dot(q))local F=math.abs(X:Dot(Y))local G=math.abs(d:Dot(Y))A.Size=Vector3.new(.05,I,F)A.CFrame=CFrame.fromMatrix((V+L)/2,g,q,Y)A.Parent=U.Parent m.Size=Vector3.new(.05,I,G)m.CFrame=CFrame.fromMatrix((V+B)/2,-g,q,-Y)m.Parent=U.Parent end
--

function Triangle:SetParent(parent)
	self.WedgeA.Parent = parent
	self.WedgeB.Parent = parent
	self.Parent = parent
end

function Triangle:SetWedgeProperties(properties)
	for prop, value in next, properties do
		self.WedgeA[prop] = value
		self.WedgeB[prop] = value
	end
end

function Triangle:Draw(a, b, c)
	a = a or self.a
	b = b or self.b
	c = c or self.c

	self.a = a
	self.b = b
	self.c = c

	local wedgeA = self.WedgeA
	local wedgeB = self.WedgeB

	local ab, ac, bc = b - a, c - a, c - b
	local abd, acd, bcd = ab:Dot(ab), ac:Dot(ac), bc:Dot(bc)

	if abd > acd and abd > bcd then
		c, a = a, c
	elseif acd > bcd and acd > abd then
		a, b = b, a
	end

	ab, ac, bc = b - a, c - a, c - b

	local right = ac:Cross(ab).Unit
	local up = bc:Cross(right).Unit
	local back = bc.Unit

	local height = math.abs(ab:Dot(up))
	local width1 = math.abs(ab:Dot(back))
	local width2 = math.abs(ac:Dot(back))

	wedgeA.Size = Vector3.new(0.05, height, width1)
	wedgeA.CFrame = CFrame.fromMatrix((a + b) / 2, right, up, back)
	wedgeA.Parent = self.Parent

	wedgeB.Size = Vector3.new(0.05, height, width2)
	wedgeB.CFrame = CFrame.fromMatrix((a + c) / 2, -right, up, -back)
	wedgeB.Parent = self.Parent
end
