X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAPI%2FGeomAPI_Lin.cpp;h=d3f44a404aedef61c6d26e1c8625bf2a247f79d6;hb=b06cf1477fb1ee46d7ae260c234cac5d0000abf2;hp=348bf01a803c5b2d43e10934bc77c689c451aab3;hpb=423c10234142d14d0d5de89383f2f96a4ec5930f;p=modules%2Fshaper.git diff --git a/src/GeomAPI/GeomAPI_Lin.cpp b/src/GeomAPI/GeomAPI_Lin.cpp index 348bf01a8..d3f44a404 100644 --- a/src/GeomAPI/GeomAPI_Lin.cpp +++ b/src/GeomAPI/GeomAPI_Lin.cpp @@ -1,8 +1,22 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -// File: GeomAPI_Lin.cpp -// Created: 29 May 2014 -// Author: Artem ZHIDKOV +// Copyright (C) 2014-2017 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or +// email : webmaster.salome@opencascade.com +// #include #include @@ -93,14 +107,21 @@ const std::shared_ptr GeomAPI_Lin::intersect( new GeomAPI_Pnt(aResult.X(), aResult.Y(), aResult.Z())); } -const std::shared_ptr GeomAPI_Lin::project( - const std::shared_ptr& thePoint) const +double GeomAPI_Lin::projParam( + const std::shared_ptr& thePoint) const { const gp_XYZ& aDir = MY_LIN->Direction().XYZ(); const gp_XYZ& aLoc = MY_LIN->Location().XYZ(); const gp_XYZ& aPnt = thePoint->impl().XYZ(); - double aParam = aDir.Dot(aPnt - aLoc); + return aDir.Dot(aPnt - aLoc); +} +const std::shared_ptr GeomAPI_Lin::project( + const std::shared_ptr& thePoint) const +{ + const gp_XYZ& aDir = MY_LIN->Direction().XYZ(); + const gp_XYZ& aLoc = MY_LIN->Location().XYZ(); + double aParam = projParam(thePoint); gp_XYZ aResult = aLoc + aDir * aParam; return std::shared_ptr(new GeomAPI_Pnt(aResult.X(), aResult.Y(), aResult.Z())); }