+
+std::shared_ptr<GeomAPI_Pnt> GeomAPI_Pln::intersect(const std::shared_ptr<GeomAPI_Lin>& theLine) const
+{
+ std::shared_ptr<GeomAPI_XYZ> aLineDir = theLine->direction()->xyz();
+ std::shared_ptr<GeomAPI_XYZ> aLineLoc = theLine->location()->xyz();
+
+ std::shared_ptr<GeomAPI_XYZ> aNormal = direction()->xyz();
+ std::shared_ptr<GeomAPI_XYZ> aLocation = location()->xyz();
+
+ double aDot = aNormal->dot(aLineDir);
+ if (Abs(aDot) < Precision::SquareConfusion())
+ return std::shared_ptr<GeomAPI_Pnt>();
+
+ double aParam = aNormal->dot(aLocation->decreased(aLineLoc)) / aDot;
+ return std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aLineLoc->added(aLineDir->multiplied(aParam))));
+}
+
+std::shared_ptr<GeomAPI_Pnt> GeomAPI_Pln::project(const std::shared_ptr<GeomAPI_Pnt>& thePoint) const
+{
+ std::shared_ptr<GeomAPI_XYZ> aNormal = direction()->xyz();
+ std::shared_ptr<GeomAPI_XYZ> aLocation = location()->xyz();
+
+ std::shared_ptr<GeomAPI_XYZ> aVec = thePoint->xyz()->decreased(aLocation);
+ double aDot = aNormal->dot(aVec);
+ std::shared_ptr<GeomAPI_XYZ> aProjection =
+ aLocation->added(aVec->decreased(aNormal->multiplied(aDot)));
+ return std::shared_ptr<GeomAPI_Pnt>(new GeomAPI_Pnt(aProjection));
+}