// Created on: 2005-12-20
// Created by: Sergey KHROMOV
// Copyright (c) 2005-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 <BRep_Tool.hxx>

//=======================================================================
//function : BRepGProp_Face
//purpose  : Constructor. Initializes the object with IsUseSpan.
//=======================================================================

inline BRepGProp_Face::BRepGProp_Face(const Standard_Boolean IsUseSpan)
     : mySReverse (Standard_False),
       myIsUseSpan(IsUseSpan)
{
}

//=======================================================================
//function : BRepGProp_Face
//purpose  : Constructor.Initializes the object with the face and
//           IsUseSpan flan.
//=======================================================================

inline BRepGProp_Face::BRepGProp_Face(const TopoDS_Face      &F,
				      const Standard_Boolean  IsUseSpan)
     : myIsUseSpan(IsUseSpan)
{
  Load(F);
}

//=======================================================================
//function : NaturalRestriction
//purpose  : Returns Standard_True if the face is not trimmed.
//=======================================================================

inline Standard_Boolean BRepGProp_Face::NaturalRestriction() const
{
  return BRep_Tool::NaturalRestriction(mySurface.Face());
}
//
//=======================================================================
//function : GetFace
//purpose  : Returns TopoDS Face.
//=======================================================================

inline const TopoDS_Face& BRepGProp_Face::GetFace() const
{
  return mySurface.Face();
}

//=======================================================================
//function : Value2d
//purpose  : Returns the value of the boundary curve of the face.
//=======================================================================

inline gp_Pnt2d BRepGProp_Face::Value2d(const Standard_Real U) const
{
  return myCurve.Value(U);
}

//=======================================================================
//function : D12d
//purpose  : Returns the point of parameter U and the first derivative
//           at this point of a boundary curve.
//=======================================================================

inline void BRepGProp_Face::D12d(const Standard_Real  U,
				       gp_Pnt2d      &P,
				       gp_Vec2d      &V1) const
{
  myCurve.D1(U,P,V1);
}

//=======================================================================
//function : FirstParameter
//purpose  : Returns the parametric value of the start point of
//           the current arc of curve.
//=======================================================================

inline Standard_Real BRepGProp_Face::FirstParameter() const
{
  return myCurve.FirstParameter();
}

//=======================================================================
//function : LastParameter
//purpose  : Returns the parametric value of the end point of
//           the current arc of curve.
//=======================================================================

inline Standard_Real BRepGProp_Face::LastParameter() const
{
  return myCurve.LastParameter();
}
