Skip to content

Commit

Permalink
Update patches for latest OpenNURBS
Browse files Browse the repository at this point in the history
Also making a stab at trying to get our CMakeLists.txt closer to the
upstream file.  Still significant differences, but trying to work
towards minimizing them for easier updating.
  • Loading branch information
starseeker committed Jun 25, 2024
1 parent 6e75eb2 commit 5fbc05d
Show file tree
Hide file tree
Showing 28 changed files with 927 additions and 2,077 deletions.
6 changes: 3 additions & 3 deletions CMake/FindOPENNURBS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ set(_OPENNURBS_SEARCH_NORMAL
unset(_OPENNURBS_x86)
list(APPEND _OPENNURBS_SEARCHES _OPENNURBS_SEARCH_NORMAL)

set(OPENNURBS_NAMES openNURBS)
set(OPENNURBS_NAMES openNURBS OpenNURBS)

# Try each search configuration.
foreach(search ${_OPENNURBS_SEARCHES})
find_path(OPENNURBS_INCLUDE_DIR NAMES opennurbs.h ${${search}} PATH_SUFFIXES include include/openNURBS openNURBS)
find_path(OPENNURBS_X_INCLUDE_DIR NAMES opennurbs_x.h ${${search}} PATH_SUFFIXES include include/openNURBS openNURBS)
find_path(OPENNURBS_INCLUDE_DIR NAMES opennurbs.h ${${search}} PATH_SUFFIXES include include/openNURBS openNURBS include/OpenNURBS OpenNURBS)
find_path(OPENNURBS_X_INCLUDE_DIR NAMES opennurbs_x.h ${${search}} PATH_SUFFIXES include include/openNURBS openNURBS include/OpenNURBS OpenNURBS)
endforeach()

# Allow OPENNURBS_LIBRARY to be set manually, as the location of the openNURBS library
Expand Down
6 changes: 2 additions & 4 deletions opennurbs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,18 @@ if (ENABLE_OPENNURBS)
COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opennurbs_brep_cpp.patch
COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opennurbs_brep_h.patch
COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opennurbs_cmake.patch
COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opennurbs_compress.patch
COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opennurbs_defines.patch
COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opennurbs_example_brep.patch
COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opennurbs_example_gl.patch
COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opennurbs_file_utilities.patch
COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opennurbs_font.patch
COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opennurbs_locale.patch
#COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opennurbs_lock.patch
COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opennurbs_lookup.patch
COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opennurbs_object_history.patch
COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opennurbs_optimize.patch
COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opennurbs_polyline.patch
COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opennurbs_precompiledheader.patch
#COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opennurbs_statics.patch
COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opennurbs_string.patch
COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opennurbs_string_format.patch
COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opennurbs_system.patch
COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opennurbs_system_runtime.patch
COMMAND ${PATCH_EXECUTABLE};-E;-p1;${PATCH_OPTIONS};-i;${CMAKE_CURRENT_SOURCE_DIR}/opennurbs_uuid.patch
Expand Down
15 changes: 7 additions & 8 deletions opennurbs/opennurbs_android_uuid.patch
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
diff -Naur opennurbs/android_uuid/COPYING OPENNURBS_BLD/android_uuid/COPYING
--- opennurbs/android_uuid/COPYING 2023-12-20 11:22:46.198511306 -0500
+++ OPENNURBS_BLD/android_uuid/COPYING 2023-12-20 10:56:56.954787994 -0500
--- opennurbs/android_uuid/COPYING 2024-06-25 15:40:38.715532582 -0400
+++ OPENNURBS_BLD/android_uuid/COPYING 2024-06-25 15:41:49.962365115 -0400
@@ -1,3 +1,5 @@
+Copyright (C) 1996, 1997, 1998, 1999 Theodore Ts'o.
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
+Copyright (C) 1996, 1997, 1998, 1999 Theodore Ts'o.
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
52 changes: 26 additions & 26 deletions opennurbs/opennurbs_brep_cpp.patch
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
--- opennurbs/opennurbs_brep.cpp 2024-02-16 13:44:43.176776155 -0500
+++ OPENNURBS_BLD/opennurbs_brep.cpp 2024-02-16 13:49:38.419887610 -0500
@@ -3578,6 +3578,10 @@
}
}

