From 0d6a16adc5de06f2585ba2ec3eeeb550881ab77f Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Tue, 29 Mar 2016 09:06:43 +0000 Subject: [PATCH] =?UTF-8?q?EgtGeomKernel=201.6o3=20:=20-=20possibilit?= =?UTF-8?q?=C3=A0=20di=20AddLine,=20AddArcTg=20e=20AddArc2P=20a=20CurveCom?= =?UTF-8?q?posite,=20-=20piccola=20modifica=20a=20BBox3d.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BBox3d.cpp | 5 ++- CurveComposite.cpp | 90 +++++++++++++++++++++++++++++++++++++++++++++ CurveComposite.h | 3 ++ EgtGeomKernel.rc | Bin 11734 -> 11718 bytes 4 files changed, 96 insertions(+), 2 deletions(-) diff --git a/BBox3d.cpp b/BBox3d.cpp index 9736110..12f2253 100644 --- a/BBox3d.cpp +++ b/BBox3d.cpp @@ -236,14 +236,15 @@ BBox3d::GetDiameter( double& dDiam) const } //---------------------------------------------------------------------------- -void +bool BBox3d::Translate( const Vector3d& vtMove) { if ( ! IsValid()) - return ; + return false ; // non essendoci cambio di orientamento, traslo semplicemente i punti m_ptMin = m_ptMin + vtMove ; m_ptMax = m_ptMax + vtMove ; + return true ; } //---------------------------------------------------------------------------- diff --git a/CurveComposite.cpp b/CurveComposite.cpp index 8b67775..59b038e 100644 --- a/CurveComposite.cpp +++ b/CurveComposite.cpp @@ -25,6 +25,7 @@ #include "NgeWriter.h" #include "NgeReader.h" #include "/EgtDev/Include/EGkCurveByApprox.h" +#include "/EgtDev/Include/EgkArcSpecial.h" #include "/EgtDev/Include/EGkStringUtils3d.h" #include "/EgtDev/Include/EgtPointerOwner.h" #include @@ -1533,6 +1534,95 @@ CurveComposite::ModifyEnd( const Point3d& ptNewEnd) return true ; } +//---------------------------------------------------------------------------- +bool +CurveComposite::AddLine( const Point3d& ptNew, bool bEndOrStart) +{ + // verifico lo stato + if ( m_nStatus != OK) + return false ; + // costruisco la linea + PtrOwner pLine( CreateBasicCurveLine()) ; + if ( IsNull( pLine)) + return false ; + // se da aggiungere alla fine + if ( bEndOrStart) { + Point3d ptEnd ; + GetEndPoint( ptEnd) ; + if ( ! pLine->Set( ptEnd, ptNew)) + return false ; + } + // altrimenti da aggiungere all'inizio + else { + Point3d ptStart ; + GetStartPoint( ptStart) ; + if ( ! pLine->Set( ptNew, ptStart)) + return false ; + } + return AddCurve( Release( pLine), bEndOrStart) ; +} + +//---------------------------------------------------------------------------- +bool +CurveComposite::AddArcTg( const Point3d& ptNew, bool bEndOrStart) +{ + // verifico lo stato + if ( m_nStatus != OK) + return false ; + // costruisco l'arco (in casi articolari puņ essere una linea) + PtrOwner pCrv ; + // se da aggiungere alla fine + if ( bEndOrStart) { + Point3d ptEnd ; + GetEndPoint( ptEnd) ; + Vector3d vtDir ; + GetEndDir( vtDir) ; + pCrv.Set( GetArc2PVN( ptEnd, ptNew, vtDir, Z_AX)) ; + if ( IsNull( pCrv)) + return false ; + } + // altrimenti da aggiungere all'inizio + else { + Point3d ptStart ; + GetStartPoint( ptStart) ; + Vector3d vtDir ; + GetStartDir( vtDir) ; + pCrv.Set( GetArc2PVN( ptStart, ptNew, vtDir, Z_AX)) ; + if ( IsNull( pCrv)) + return false ; + pCrv->Invert() ; + } + return AddCurve( Release( pCrv), bEndOrStart) ; +} + +//---------------------------------------------------------------------------- +bool +CurveComposite::AddArc2P( const Point3d& ptOther, const Point3d& ptNew, bool bEndOrStart) +{ + // verifico lo stato + if ( m_nStatus != OK) + return false ; + // costruisco l'arco (in casi articolari puņ essere una linea) + PtrOwner pCrv ; + // se da aggiungere alla fine + if ( bEndOrStart) { + Point3d ptEnd ; + GetEndPoint( ptEnd) ; + pCrv.Set( GetArc3P( ptEnd, ptOther, ptNew, false)) ; + if ( IsNull( pCrv)) + return false ; + } + // altrimenti da aggiungere all'inizio + else { + Point3d ptStart ; + GetStartPoint( ptStart) ; + pCrv.Set( GetArc3P( ptNew, ptOther, ptStart, false)) ; + if ( IsNull( pCrv)) + return false ; + } + return AddCurve( Release( pCrv), bEndOrStart) ; +} + //---------------------------------------------------------------------------- bool CurveComposite::AddJoint( double dU) diff --git a/CurveComposite.h b/CurveComposite.h index 367ff03..38bccf7 100644 --- a/CurveComposite.h +++ b/CurveComposite.h @@ -141,6 +141,9 @@ class CurveComposite : public ICurveComposite, public IGeoObjRW bool IsParamAtJoint( double dU) const override ; ICurve* RemoveFirstOrLastCurve( bool bLast = true) override ; bool ChangeStartPoint( double dU) override ; + bool AddLine( const Point3d& ptNew, bool bEndOrStart = true) override ; + bool AddArcTg( const Point3d& ptNew, bool bEndOrStart = true) override ; + bool AddArc2P( const Point3d& ptOther, const Point3d& ptNew, bool bEndOrStart = true) override ; bool AddJoint( double dU) override ; bool ModifyJoint( int nU, const Point3d& ptNewJoint) override ; bool RemoveJoint( int nU) override ; diff --git a/EgtGeomKernel.rc b/EgtGeomKernel.rc index d6496a986252cd34aaeb50e89cb8f5c873bf64c0..ad441509753d98025ef584a582ff96b29abb8ad9 100644 GIT binary patch delta 126 zcmcZ>eJpyz4>nd)1|0_D&HvftnVIt$j3+w^>TV9;>SKY6pJ$r9O)>{b&W&;N3}Fvu Uyb5MXBPl>J*@JO&lX3_b0C3kNQUCw| delta 158 zcmX>WeJy&!4>ooa1|0@N27}G_`OY&an9?7>VxNuM-|5}bB