mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 12:41:18 -07:00 
			
		
		
		
	Fixing nesting crash in debug mode.
Also commented out unnecessary bloat from AppController
This commit is contained in:
		
							parent
							
								
									bded28f888
								
							
						
					
					
						commit
						34e652b985
					
				
					 47 changed files with 1928 additions and 5547 deletions
				
			
		| 
						 | 
				
			
			@ -3,7 +3,10 @@
 | 
			
		|||
find_package(GTest 1.7)
 | 
			
		||||
 | 
			
		||||
if(NOT GTEST_FOUND)
 | 
			
		||||
    message(STATUS "GTest not found so downloading...")
 | 
			
		||||
    set(URL_GTEST "https://github.com/google/googletest.git" 
 | 
			
		||||
        CACHE STRING "Google test source code repository location.")
 | 
			
		||||
 | 
			
		||||
    message(STATUS "GTest not found so downloading from ${URL_GTEST}")
 | 
			
		||||
    # Go and download google test framework, integrate it with the build
 | 
			
		||||
    set(GTEST_LIBS_TO_LINK gtest gtest_main)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -15,7 +18,7 @@ if(NOT GTEST_FOUND)
 | 
			
		|||
 | 
			
		||||
    include(DownloadProject)
 | 
			
		||||
    download_project(PROJ                googletest
 | 
			
		||||
                     GIT_REPOSITORY      https://github.com/google/googletest.git
 | 
			
		||||
                     GIT_REPOSITORY      ${URL_GTEST}
 | 
			
		||||
                     GIT_TAG             release-1.7.0
 | 
			
		||||
                     ${UPDATE_DISCONNECTED_IF_AVAILABLE}
 | 
			
		||||
    )
 | 
			
		||||
| 
						 | 
				
			
			@ -35,17 +38,18 @@ else()
 | 
			
		|||
    set(GTEST_LIBS_TO_LINK  ${GTEST_BOTH_LIBRARIES}  Threads::Threads)
 | 
			
		||||
endif()
 | 
			
		||||
 | 
			
		||||
add_executable(bp2d_tests   test.cpp
 | 
			
		||||
                            ../tools/svgtools.hpp
 | 
			
		||||
#                            ../tools/libnfpglue.hpp
 | 
			
		||||
#                            ../tools/libnfpglue.cpp
 | 
			
		||||
                            printer_parts.h
 | 
			
		||||
                            printer_parts.cpp
 | 
			
		||||
                            ${LIBNEST2D_SRCFILES}
 | 
			
		||||
                            )
 | 
			
		||||
target_link_libraries(bp2d_tests ${LIBNEST2D_LIBRARIES} ${GTEST_LIBS_TO_LINK} )
 | 
			
		||||
