local K=require(script.Parent.TriStorage)local V=K.get local S=0 local function e(K,V,S,e)return CFrame.new(K.x,K.y,K.z,V.x,S.x,e.x,V.y,S.y,e.y,V.z,S.z,e.z)end return function(K,I,X)local W,T,v=I-K,X-K,X-I local O,w,a=W.magnitude,T.magnitude,v.magnitude if O>a and O>w then X,K=K,X elseif w>a and w>O then K,I=I,K end W,T,v=I-K,X-K,X-I local B=V()local o=V()local p=(T:Cross(W)).unit local f=(v:Cross(p)).unit local n=math.abs(W:Dot(f))local C=v.magnitude B.Size=Vector3.new(S,math.abs(W:Dot(v))/C,n)o.Size=Vector3.new(S,n,math.abs(T:Dot(v))/C)v=-v.unit B.CFrame=e((K+I)/2,-p,v,-f)o.CFrame=e((K+X)/2,-p,f,v)return B,o end
local TriStorage = require(script.Parent.TriStorage)
local getTri = TriStorage.get
local thickness = 0

local function cfFromAxes(p, x, y, z)
	return CFrame.new(
		p.x, p.y, p.z,
		x.x, y.x, z.x,
		x.y, y.y, z.y,
		x.z, y.z, z.z
	)
end

return function(a, b, c)
	local ab, ac, bc = b - a, c - a, c - b
	local abl, acl, bcl = ab.magnitude, ac.magnitude, bc.magnitude
	
	if abl > bcl and abl > acl then
		c, a = a, c
	elseif acl > bcl and acl > abl then
		a, b = b, a
	end
	
	ab, ac, bc = b - a, c - a, c - b
	
	local t1 = getTri()
	local t2 = getTri()
	
	local out = ac:Cross(ab).unit	
	local biDir = bc:Cross(out).unit
	local biLength = math.abs(ab:Dot(biDir))
	local bcLength = bc.magnitude
	
	t1.Size = Vector3.new(thickness, math.abs(ab:Dot(bc))/bcLength, biLength)
	t2.Size = Vector3.new(thickness, biLength, math.abs(ac:Dot(bc))/bcLength)
	
	bc = -bc.unit
	t1.CFrame = cfFromAxes((a+b)/2, -out, bc, -biDir)
	t2.CFrame = cfFromAxes((a+c)/2, -out, biDir, bc)
	
	return t1, t2
end