Understanding GeomAPI_ExtremaCurveCurve

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Understanding GeomAPI_ExtremaCurveCurve

Post by abdullah »

Hi there!

I am not sure I am understanding this algorithm properly.

We use this algorithm, for example for intersections between two curves:

Code: Select all

bool GeomCurve::intersect(  GeomCurve * c, 
                            std::vector<std::pair<Base::Vector3d, Base::Vector3d>>& points, 
                            double tol) const
{
    Handle(Geom_Curve) curve1 = Handle(Geom_Curve)::DownCast(handle());
    Handle(Geom_Curve) curve2 = Handle(Geom_Curve)::DownCast(c->handle());
    
    try {
    
        if(!curve1.IsNull() && !curve2.IsNull()) {        
        
            GeomAPI_ExtremaCurveCurve intersector(curve1, curve2);
            
            if (intersector.NbExtrema() == 0 || intersector.LowerDistance() > tol) {
                // No intersection
                return false;
            }

            for (int i = 1; i <= intersector.NbExtrema(); i++) {
                if (intersector.Distance(i) > tol)
                    continue;
                
                gp_Pnt p1, p2;
                intersector.Points(i, p1, p2);
                points.emplace_back(Base::Vector3d(p1.X(),p1.Y(),p1.Z()),Base::Vector3d(p2.X(),p2.Y(),p2.Z()));
            }

            return points.size()>0?true:false;
        }
        else
            return false;
    }
    catch (Standard_Failure& e) {
        throw Base::RuntimeError(e.GetMessageString());
    }
    
}
I filed a bug report with OCCT recently:
https://tracker.dev.opencascade.org/view.php?id=30217

I have found other cases where I get no result, and I am starting to think that maybe it is me, that I do not know how to use it, and not the algorithm.

The new case is this:
Screenshot_20181021_071210.png
Screenshot_20181021_071210.png (2.48 KiB) Viewed 4060 times
There is a coincidence between the arc of circle and the line segment.

I have a stand alone c++ example where the intersection is not detected:

Code: Select all

# include <Geom_Circle.hxx>
# include <Geom_Curve.hxx>
# include <Geom_Line.hxx>
# include <Geom_Plane.hxx>


# include <GC_MakeCircle.hxx>
# include <GC_MakeSegment.hxx>
# include <GC_MakeArcOfCircle.hxx>

# include <gp.hxx>
# include <gp_Ax2.hxx>
# include <gp_Pnt.hxx>
# include <gp_Dir.hxx>
# include <gp_Pln.hxx>
# include <gp_Circ.hxx>

# include <GeomAPI.hxx>
# include <Geom2d_Curve.hxx>
# include <Geom2dAPI_InterCurveCurve.hxx>
# include <GeomAPI_ExtremaCurveCurve.hxx>

int main()
{

    double precision = 1.0e-8;
    // A line segment
    gp_Pnt p1(-15.625722, -10.526889000000001, 0.0), p2(-16.296861005504617, -7.746175, 0.0);
    GC_MakeSegment ms(p1, p2);
    Handle(Geom_TrimmedCurve) tc_line = ms.Value();

    // A circunference arc
    gp_Pnt center(-16.614095762607519, -9.1963880000000007, 0.0);
    double radius = 1.4845051823698976;
    double StartAngle = 1.3554381905682238;
    double EndAngle = 2.446854102374213;

    gp_Dir norm(0,0,1);

    gp_Ax2 xdir(center, norm);

    GC_MakeCircle mc(xdir, radius);

    Handle(Geom_Circle) circle = mc.Value();

    GC_MakeArcOfCircle ma(mc.Value()->Circ(), StartAngle, EndAngle, 1);

    if (!ma.IsDone()) {
        printf("Unable to create arc!!");
        return -1;
    }

    Handle(Geom_TrimmedCurve) arc = ma.Value();

    // NOTE: Non-tangent line with coincident endpoint
    double distance_endpoint_linesegment_startpoint_arc = arc->StartPoint().Distance(tc_line->EndPoint());


    printf("SETUP:\n");
    printf("========\n");
    printf("Description: Arc of Circle with coincident line endpoint\n\n");
    printf("Distance from endpoint of line segment to startpoint of arc: %e\n", distance_endpoint_linesegment_startpoint_arc);

    GeomAPI_ExtremaCurveCurve Intersector3d(arc, tc_line);

    printf("\tGeomAPI_ExtremaCurveCurve - NbExtrema: %d\n", Intersector3d.NbExtrema());

    return 0;
}
Output:

Code: Select all

SETUP:
========
Description: Arc of Circle with coincident line endpoint

Distance from endpoint of line segment to startpoint of arc: 1.953993e-14
        GeomAPI_ExtremaCurveCurve - NbExtrema: 0

I have checked the documentation, there is a part I may not fully understand:
Describes functions for computing all the extrema between two 3D curves. An ExtremaCurveCurve algorithm minimizes or maximizes the distance between a point on the first curve and a point on the second curve. Thus, it computes start and end points of perpendiculars common to the two curves (an intersection point is not an extremum unless the two curves are tangential at this point). Solutions consist of pairs of points, and an extremum is considered to be a segment joining the two points of a solution.
Anybody familiar with this algorithm can help me out here? Is it a bug or is it me?
ezzieyguywuf
Posts: 656
Joined: Tue May 19, 2015 1:11 am

Re: Understanding GeomAPI_ExtremaCurveCurve

Post by ezzieyguywuf »

I'm not familiar with this algorithm specifically, but I am familiar with tangents. per the Wikipedia description "in geometry, the tangent line (or simply tangent) to a plane curve at a given point is the straight line that "just touches" the curve at that point"

The line you have drawn does not appear to be tangential to the curve. Rather, it appears to intersect the curve. Therefore, per the documentation of this class, it doesn't seem this point would be considered an extrema.

Can you describe what you're trying to accomplish?
User avatar
Chris_G
Veteran
Posts: 2579
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Understanding GeomAPI_ExtremaCurveCurve

Post by Chris_G »

abdullah wrote: Sun Oct 21, 2018 5:17 am There is a coincidence between the arc of circle and the line segment.
Hi,
I tried your example in python, and it fails also.
It looks like a tolerance problem.
I get a distance of about 2e-14 between the "coincident" points.
The algo seems to fail for distance > 1e-15
See the code below :

Code: Select all

import FreeCAD
import Part
v = FreeCAD.Vector

center = v(-16.614095762607519, -9.1963880000000007, 0.0)
radius = 1.4845051823698976
StartAngle = 1.3554381905682238
EndAngle = 2.446854102374213
norm = v(0,0,1)

circ = Part.Circle(center, norm, radius)
arc = Part.ArcOfCircle(circ, StartAngle, EndAngle)

p1 = v(-15.625722, -10.526889000000001, 0.0)
p2 = v(-16.296861005504617, -7.746175, 0.0)

#**************************
# ls = Part.LineSegment(p1,p2) # FAILS (dist = 1.95e-14)
ls = Part.LineSegment(p1,arc.value(arc.FirstParameter)) # WORKS
# ls = Part.LineSegment(p1,arc.value(arc.FirstParameter)+v(1e-15,0,0)) # WORKS
# ls = Part.LineSegment(p1,arc.value(arc.FirstParameter)+v(2e-15,0,0)) # FAILS again
#**************************

pts = arc.intersectCC(ls)
com = Part.Compound([p.toShape() for p in pts])

Part.show(ls.toShape())
Part.show(arc.toShape())
Part.show(com)

abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Understanding GeomAPI_ExtremaCurveCurve

Post by abdullah »

ezzieyguywuf wrote: Mon Oct 22, 2018 3:51 am I'm not familiar with this algorithm specifically, but I am familiar with tangents. per the Wikipedia description "in geometry, the tangent line (or simply tangent) to a plane curve at a given point is the straight line that "just touches" the curve at that point"

The line you have drawn does not appear to be tangential to the curve. Rather, it appears to intersect the curve. Therefore, per the documentation of this class, it doesn't seem this point would be considered an extrema.

Can you describe what you're trying to accomplish?
I am detecting intersections between curves.

I was puzzled about the endpoints for a while. While the definition of intersection is having one point in common, the Extrema algorithm, seems to require this tangency. This seems to be ok for the points comprised but not including the end and start points, as you need the tangency to define a change, from increasing distance among two curves to decreasing or vice versa.

My conclusion is that the using extrema to detect intersection is fine as far as we are not considering the start and endpoints. I have treated this as a bug in the intersection routine, adding some extra code to additionally consider the start and endpoints outside the Extrema algorithm.

Thanks for reading! :)
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Understanding GeomAPI_ExtremaCurveCurve

Post by abdullah »

Chris_G wrote: Mon Oct 22, 2018 8:39 am
abdullah wrote: Sun Oct 21, 2018 5:17 am There is a coincidence between the arc of circle and the line segment.
Hi,
I tried your example in python, and it fails also.
It looks like a tolerance problem.
I get a distance of about 2e-14 between the "coincident" points.
The algo seems to fail for distance > 1e-15
See the code below :
With the "fixed" bug, all the example now work (in my local copy of FreeCAD).

Thanks for taking the time :)
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Understanding GeomAPI_ExtremaCurveCurve

Post by abdullah »

Hi folks!

I am finding some even more difficult to explain behaviour regarding GeomAPI_ExtremaCurveCurve.

I think I have a case where two continues curves do intersect at 2 points that are NOT the endpoints, and the algorithm only reports 1.

I would not like to make the people of OCCT lose their time miserably, so I would appreciate if somebody could take the values of the output of the c++ example below (I post the output, so no need to compile), draw it in paper and make sure that the "offset curves" intersect at two points.

I have invested almost a week trying to get the best examples for them to try and I think this one is the best I can offer.

The situation:
ArcsEllipseToTrim.png
ArcsEllipseToTrim.png (14.87 KiB) Viewed 3897 times
I am trying to trim this two arcs of ellipse (but the intersection I talk about above is not what you see, bear with me). For that, I calculate two offset curves that cannot be shown in FreeCAD, because the sketcher does not have support for Offsetcurves, but that should look something like this:
ArtisticRepresentationOffsetCurves.png
ArtisticRepresentationOffsetCurves.png (23.21 KiB) Viewed 3897 times
You have to imagine that those construction ellipses maintain a same distance with the non-construction ones, so the intersection is the center of the fillet with radius the offset value.

In the output below you can see, a succession of points (x,y,0) for the two normal ellipses above first, and then for the construction (the offset arcs of ellipse). What the code calculates should be the intersection between the offset curves.

The code detects the bottom intersection, but not the top one. Within the code, I have also pasted the output as a comment and marked where I see both intersections. Maybe I am just too tired.

It would be great if somebody can take a look.

The output:

Code: Select all

OUTPUT VALUES OF THE CURVES:

Arc of Ellipse 1 :
3.749540: (-7.275644,-2.246404,0)
4.256173: (-8.422482,-1.084028,0)
4.762806: (-9.997476,-0.612632,0)
5.269439: (-11.604936,-0.950647,0)
5.776072: (-12.841013,-2.013152,0)
6.282705: (-13.395164,-3.533211,0)
6.789338: (-13.128167,-5.128934,0)
7.295971: (-12.107101,-6.399421,0)
7.802604: (-10.588492,-7.025484,0)
8.309237: (-8.953866,-6.849835,0)
8.815870: (-7.613894,-5.916603,0)

Arc of Ellipse 2 :
3.427630: (-7.613843,-5.916620,0)
3.946857: (-6.363137,-7.268858,0)
4.466084: (-4.565407,-7.837935,0)
4.985311: (-2.694522,-7.473846,0)
5.504538: (-1.243637,-6.272562,0)
6.023765: (-0.595196,-4.550735,0)
6.542992: (-0.920124,-2.762228,0)
7.062219: (-2.132772,-1.378480,0)
7.581446: (-3.913494,-0.764240,0)
8.100673: (-5.792902,-1.081417,0)
8.619900: (-7.275595,-2.246405,0)

Offset Arc of Ellipse 1 :
3.749540: (-6.100171,-1.565646,0)
4.256173: (-7.723394,0.080638,0)
4.762806: (-9.940595,0.744547,0)
5.269439: (-12.205122,0.267937,0)
5.776072: (-13.957389,-1.239283,0)
6.282705: (-14.747802,-3.408550,0)
6.789338: (-14.367174,-5.685738,0)
7.295971: (-12.919871,-7.487803,0)
7.802604: (-10.780575,-8.370205,0)
8.309237: (-8.479384,-8.122642,0)
8.815870: (-6.582633,-6.800723,0)

Offset Arc of Ellipse 2 :
3.427630: (-8.819565,-6.542242,0)
3.946857: (-7.087416,-8.418028,0)
4.466084: (-4.641189,-9.194190,0)
4.985311: (-2.115470,-8.702613,0)
5.504538: (-0.140323,-7.064943,0)
6.023765: (0.757442,-4.675394,0)
6.542992: (0.302230,-2.169759,0)
7.062219: (-1.378655,-0.248668,0)
7.581446: (-3.803608,0.589678,0)
8.100673: (-6.340850,0.161532,0)
8.619900: (-8.357785,-1.425408,0)

Calculate intersection of offset curves

GeomAPI_ExtremaCurveCurve NbExtrema = 1
        Extrema nr 1: (-7.845691,-7.830647,0.000000),(-7.845691,-7.830647,0.000000)
The code:

Code: Select all

# include <Geom_Ellipse.hxx>
# include <Geom_Curve.hxx>
# include <Geom_TrimmedCurve.hxx>
# include <Geom_OffsetCurve.hxx>
# include <Geom_Line.hxx>
# include <Geom_Plane.hxx>


# include <GC_MakeEllipse.hxx>
# include <GC_MakeSegment.hxx>
# include <GC_MakeArcOfEllipse.hxx>

# include <gp.hxx>
# include <gp_Ax2.hxx>
# include <gp_Pnt.hxx>
# include <gp_Dir.hxx>
# include <gp_Pln.hxx>
# include <gp_Elips.hxx>

# include <GeomAPI.hxx>
# include <Geom2d_Curve.hxx>
# include <Geom2dAPI_InterCurveCurve.hxx>
# include <GeomAPI_ExtremaCurveCurve.hxx>

int main()
{

    double precision = 1.0e-8;

    // A first arc of ellipse
    // ArcOfEllipse (MajorRadius : 3.28231, MinorRadius : 3.22419, AngleXU : 3.05018, 
    // Position : (-10.1267, -3.83438, 0), Direction : (0, 0, 1), Parameter : (3.74954, 8.81587))
    gp_Pnt p1(-10.1267,-3.83438,0);
    gp_Dir norm(0,0,1);

    gp_Ax1 normaxis(p1,norm);

    gp_Ax2 xdir(p1, norm);

    xdir.Rotate(normaxis,3.05018);

    GC_MakeEllipse mc(xdir, 3.28231, 3.22419);

    if (!mc.IsDone()) {
	printf("First ellipse not done");
	return -1;
    }

    GC_MakeArcOfEllipse ma(mc.Value()->Elips(), 3.74954, 8.81587, 1);

    if (!ma.IsDone()) {
    	printf("First arc of ellipse not done");
	return -1;
    }

    Handle(Geom_TrimmedCurve) aoe1 = ma.Value();

    // A second arc of ellipse
    // ArcOfEllipse (MajorRadius : 3.7124, MinorRadius : 3.54058, AngleXU : 0.179513, 
    // Position : (-4.28788, -4.29777, 0), Direction : (0, -0, 1), Parameter : (3.42763, 8.6199))

    gp_Pnt p2(-4.28788, -4.29777, 0);
    gp_Dir norm2(0,0,1);

    gp_Ax1 normaxis2(p2,norm2);

    gp_Ax2 xdir2(p2, norm2);

    xdir2.Rotate(normaxis2, 0.179513);

    GC_MakeEllipse mc2(xdir2, 3.7124, 3.54058);

    if (!mc2.IsDone()){
        printf("Second ellipse not done");
	return -1;
    }

    GC_MakeArcOfEllipse ma2(mc2.Value()->Elips(), 3.42763, 8.6199, 1);

    if (!ma2.IsDone()){
        printf("Second arc of ellipse not done");
	return -1;
    }

    Handle(Geom_TrimmedCurve) aoe2 = ma2.Value();

    // TEST SETUP: OUTPUT CURVES

    printf("\nOUTPUT VALUES OF THE CURVES:\n");

    auto printcurve = [](Handle(Geom_Curve) c, char const* title) {
	printf("\n%s :\n",title);
    	for(double param = c->FirstParameter(); param < c->LastParameter(); param = param + (c->LastParameter()-c->FirstParameter())/10)
        	printf("%f: (%f,%f,0)\n", param, c->Value(param).X(),c->Value(param).Y());

      	printf("%f: (%f,%f,0)\n", c->LastParameter(), c->Value(c->LastParameter()).X(),c->Value(c->LastParameter()).Y());

    };

    printcurve(aoe1,"Arc of Ellipse 1");
    printcurve(aoe2,"Arc of Ellipse 2");

    // Construct Offset curves from the Arc of Ellipses
    double offset = 1.358370;
    gp_Dir norm3(0,0,1);

    Handle(Geom_OffsetCurve) oaoe1 = new Geom_OffsetCurve(aoe1, offset, norm3);
    Handle(Geom_OffsetCurve) oaoe2 = new Geom_OffsetCurve(aoe2, offset, norm3);

    printcurve(oaoe1,"Offset Arc of Ellipse 1");
    printcurve(oaoe2,"Offset Arc of Ellipse 2");

    // From the output, there are two intersections:
	//Offset Arc of Ellipse 1 :
	//3.749540: (-6.100171,-1.565646,0) <= Cross 1 of offset curves
	//4.256173: (-7.723394,0.080638,0)  <= Cross 1 of offset curves
	//4.762806: (-9.940595,0.744547,0)
	//5.269439: (-12.205122,0.267937,0)
	//5.776072: (-13.957389,-1.239283,0)
	//6.282705: (-14.747802,-3.408550,0)
	//6.789338: (-14.367174,-5.685738,0)
	//7.295971: (-12.919871,-7.487803,0)
	//7.802604: (-10.780575,-8.370205,0)
	//8.309237: (-8.479384,-8.122642,0) <= Cross 2 of offset curves
	//8.815870: (-6.582633,-6.800723,0) <= Cross 2 of offset curves

	//Offset Arc of Ellipse 2 :
	//3.427630: (-8.819565,-6.542242,0) <= Cross 2 of offset curves
	//3.946857: (-7.087416,-8.418028,0) <= Cross 2 of offset curves
	//4.466084: (-4.641189,-9.194190,0)
	//4.985311: (-2.115470,-8.702613,0)
	//5.504538: (-0.140323,-7.064943,0)
	//6.023765: (0.757442,-4.675394,0)
	//6.542992: (0.302230,-2.169759,0)
	//7.062219: (-1.378655,-0.248668,0)
	//7.581446: (-3.803608,0.589678,0)
	//8.100673: (-6.340850,0.161532,0)  <= Cross 1 of offset curves
	//8.619900: (-8.357785,-1.425408,0) <= Cross 1 of offset curves

    // Calculate intersection of offset curves

    printf("\nCalculate intersection of offset curves\n");

    GeomAPI_ExtremaCurveCurve intersector(oaoe1, oaoe2);

    if (intersector.NbExtrema() == 0 || intersector.LowerDistance() > precision) {
    	// No intersection
	printf("\nNo intersection between offset curves\n");
        return -1;
    }
    printf("\nGeomAPI_ExtremaCurveCurve NbExtrema = %d\n",intersector.NbExtrema());

    for (int i = 1; i <= intersector.NbExtrema(); i++) {
        if (intersector.Distance(i) > precision)
            continue;

        gp_Pnt p1, p2;
        intersector.Points(i, p1, p2);

	printf("\tExtrema nr %d: (%f,%f,%f),(%f,%f,%f)\n",i,p1.X(),p1.Y(),p1.Z(),p2.X(),p2.Y(),p2.Z());
    }

    return 0;
}
Compiling, if you want to do tests:

