// Copyright (c) 1995-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.

#include "StdFail_UndefinedDerivative.hxx"

#include "gp_Pnt.hxx"
#include "gp_Dir2d.hxx"
#include "gp_Dir.hxx"

inline double IntImp_ZerParFunc::Root() const
{

  return f[0] * f[0] + f[1] * f[1] + f[2] * f[2];
}

inline gp_Pnt IntImp_ZerParFunc::Point() const
{
  return gp_Pnt((pntsol1.XYZ() + pntsol2.XYZ()) / 2.);
}

inline gp_Dir IntImp_ZerParFunc::Direction() const
{
  if (tangent)
    throw StdFail_UndefinedDerivative();
  return gp_Dir(tgduv[0] * dpuv[0].XYZ() + tgduv[1] * dpuv[1].XYZ());
}

inline gp_Dir2d IntImp_ZerParFunc::DirectionOnS1() const
{
  if (tangent)
    throw StdFail_UndefinedDerivative();
  return gp_Dir2d(tgduv[0], tgduv[1]);
}

inline gp_Dir2d IntImp_ZerParFunc::DirectionOnS2() const
{
  if (tangent)
    throw StdFail_UndefinedDerivative();
  return gp_Dir2d(tgduv[2], tgduv[3]);
}

inline const ThePSurface& IntImp_ZerParFunc::AuxillarSurface1() const
{
  return *((const ThePSurface*)surf1);
}

inline const ThePSurface& IntImp_ZerParFunc::AuxillarSurface2() const
{
  return *((const ThePSurface*)surf2);
}
