kallaballa / libnfporb

Implementation of a robust no-fit polygon generation in a C++ library using an orbiting approach
GNU General Public License v3.0
106 stars 31 forks source link

Is it possible to get an example file without reading .wkt files? #15

Closed petrasvestartas closed 3 years ago

petrasvestartas commented 6 years ago

Is it possible to get an example file without reading .wkt files? But specifying them manually.

kallaballa commented 6 years ago

Absolutely. Check out

    p.inners().push_back
    p.outer().push_back
petrasvestartas commented 6 years ago

Thank you for both replies. I am trying to test simple setup when initial polygon is simple rectangle and other element is triangle. The app builds corrections but it only outputs two points (-10,0) and (0,0). Which is not a polygon. Probably I am making very simple mistake. Here is the code:

#include "pch.h"
#include <iostream>
#include "libnfporb.h"

int main()
{
    using namespace libnfporb;
    using namespace std;

    polygon_t pA ;
    polygon_t pB;

    //polygon_t::ring_type outerRing;

    //Quad
    const point_t p0(0, 0);
    const point_t p1(10, 0);
    const point_t p2(10, 10);
    const point_t p3(0, 10);

    pA.outer().push_back(p0);
    pA.outer().push_back(p1);
    pA.outer().push_back(p2);
    pA.outer().push_back(p3);
    pA.outer().push_back(p0);

    //Triangle
    const point_t p4(0, 0);
    const point_t p5(10, 0);
    const point_t p6(10, 10);

    pB.outer().push_back(p4);
    pB.outer().push_back(p5);
    pB.outer().push_back(p6);
    pB.outer().push_back(p4);

    nfp_t nfp = generateNFP(pA, pB, true);

    for (auto v : nfp) {

        for (auto vv : v) {
            cout << vv.x_;
            cout << " ";
            cout << vv.y_ << endl;
        }
    }

}
kallaballa commented 6 years ago

Could you please try to add

#define LIBNFP_USE_RATIONAL

before including the header and try again?

petrasvestartas commented 6 years ago

I still have the same issue and output is the same:

Is there any possibility to get one fully working example file without wkt?

issue

Papooch commented 4 years ago

I am having the same issue! See: https://github.com/kallaballa/libnfporb/issues/19 for details. Also when I add #define LIBNFP_USE_RATIONAL, I get the following error: fatal error C1083: Cannot open include file: 'gmp.h': No such file or directory

kallaballa commented 3 years ago

I still have the same issue and output is the same:

Is there any possibility to get one fully working example file without wkt?

Sorry for the long wait. I am on it

kallaballa commented 3 years ago

I am having the same issue! See: #19 for details. Also when I add #define LIBNFP_USE_RATIONAL, I get the following error: fatal error C1083: Cannot open include file: 'gmp.h': No such file or directory

you need to install libgmp but i ruled out that LIBNFP_USE_RATIONAL does fix the problem.

kallaballa commented 3 years ago

I found the problem. In certain cases the translation vector was trimmed to zero. fixed: ea264049d9dc92346006a838ff5709ac5efee054