Code: Select all

g++ intersector3.cpp -I/usr/include/occt -L/usr/lib/x86_64-linux-gnu -lTKG3d -lTKernel -lTKMath -lTKGeomBase -lTKGeomAlgo -o intersector3
chrisb
Veteran
Posts: 53930
Joined: Tue Mar 17, 2015 9:14 am

Re: Understanding GeomAPI_ExtremaCurveCurve

Post by chrisb »

Sorry for not being able to help with the code. I have tried to remodel your example, assuming that you use the same functions available in sketcher, and I thought the intersections might fail as well - which they did not!

Next I wanted to create a fillet, you see it at the lower intersection. I have already point-on-object constraints and now I wanted to create tangents on top of them (this was merely to test the "remove redundants" code). And there something strange happens: If I select the elements as in the image and apply tangency, then the tangent is added to the list of constraints as expected, but nothing happens in 3D view, DOF remains as before, solver message doesn't change, elements are not made tangent.
Attachments
Bildschirmfoto 2018-10-27 um 19.45.59.png
Bildschirmfoto 2018-10-27 um 19.45.59.png (32.46 KiB) Viewed 3887 times
ellipticIntersections.FCStd
(4.71 KiB) Downloaded 36 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Understanding GeomAPI_ExtremaCurveCurve

Post by abdullah »

