Skip to content

Commit

Permalink
Merge pull request #280 from jcarpent/devel
Browse files Browse the repository at this point in the history
Configure and apply pre-commit
  • Loading branch information
jcarpent authored Apr 5, 2022
2 parents b1cf98b + 5fea484 commit 6b8a549
Show file tree
Hide file tree
Showing 232 changed files with 25,942 additions and 27,532 deletions.
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0067c8aa66aac548601e2a3fd029aa264cc59f2a
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
repos:
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v13.0.1
hooks:
- id: clang-format
args: ['-i', '--style={BasedOnStyle: Google, SortIncludes: false}']
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 22.3.0
hooks:
- id: black
2 changes: 1 addition & 1 deletion INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Install:
cd build
cmake ..
make -jN # N is the maximum number of parallel compile jobs

Once the compilation is finished,
make install
will install the project. To specify the installation prefix,
Expand Down
26 changes: 13 additions & 13 deletions cmake-modules/Findassimp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(ASSIMP_ARCHITECTURE "32")
endif(CMAKE_SIZEOF_VOID_P EQUAL 8)

if(WIN32)
set(ASSIMP_ROOT_DIR CACHE PATH "ASSIMP root directory")

Expand All @@ -18,12 +18,12 @@ if(WIN32)

if(MSVC12)
set(ASSIMP_MSVC_VERSIONS "vc120")
elseif(MSVC14)
elseif(MSVC14)
set(ASSIMP_MSVC_VERSIONS "vc140;vc141")
endif(MSVC12)

if(MSVC12 OR MSVC14)

foreach(ASSIMP_MSVC_VERSION ${ASSIMP_MSVC_VERSIONS})
find_path(ASSIMP_LIBRARY_DIR
NAMES
Expand All @@ -32,39 +32,39 @@ if(WIN32)
HINTS
${ASSIMP_ROOT_DIR}/lib${ASSIMP_ARCHITECTURE}
)

find_library(ASSIMP_LIBRARY_RELEASE assimp-${ASSIMP_MSVC_VERSION}-mt.lib PATHS ${ASSIMP_LIBRARY_DIR})
find_library(ASSIMP_LIBRARY_DEBUG assimp-${ASSIMP_MSVC_VERSION}-mtd.lib PATHS ${ASSIMP_LIBRARY_DIR})

IF(NOT ASSIMP_LIBRARY_RELEASE AND NOT ASSIMP_LIBRARY_DEBUG)
continue()
ENDIF()

IF(ASSIMP_LIBRARY_DEBUG)
set(ASSIMP_LIBRARY
set(ASSIMP_LIBRARY
optimized ${ASSIMP_LIBRARY_RELEASE}
debug ${ASSIMP_LIBRARY_DEBUG}
)
ELSE()
set(ASSIMP_LIBRARY
set(ASSIMP_LIBRARY
optimized ${ASSIMP_LIBRARY_RELEASE}
)
ENDIF()

set(ASSIMP_LIBRARIES ${ASSIMP_LIBRARY_RELEASE} ${ASSIMP_LIBRARY_DEBUG})

FUNCTION(ASSIMP_COPY_BINARIES TargetDirectory)
ADD_CUSTOM_TARGET(AssimpCopyBinaries
COMMAND ${CMAKE_COMMAND} -E copy ${ASSIMP_ROOT_DIR}/bin${ASSIMP_ARCHITECTURE}/assimp-${ASSIMP_MSVC_VERSION}-mtd.dll ${TargetDirectory}/Debug/assimp-${ASSIMP_MSVC_VERSION}-mtd.dll
COMMAND ${CMAKE_COMMAND} -E copy ${ASSIMP_ROOT_DIR}/bin${ASSIMP_ARCHITECTURE}/assimp-${ASSIMP_MSVC_VERSION}-mt.dll ${TargetDirectory}/Release/assimp-${ASSIMP_MSVC_VERSION}-mt.dll
COMMENT "Copying Assimp binaries to '${TargetDirectory}'"
VERBATIM)
ENDFUNCTION(ASSIMP_COPY_BINARIES)

SET(assimp_LIBRARIES ${ASSIMP_LIBRARY})
endforeach()
endif()

else(WIN32)

find_path(
Expand Down Expand Up @@ -96,5 +96,5 @@ else(WIN32)
message(FATAL_ERROR "Could not find asset importer library")
endif (assimp_FIND_REQUIRED)
endif (assimp_FOUND)

endif(WIN32)
52 changes: 33 additions & 19 deletions doc/generate_distance_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,38 @@

interactive = False

m = 1.
m = 1.0
b = 1.2

mb = m+b
mb = m + b

X = np.array([-mb / 2, 0, m, mb, 2 * mb])
# X = np.linspace(-1, 4., 21)

X = np.array([ -mb/2, 0, m, mb, 2*mb ])
#X = np.linspace(-1, 4., 21)

def dlb(d):
if d<0: return None
if d < 0:
return None
if d > mb:
u = d-mb
return mb-m + u / 2
return d-m
u = d - mb
return mb - m + u / 2
return d - m


plt.figure(figsize=(9, 3.5))
#plt.plot(X, X-m, ":k")
#plt.plot([m+b, X[-1]], [b, b], ":k")
plt.fill_between([m+b, X[-1]], [b, b], [b, X[-1]-m], alpha=0.2, hatch="|", facecolor="g", label="Distance lower band area")
plt.plot(X, [ dlb(x) for x in X ], "-g", label="distance lower bound")
#plt.plot([X[0], m, m, X[-1]], [0, 0, b, b], ":k")
# plt.plot(X, X-m, ":k")
# plt.plot([m+b, X[-1]], [b, b], ":k")
plt.fill_between(
[m + b, X[-1]],
[b, b],
[b, X[-1] - m],
alpha=0.2,
hatch="|",
facecolor="g",
label="Distance lower band area",
)
plt.plot(X, [dlb(x) for x in X], "-g", label="distance lower bound")
# plt.plot([X[0], m, m, X[-1]], [0, 0, b, b], ":k")
plt.axvspan(X[0], m, alpha=0.5, hatch="\\", facecolor="r", label="Collision area")


Expand All @@ -38,17 +49,20 @@ def dlb(d):
ax.grid(which="minor", ls="dashed")

plt.axvline(0, ls="solid")
#plt.axvline(m, ls="dashed", label="margin")
#plt.axvline(mb, ls="dashed")
plt.axhline(0., ls="solid")
# plt.axvline(m, ls="dashed", label="margin")
# plt.axvline(mb, ls="dashed")
plt.axhline(0.0, ls="solid")

plt.title("Collision and distance lower band")
plt.legend(loc="lower right")
if interactive:
plt.show()
else:
import os.path as path

dir_path = path.dirname(path.realpath(__file__))
plt.savefig(path.join(dir_path, "distance_computation.png"),
bbox_inches="tight",
orientation="landscape")
plt.savefig(
path.join(dir_path, "distance_computation.png"),
bbox_inches="tight",
orientation="landscape",
)
Loading

0 comments on commit 6b8a549

Please sign in to comment.