add_executable(tests_clipper_nlopt
 | 
			
		||||
    test.cpp
 | 
			
		||||
    ../tools/svgtools.hpp
 | 
			
		||||
#   ../tools/libnfpglue.hpp
 | 
			
		||||
#  ../tools/libnfpglue.cpp
 | 
			
		||||
    printer_parts.h
 | 
			
		||||
    printer_parts.cpp
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
target_include_directories(bp2d_tests PRIVATE BEFORE ${LIBNEST2D_HEADERS}
 | 
			
		||||
                                                     ${GTEST_INCLUDE_DIRS})
 | 
			
		||||
target_link_libraries(tests_clipper_nlopt libnest2d ${GTEST_LIBS_TO_LINK} )
 | 
			
		||||
 | 
			
		||||
add_test(libnest2d_tests bp2d_tests)
 | 
			
		||||
target_include_directories(tests_clipper_nlopt PRIVATE BEFORE
 | 
			
		||||
    ${GTEST_INCLUDE_DIRS})
 | 
			
		||||
 | 
			
		||||
add_test(libnest2d_tests tests_clipper_nlopt)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,6 +4,7 @@
 | 
			
		|||
#include <libnest2d.h>
 | 
			
		||||
#include "printer_parts.h"
 | 
			
		||||
#include <libnest2d/geometry_traits_nfp.hpp>
 | 
			
		||||
#include "../tools/svgtools.hpp"
 | 
			
		||||
//#include "../tools/libnfpglue.hpp"
 | 
			
		||||
//#include "../tools/nfp_svgnest_glue.hpp"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -125,7 +126,7 @@ TEST(GeometryAlgorithms, boundingCircle) {
 | 
			
		|||
        c = boundingCircle(part.transformedShape());
 | 
			
		||||
        if(std::isnan(c.radius())) std::cout << "fail: radius is nan" << std::endl;
 | 
			
		||||
 | 
			
		||||
        else for(auto v : shapelike::getContour(part.transformedShape()) ) {
 | 
			
		||||
        else for(auto v : shapelike::contour(part.transformedShape()) ) {
 | 
			
		||||
            auto d = pointlike::distance(v, c.center());
 | 
			
		||||
            if(d > c.radius() ) {
 | 
			
		||||
                auto e = std::abs( 1.0 - d/c.radius());
 | 
			
		||||
| 
						 | 
				
			
			@ -791,10 +792,55 @@ TEST(GeometryAlgorithms, nfpConvexConvex) {
 | 
			
		|||
TEST(GeometryAlgorithms, nfpConcaveConcave) {
 | 
			
		||||
    using namespace libnest2d;
 | 
			
		||||
 | 
			
		||||
//    Rectangle r1(10, 10);
 | 
			
		||||
//    Rectangle r2(20, 20);
 | 
			
		||||
//    auto result = Nfp::nfpSimpleSimple(r1.transformedShape(),
 | 
			
		||||
//                                       r2.transformedShape());
 | 
			
		||||
    Item stationary = {
 | 
			
		||||
        {
 | 
			
		||||
            {207, 76},
 | 
			
		||||
            {194, 117},
 | 
			
		||||
            {206, 117},
 | 
			
		||||
            {206, 104},
 | 
			
		||||
            {218, 104},
 | 
			
		||||
            {231, 117},
 | 
			
		||||
            {231, 130},
 | 
			
		||||
            {244, 130},
 | 
			
		||||
            {230, 92},
 | 
			
		||||
            {220, 92},
 | 
			
		||||
            {220, 84},
 | 
			
		||||
            {239, 76},
 | 
			
		||||
            {207, 76}
 | 
			
		||||
        },
 | 
			
		||||
        {}
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    Item orbiter = {
 | 
			
		||||
        {
 | 
			
		||||
            {78, 76},
 | 
			
		||||
            {90, 89},
 | 
			
		||||
            {76, 124},
 | 
			
		||||
            {101, 124},
 | 
			
		||||
            {101, 100},
 | 
			
		||||
            {141, 113},
 | 
			
		||||
            {141, 124},
 | 
			
		||||
            {168, 124},
 | 
			
		||||
            {158, 115},
 | 
			
		||||
            {158, 104},
 | 
			
		||||
            {121, 88},
 | 
			
		||||
            {121, 76},
 | 
			
		||||
            {78, 76}
 | 
			
		||||
        },
 | 
			
		||||
        {}
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    Rectangle r1(10, 10);
 | 
			
		||||
    Rectangle r2(20, 20);
 | 
			
		||||
    auto result = nfp::nfpSimpleSimple(stationary.transformedShape(),
 | 
			
		||||
                                       orbiter.transformedShape());
 | 
			
		||||
 | 
			
		||||
    svg::SVGWriter<PolygonImpl>::Config conf;
 | 
			
		||||
    conf.mm_in_coord_units = 1;
 | 
			
		||||
    svg::SVGWriter<PolygonImpl> wr(conf);
 | 
			
		||||
    wr.writeItem(Item(result.first));
 | 
			
		||||
    wr.save("simplesimple.svg");
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST(GeometryAlgorithms, pointOnPolygonContour) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue