Back to home page

EIC code displayed by LXR

 
 

    


Warning, /include/opencascade/IntCurve_DistBetweenPCurvesGen.gxx is written in an unsupported language. File is not indexed.

0001 // Created on: 1992-10-21
0002 // Created by: Laurent BUCHARD
0003 // Copyright (c) 1992-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef OCCT_DEBUG
0018 #define No_Standard_RangeError
0019 #define No_Standard_OutOfRange
0020 #endif
0021 
0022 
0023 
0024 #include <math_Vector.hxx>
0025 #include <math_Matrix.hxx>
0026 
0027 #include <gp_Vec2d.hxx>
0028 #include <gp_Pnt2d.hxx>
0029 
0030 
0031 #define THECURVE1 (*((TheCurve *)thecurve1))
0032 #define THECURVE2 (*((TheCurve *)thecurve2))
0033 
0034 //======================================================================
0035 IntCurve_DistBetweenPCurvesGen::IntCurve_DistBetweenPCurvesGen( const TheCurve& C1
0036                                                                ,const TheCurve& C2) {
0037   thecurve1 = (Standard_Address) (&C1); 
0038   thecurve2 = (Standard_Address )(&C2);
0039 }
0040 //======================================================================
0041 Standard_Integer IntCurve_DistBetweenPCurvesGen::NbVariables(void) const {
0042   return(2);
0043 }
0044 //======================================================================
0045 Standard_Integer IntCurve_DistBetweenPCurvesGen::NbEquations(void) const {
0046   return(2);
0047 }
0048 //======================================================================
0049 Standard_Boolean IntCurve_DistBetweenPCurvesGen::Value
0050   (const math_Vector& X
0051    ,math_Vector& F)  
0052 {
0053   gp_Pnt2d P1,P2;
0054   TheCurveTool::D0(THECURVE1,X(1),P1);
0055   TheCurveTool::D0(THECURVE2,X(2),P2);
0056   F(1) = P1.X() - P2.X();
0057   F(2) = P1.Y() - P2.Y();
0058   return(Standard_True);
0059 }
0060 //======================================================================
0061 Standard_Boolean IntCurve_DistBetweenPCurvesGen::Derivatives
0062   (const math_Vector& X
0063    ,math_Matrix& D) 
0064 {
0065   gp_Vec2d T;
0066   gp_Pnt2d P;
0067   TheCurveTool::D1(THECURVE1,X(1),P,T);
0068   D.Value(1,1) = T.X();
0069   D.Value(2,1) = T.Y();
0070  
0071   TheCurveTool::D1(THECURVE2,X(2),P,T);
0072   D.Value(1,2) = -(T.X());
0073   D.Value(2,2) = -(T.Y());
0074 
0075 return(Standard_True);
0076 }
0077 //======================================================================
0078 Standard_Boolean IntCurve_DistBetweenPCurvesGen::Values
0079   (const math_Vector& X
0080    ,math_Vector& F
0081    ,math_Matrix& D) 
0082 {
0083 
0084   gp_Vec2d T;
0085   gp_Pnt2d P1,P2;
0086   
0087   TheCurveTool::D1(THECURVE1,X(1),P1,T);
0088   D.Value(1,1) = T.X();
0089   D.Value(2,1) = T.Y();
0090  
0091   TheCurveTool::D1(THECURVE2,X(2),P2,T);
0092   D.Value(1,2) = -(T.X());
0093   D.Value(2,2) = -(T.Y());
0094 
0095   F.Value(1) = P1.X() - P2.X();
0096   F.Value(2) = P1.Y() - P2.Y();
0097 
0098 return(Standard_True);
0099 }
0100 //======================================================================  
0101