Loading files
3d097a032This file is pinned to the selected release. Download the original to open it in your design tool.
// Created on: 1992-10-21
// Created by: Laurent BUCHARD
// Copyright (c) 1992-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.
#ifndef OCCT_DEBUG
#define No_Standard_RangeError
#define No_Standard_OutOfRange
#endif
#include <math_Vector.hxx>
#include <math_Matrix.hxx>
#include <gp_Vec2d.hxx>
#include <gp_Pnt2d.hxx>
#define THECURVE1 (*((TheCurve*)thecurve1))
#define THECURVE2 (*((TheCurve*)thecurve2))
//=================================================================================================
IntCurve_DistBetweenPCurvesGen::IntCurve_DistBetweenPCurvesGen(const TheCurve& C1,
const TheCurve& C2)
{
thecurve1 = (void*)(&C1);
thecurve2 = (void*)(&C2);
}
//=================================================================================================
int IntCurve_DistBetweenPCurvesGen::NbVariables() const
{
return (2);
}
//=================================================================================================
int IntCurve_DistBetweenPCurvesGen::NbEquations() const
{
return (2);
}
//=================================================================================================
bool IntCurve_DistBetweenPCurvesGen::Value(const math_Vector& X, math_Vector& F)
{
gp_Pnt2d P1, P2;
TheCurveTool::D0(THECURVE1, X(1), P1);
TheCurveTool::D0(THECURVE2, X(2), P2);
F(1) = P1.X() - P2.X();
F(2) = P1.Y() - P2.Y();
return (true);
}
//=================================================================================================
bool IntCurve_DistBetweenPCurvesGen::Derivatives(const math_Vector& X, math_Matrix& D)
{
gp_Vec2d T;
gp_Pnt2d P;
TheCurveTool::D1(THECURVE1, X(1), P, T);
D.Value(1, 1) = T.X();
D.Value(2, 1) = T.Y();
TheCurveTool::D1(THECURVE2, X(2), P, T);
D.Value(1, 2) = -(T.X());
D.Value(2, 2) = -(T.Y());
return (true);
}
//=================================================================================================
bool IntCurve_DistBetweenPCurvesGen::Values(const math_Vector& X, math_Vector& F, math_Matrix& D)
{
gp_Vec2d T;
gp_Pnt2d P1, P2;
TheCurveTool::D1(THECURVE1, X(1), P1, T);
D.Value(1, 1) = T.X();
D.Value(2, 1) = T.Y();
TheCurveTool::D1(THECURVE2, X(2), P2, T);
D.Value(1, 2) = -(T.X());
D.Value(2, 2) = -(T.Y());
F.Value(1) = P1.X() - P2.X();
F.Value(2) = P1.Y() - P2.Y();
return (true);
}
//======================================================================