Part: determine tangent intersection of two 2d curves

This commit is contained in:
wmayer
2020-02-13 12:51:40 +01:00
parent b799996c22
commit 3cbe309330
2 changed files with 30 additions and 0 deletions

View File

@@ -563,6 +563,21 @@ PyObject* GeometryCurvePy::intersect2d(PyObject *args)
tuple.setItem(1, Py::Float(pt.Y()));
list.append(tuple);
}
if (intCC.NbSegments() > 0) {
// See also Curve2dPy::intersectCC() that uses Geom2dAPI_ExtremaCurveCurve
const Geom2dInt_GInter& gInter = intCC.Intersector();
for (int i=1; i <= gInter.NbSegments(); i++) {
const IntRes2d_IntersectionSegment& segm = gInter.Segment(i);
if (segm.HasFirstPoint()) {
const IntRes2d_IntersectionPoint& fp = segm.FirstPoint();
gp_Pnt2d pt = fp.Value();
Py::Tuple tuple(2);
tuple.setItem(0, Py::Float(pt.X()));
tuple.setItem(1, Py::Float(pt.Y()));
list.append(tuple);
}
}
}
return Py::new_reference_to(list);
}
catch (Standard_Failure& e) {

View File

@@ -174,6 +174,21 @@ bool Part2DObject::seekTrimPoints(const std::vector<Geometry *> &geomlist,
for (int i=1; i <= Intersector.NbPoints(); i++)
points.push_back(Intersector.Point(i));
if (Intersector.NbSegments() > 0) {
const Geom2dInt_GInter& gInter = Intersector.Intersector();
for (int i=1; i <= gInter.NbSegments(); i++) {
const IntRes2d_IntersectionSegment& segm = gInter.Segment(i);
if (segm.HasFirstPoint()) {
const IntRes2d_IntersectionPoint& fp = segm.FirstPoint();
points.push_back(fp.Value());
}
if (segm.HasLastPoint()) {
const IntRes2d_IntersectionPoint& fp = segm.LastPoint();
points.push_back(fp.Value());
}
}
}
for (auto p : points) {
// get the parameter of the intersection point on the primary curve
Projector.Init(p, primaryCurve);