+ // BRL-CAD uses this for a tolerance check below
+ const ON_Surface *surf = loop.Face()->SurfaceOf();
+ double urange = (surf) ? (surf->Domain(0)[1] - surf->Domain(0)[0]) : DBL_MAX;
+ double vrange = (surf) ? (surf->Domain(1)[1] - surf->Domain(1)[0]) : DBL_MAX;

// make sure ends of trims jibe
int ci0, ci1, next_lti;
@@ -3606,6 +3610,12 @@
// didn't get flagged as bad.
double xtol = (fabs(P0.x) + fabs(P1.x))*1.0e-10;
double ytol = (fabs(P0.y) + fabs(P1.y))*1.0e-10;
+
+ // Oct 12 2009 Rather than using the above check, BRL-CAD uses
+ // relative uv size if it is available
+ xtol = (urange < DBL_MAX) ? urange * trim0.m_tolerance[0] : xtol;
+ ytol = (vrange < DBL_MAX) ? vrange * trim0.m_tolerance[1] : ytol;
+
if ( xtol < ON_ZERO_TOLERANCE )
xtol = ON_ZERO_TOLERANCE;
if ( ytol < ON_ZERO_TOLERANCE )
--- opennurbs/opennurbs_brep.cpp 2024-06-25 15:28:09.117849296 -0400
+++ OPENNURBS_BLD/opennurbs_brep.cpp 2024-06-25 15:26:59.805993657 -0400
@@ -3595,6 +3595,10 @@
}
}

+ // BRL-CAD uses this for a tolerance check below
+ const ON_Surface *surf = loop.Face()->SurfaceOf();
+ double urange = (surf) ? (surf->Domain(0)[1] - surf->Domain(0)[0]) : DBL_MAX;
+ double vrange = (surf) ? (surf->Domain(1)[1] - surf->Domain(1)[0]) : DBL_MAX;

// make sure ends of trims jibe
int ci0, ci1, next_lti;
@@ -3623,6 +3627,12 @@
// didn't get flagged as bad.
double xtol = (fabs(P0.x) + fabs(P1.x))*1.0e-10;
double ytol = (fabs(P0.y) + fabs(P1.y))*1.0e-10;
+
+ // Oct 12 2009 Rather than using the above check, BRL-CAD uses
+ // relative uv size if it is available
+ xtol = (urange < DBL_MAX) ? urange * trim0.m_tolerance[0] : xtol;
+ ytol = (vrange < DBL_MAX) ? vrange * trim0.m_tolerance[1] : ytol;
+
if ( xtol < ON_ZERO_TOLERANCE )
xtol = ON_ZERO_TOLERANCE;
if ( ytol < ON_ZERO_TOLERANCE )
36 changes: 18 additions & 18 deletions opennurbs/opennurbs_brep_h.patch
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
--- opennurbs/opennurbs_brep.h 2024-02-16 13:44:43.176776155 -0500
+++ OPENNURBS_BLD/opennurbs_brep.h 2024-02-16 14:00:20.173055503 -0500
@@ -4141,6 +4141,7 @@
);

// helpers for validation checking
+public:
bool IsValidTrim(int trim_index,ON_TextLog* text_log) const;
bool IsValidTrimTopology(int trim_index,ON_TextLog* text_log) const;
bool IsValidTrimGeometry(int trim_index,ON_TextLog* text_log) const;
@@ -4166,6 +4167,7 @@
bool IsValidVertexGeometry(int vertex_index,ON_TextLog* text_log) const;
bool IsValidVertexTolerancesAndFlags(int vertex_index,ON_TextLog* text_log) const;

+protected:
void SetTolsFromLegacyValues();

// read helpers to support various versions
--- opennurbs/opennurbs_brep.h 2024-06-25 15:28:09.117849296 -0400
+++ OPENNURBS_BLD/opennurbs_brep.h 2024-06-25 15:26:59.814993508 -0400
@@ -4152,6 +4152,7 @@
);

// helpers for validation checking
+public:
bool IsValidTrim(int trim_index,ON_TextLog* text_log) const;
bool IsValidTrimTopology(int trim_index,ON_TextLog* text_log) const;
bool IsValidTrimGeometry(int trim_index,ON_TextLog* text_log) const;
@@ -4177,6 +4178,7 @@
bool IsValidVertexGeometry(int vertex_index,ON_TextLog* text_log) const;
bool IsValidVertexTolerancesAndFlags(int vertex_index,ON_TextLog* text_log) const;

+protected:
void SetTolsFromLegacyValues();

// read helpers to support various versions
Loading

0 comments on commit 5fbc05d

Please sign in to comment.