Hi al...
Need some help with the code here. heres what i got so far: rs_entitycontainer.cpp -> RS_Vector RS_EntityContainer::getNearestPerpendicular(const RS_Vector& coord ){ RS_Vector closestPoint(false); // closest found endpoint RS_VectorSolutions sol; RS_Entity* closestEntity; closestEntity = getNearestEntity(coord, NULL, RS2::ResolveAll); if (closestEntity!=NULL) { for (RS_Entity* en = firstEntity(RS2::ResolveAll); en != NULL; en = nextEntity(RS2::ResolveAll)) { if ( !en->isVisible() || en == closestEntity || en->rtti() == RS2::EntityPoint /**Point*/ || en->getParent()->rtti() == RS2::EntityInsert /**Insert*/ || en->getParent()->rtti() == RS2::EntityText /**< Text 15*/ || en->getParent()->rtti() == RS2::EntityDimAligned /**< Aligned Dimension */ || en->getParent()->rtti() == RS2::EntityDimLinear /**< Linear Dimension */ || en->getParent()->rtti() == RS2::EntityDimRadial /**< Radial Dimension */ || en->getParent()->rtti() == RS2::EntityDimDiametric /**< Diametric Dimension */ || en->getParent()->rtti() == RS2::EntityDimAngular /**< Angular Dimension */ || en->getParent()->rtti() == RS2::EntityDimLeader /**< Leader Dimension */ ){//do not do intersection for point for Spline, Insert, text, Dim continue; } sol = RS_Information::getPerpendicular(closestEntity, en); closestPoint = sol.getClosest(coord); } } return closestPoint; } rs_information.cpp-> RS_VectorSolutions RS_Information::getPerpendicular(RS_Entity* e1,RS_Entity* e2){ RS_VectorSolutions ret; RS_VectorSolutions t1; RS_VectorSolutions t2; if (e1==NULL || e2==NULL ) { RS_DEBUG->print("RS_Information::getPerpendicular() for NULL entities"); return ret; } if (e1->getId() == e2->getId()) { RS_DEBUG->print("RS_Information::getPerpendicular() of the same entity"); return ret; } // unsupported entities / entity combinations: if ( e1->rtti()==RS2::EntityText || e2->rtti()==RS2::EntityText || isDimension(e1->rtti()) || isDimension(e2->rtti())) { return ret; } // arc,circle,elipse/arc,circle,elipse if( (e1->rtti()==RS2::EntityArc || e1->rtti()==RS2::EntityCircle || e1->rtti()==RS2::EntityEllipse) && (e2->rtti()==RS2::EntityArc || e2->rtti()==RS2::EntityCircle || e2->rtti()==RS2::EntityEllipse)) { t1 = e1->getTangentPoint(); t2 = e2->getTangentPoint(); if(t1.dotP(t2)==0){ ret = container->getNearestPointOnEntity(e1); return ret; } } // line/arc,circle,elipse , arc,circle,elipse/line if(e1->rtti()==RS2::EntityArc || e1->rtti()==RS2::EntityCircle || e1->rtti()==RS2::EntityEllipse){ t1 = e1->getTangentPoint(e1->getNearestPointOnEntity(e2)); if(t2.dotP(t1)==0){ ret = container->getNearestPointOnEntity(e1); return ret; } } else if(e2->rtti()==RS2::EntityArc || e2->rtti()==RS2::EntityCircle || e2->rtti()==RS2::EntityEllipse){ t2 = e2->getTangentPoint(e2->getNearestPointOnEntity(e1)); if(t1.dotP(t2)==0){ ret = container->getNearestPointOnEntity(e1); return ret; } } //line/line t1 = e1; t2 = e2; if(t1.dotP(t2)==0){ ret = container->getNearestPointOnEntity(e1); return ret; } return ret; } See, my main problem is getting the tangent lines/vector/points from the entities on information so I can do a DotProduct, I still dont get vetor_solutions... Help please? -- Fernando da Motta Hildebrand |
Hi,
Please generate a patch (against master branch) or, send a pull request to my repo: github.com/dxli/LibreCAD Thanks, Dongxu
On Fri, Feb 17, 2012 at 2:09 PM, fernandohildebrand [via LibreCAD] <[hidden email]> wrote: Hi al... -- Dongxu Li, Ph.D. www.librecad.org |
Ive cloned the source. dont know how to do a pull request on github....
2012/2/17 dxli [via LibreCAD] <[hidden email]> Hi, -- Fernando da Motta Hildebrand |
Hi,
the easiest is to generate a patch. Some ideas like: 1, git clone git@.../LibreCAD/LibreCAD.git 2, cd LibreCAD 3, do your changes. For simplicity, you don't commit your changes to git yet 4, git diff or: git diff HEAD > /tmp/mypatch.patch If you do commit your changes in steps, git log, and supply a commit number(hash) instead of HEAD http://githowto.com/ Thanks, Dongxu On Fri, Feb 17, 2012 at 3:18 PM, fernandohildebrand [via LibreCAD] <[hidden email]> wrote: Ive cloned the source. dont know how to do a pull request on github.... -- Dongxu Li, Ph.D. www.librecad.org |
Administrator
|
In reply to this post by fernandohildebrand
Assuming you did these steps : http://help.github.com/fork-a-repo/ Then you can push your changes back to your repo. Then there is a button on github called 'send pull request'. This will create a diff for you and send it to dli. You can also do a git diff > out.patch and send that. On Feb 17, 2012, at 3:18 PM, fernandohildebrand [via LibreCAD] wrote: Ive cloned the source. dont know how to do a pull request on github.... |
Free forum by Nabble | Edit this page |