1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-06-10 11:34:06 +03:00
occt/src/IntCurve/IntCurve_DistBetweenPCurvesGen.gxx
abv 0797d9d30a 0025418: Debug output to be limited to OCC development environment
Macros ending on "DEB" are replaced by OCCT_DEBUG across OCCT code; new macros described in documentation.
Macros starting with DEB are changed to start with "OCCT_DEBUG_".
Some code cleaned.
2014-11-05 16:55:24 +03:00

102 lines
2.9 KiB
Plaintext

// 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 = (Standard_Address) (&C1);
thecurve2 = (Standard_Address )(&C2);
}
//======================================================================
Standard_Integer IntCurve_DistBetweenPCurvesGen::NbVariables(void) const {
return(2);
}
//======================================================================
Standard_Integer IntCurve_DistBetweenPCurvesGen::NbEquations(void) const {
return(2);
}
//======================================================================
Standard_Boolean 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(Standard_True);
}
//======================================================================
Standard_Boolean 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(Standard_True);
}
//======================================================================
Standard_Boolean 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(Standard_True);
}
//======================================================================