Menu

Bounding Box of PolyCirculinearCurve2D

Help
2015-11-21
2016-06-08
  • Herbert Roider

    Herbert Roider - 2015-11-21

    Hi,
    if i convert a line to a PolyCirculinearCurve2D and create the bounding Box the result is wrong in my opinion:

    LinkedList<CirculinearElement2D> line = new LinkedList<>();
    line.add(new LineSegment2D(new Point2D(5,1), new Point2D(-7,2)));
    PolyCirculinearCurve2D curv = new PolyCirculinearCurve2D(line);
    Box2D b_box = curv.boundingBox();
    System.out.println("Boundingbox: "  + b_box.toString());
    

    result:
    Boundingbox: Box2D(5.0,4.9E-324,1.0,2.0)

    or with 2 elements:

    LinkedList<CirculinearElement2D> line = new LinkedList<>();
    line.add(new LineSegment2D(new Point2D(-1,3), new Point2D(-2,1)));
    line.add(new LineSegment2D(new Point2D(-2,1), new Point2D(-3,3)));      
    PolyCirculinearCurve2D curv = new PolyCirculinearCurve2D(line);
    Box2D b_box = curv.boundingBox();
    System.out.println("Boundingbox: "  + b_box.toString());
    

    result:
    Boundingbox: Box2D(-2.0,4.9E-324,1.0,3.0)

    In my project the PolyCirculinearCurve2D contains lines and arcs. It is the toolpath for a CNC lathe.
    I use this library in a netbeans plugin to plot a G-code contour. It is mainly used to calculate intersections between circles and lines.

    Complex because of a lot of java interfaces, but does a very good job, thank you!

    Herbert

     
  • David

    David - 2016-06-08

    Hi,
    sorry for delay of response, I have actually moved the repository to GitHub, and do not visit sourceforge as regularly...
    You are right, this is a bug.
    I fixed the problem, you can updated source from this page: https://github.com/dlegland/javaGeom
    or you can wait for next release (not yet planned, however).

    hope this helps anyway...
    regards,
    David

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.