chrisb wrote: Sat Oct 27, 2018 5:55 pm Sorry for not being able to help with the code. I have tried to remodel your example, assuming that you use the same functions available in sketcher, and I thought the intersections might fail as well - which they did not!
No worries. Yesterday I was way too tired. Today, with a fresh mind, I used sage to plot the curves. I post the sage math code in case somebody is interested at the end of the post. In got this graph:
sage0.png
sage0.png (34.93 KiB) Viewed 3862 times
So yes, the curves do intersect. I am going to file a new bug ticket with OCCT. I hope I am not just loading them with work because of my ineptitude.
chrisb wrote: Sat Oct 27, 2018 5:55 pm Next I wanted to create a fillet, you see it at the lower intersection. I have already point-on-object constraints and now I wanted to create tangents on top of them (this was merely to test the "remove redundants" code). And there something strange happens: If I select the elements as in the image and apply tangency, then the tangent is added to the list of constraints as expected, but nothing happens in 3D view, DOF remains as before, solver message doesn't change, elements are not made tangent.
I will take a look now...

Code: Select all

aoe1 = [[-7.275644,-2.246404],[-8.422482,-1.084028],[-9.997476,-0.612632],[-11.604936,-0.950647],[-12.841013,-2.013152],[-13.395164,-3.533211],[-13.128167,-5.128934],[-12.107101,-6.399421],[-10.588492,-7.025484],[-8.953866,-6.849835],[-7.613894,-5.916603]]
paoe1 = line(aoe1, rgbcolor=(1/4,1/8,3/4))

aoe2 = [[-7.613843,-5.916620],[-6.363137,-7.268858],[-4.565407,-7.837935],[-2.694522,-7.473846],[-1.243637,-6.272562],[-0.595196,-4.550735],[-0.920124,-2.762228],[-2.132772,-1.378480],[-3.913494,-0.764240],[-5.792902,-1.081417],[-7.275595,-2.246405]]
paoe2 = line(aoe2, rgbcolor=(1/4,1/8,3/4))

oaoe1 = [[-6.100171,-1.565646],[-7.723394,0.080638],[-9.940595,0.744547],[-12.205122,0.267937],[-13.957389,-1.239283],[-14.747802,-3.408550],[-14.367174,-5.685738],[-12.919871,-7.487803],[-10.780575,-8.370205],[-8.479384,-8.122642],[-6.582633,-6.800723]]
opaoe1 = line(oaoe1, rgbcolor=(3/4,1/8,1/4))

oaoe2 = [[-8.819565,-6.542242],[-7.087416,-8.418028],[-4.641189,-9.194190],[-2.115470,-8.702613],[-0.140323,-7.064943],[0.757442,-4.675394],[0.302230,-2.169759],[-1.378655,-0.248668],[-3.803608,0.589678],[-6.340850,0.161532],[-8.357785,-1.425408]]
opaoe2 = line(oaoe2, rgbcolor=(3/4,1/8,1/4))


g = paoe1+paoe2+opaoe1+opaoe2
g.show(xmin=-15, xmax=5, ymin=-15, ymax=5)
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Understanding GeomAPI_ExtremaCurveCurve

Post by abdullah »

abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Understanding GeomAPI_ExtremaCurveCurve

Post by abdullah »

chrisb wrote: Sat Oct 27, 2018 5:55 pm Sorry for not being able to help with the code. I have tried to remodel your example, assuming that you use the same functions available in sketcher, and I thought the intersections might fail as well - which they did not!
Well, your intersections are calculated by the sketcher solver, not by OCCT. So it is kindda different.
chrisb wrote: Sat Oct 27, 2018 5:55 pm Next I wanted to create a fillet, you see it at the lower intersection. I have already point-on-object constraints and now I wanted to create tangents on top of them (this was merely to test the "remove redundants" code). And there something strange happens: If I select the elements as in the image and apply tangency, then the tangent is added to the list of constraints as expected, but nothing happens in 3D view, DOF remains as before, solver message doesn't change, elements are not made tangent.
BUG 1: What you describe is a bug and should be reported to the tracker. Something is clearly wrong. It cannot be that is added and ignored.

BUG 2: Somehow, it may be the same situation as with the "hook" in the german forum. So from a solver point of view it may also go in the direction of reworking the inter-curve-tangency constraint.

In any case, the fillet you were trying to build is a little bit odd, as the fillet, to be tangent, should go to the normal with the curves:
Screenshot_20181028_083127.png
Screenshot_20181028_083127.png (19.44 KiB) Viewed 3849 times
ellipticIntersections_2.FCStd
(5.37 KiB) Downloaded 38 times
However, making this fully constrained has been problematic and in fact, the result is not ok. The center of the fillet should be the intersection between the offset curves, and it is not. In fact the radius of the fillet should be 6mm, but I the blue dimension says 5.8mm.

BUG 3: Therefore there is indeed something weird happening here.

Please, file the 3 tickets with the tracker. There are a lot of rainy days to come... :)
Post Reply