public void UpdateTheEquation(VectorLineEquation equationOne, VectorLineEquation equationTwo) { m_vEqOne = equationOne; m_vEqTwo = equationTwo; m_cEqOne = m_vEqOne.ToCartesian(); m_cEqTwo = m_vEqTwo.ToCartesian(); if (debug) { Debug.Log("equation one Vector form: " + m_vEqOne.ToString()); Debug.Log("equation one Cartesian form: " + m_cEqOne.ToString()); Debug.Log("equation Two Vector form: " + m_vEqTwo.ToString()); Debug.Log("equation Two Cartesian form: " + m_cEqTwo.ToString()); } // Construct the Matrix. equationMatrix = CartianToMatrix(); if (debug) { Debug.Log("matrix construction: " + equationMatrix.ToString()); } if (!equationMatrix.isSolvable()) { isSolvable = false; return; } isSolvable = true; solution = equationMatrix.Solve(new Vector2(m_cEqOne.yInteresect, m_cEqTwo.yInteresect)); // Calculate the t for the direction vector of each equation m_vEqOne.CalculateT(solution, ref timeEquationOne); m_vEqTwo.CalculateT(solution, ref timeEquationTwo); }
public LinearEquationSolver(VectorLineEquation equationOne, VectorLineEquation equationTwo) { UpdateTheEquation(equationOne, equationTwo); }