Giter Club home page Giter Club logo

cadop / dhart Goto Github PK

View Code? Open in Web Editor NEW
10.0 1.0 3.0 233.56 MB

A library for Navigation Graphs, Visibility, Raycasting and other features for Design Humans Analysis RoboTics (DHART).

Home Page: https://cadop.github.io/dhart/

License: GNU General Public License v3.0

C++ 77.11% CMake 1.25% C 0.01% C# 10.13% Python 9.76% CSS 1.72%
navigation raycasting built-environment computational-design navmesh visibility-graph human-navagation path-planning python simulation

dhart's Introduction

Hi there ๐Ÿ‘‹

dhart's People

Contributors

actions-user avatar cadop avatar db368 avatar galudino avatar mariuszhermansdorfer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

dhart's Issues

Python Examples

Need two sets of examples:

  • One setup showing just the python side.
  • One setup for Rhino python, using the repo to save through json

Old C Interface unittests are commented out

CMake config comments out c_interface tests:

dhart/src/CMakeLists.txt

Lines 416 to 422 in 8aa1655

# ${C_TEST_DRIVER_DIR}/embree_raytracer_cinterface.cpp
# ${C_TEST_DRIVER_DIR}/objloader_cinterface.cpp
# ${C_TEST_DRIVER_DIR}/analysis_C_cinterface.cpp
# ${C_TEST_DRIVER_DIR}/pathfinder_C_cinterface.cpp
# ${C_TEST_DRIVER_DIR}/view_analysis_cinterface.cpp
# ${C_TEST_DRIVER_DIR}/visibility_graph_cinterface.cpp
# ${C_TEST_DRIVER_DIR}/spatialstructures_C_cinterface.cpp

Need to look back and find when this happened and if all tests are covered by other ones, as the interface seems to be an older version:

status = LoadOBJ(obj_path_str.c_str(), obj_length, rot[0], rot[1], rot[2], &loaded_obj);

Missing individual package build explanation

There was an early decision to make packages that were not reliant on all the other packages.

There needs to be documentation showing how to compile and build only one part, such as the raytracing package.

C API crashes when invalid mesh is used by a BVH or can't be cleaned up

Currently just experienced with Unity when creating a BVH with 0 vertices, the C API will crash when trying to use this invalid mesh for raycasting.

While this isn't a priority since it only happens when incorrectly setting the BVH, it would be nice to have a more graceful exit.

=================================================================
	Managed Stacktrace:
=================================================================
	  at <unknown> <0xffffffff>
	  at DHARTAPI.RayTracing.NativeMethods:DestroyRayTracer <0x00126>
	  at DHARTAPI.RayTracing.NativeMethods:C_DestroyRayTracer <0x00072>
	  at DHARTAPI.RayTracing.EmbreeBVH:ReleaseHandle <0x00072>
	  at System.Runtime.InteropServices.SafeHandle:DangerousReleaseInternal <0x00670>
	  at System.Runtime.InteropServices.SafeHandle:InternalFinalize <0x0009a>
	  at System.Runtime.InteropServices.SafeHandle:Dispose <0x000e2>
	  at System.Runtime.InteropServices.SafeHandle:Finalize <0x0006b>
	  at DHARTAPI.NativeUtils.NativeObject:Finalize <0x00142>
	  at System.Object:runtime_invoke_virtual_void__this__ <0x0018b>
=================================================================

and


0x00007FF88F7446DF (embree3) rtcReleaseScene
0x00007FF8A36CE273 (DHARTAPI) GetPathInfo
0x00007FF8A36C5573 (DHARTAPI) DestroyRayTracer

consider changing C_Interface to use floats

Another idea I had was to simplify another data conversion on the c++ side. What is the rationale behind the conversions in lines 273 & 274?

C_INTERFACE CastOcclusionRays(EmbreeRayTracer* ert, const float* origins, const float* directions, int origin_size, int direction_size, float max_distance, bool* result_array)
{
auto origin_array = ConvertRawFloatArrayToPoints(origins, origin_size);
auto direction_array = ConvertRawFloatArrayToPoints(directions, direction_size);
const auto results = ert->Occlusions(origin_array, direction_array, max_distance, true);
std::copy(results.begin(), results.end(), result_array);
return OK;
}

In the end, we need float values anyway:

bool EmbreeRayTracer::Occluded_IMPL(float x, float y, float z, float dx, float dy, float dz, float distance, int mesh_id)
{
auto ray = ConstructRay(x, y, z, dx, dy, dz, distance);
rtcOccluded1(scene, &context, &ray);
return ray.tfar == -INFINITY;
}

If it's only to make looping over data more convenient, then it could be restructured to operating directly on a pointer to the float array we pass from c#. This could shave off another few ms per call.

Originally posted by @mariuszhermansdorfer in #33 (reply in thread)

Building in command line places build folder outside of repo

Describe the bug
Building from the command line produces warnings. Build completes successfully but places build folder in unexpected directory.

To Reproduce
Follow build instructions for Python Release

Expected behavior
No warnings are expected
Build folder is expected at dhart/build/Python/

Screenshots
The following output is produced by the first step:

-- Selecting Windows SDK version 10.0.20348.0 to target Windows 10.0.19044.
cmake : CMake Warning:
At line:1 char:1
+ cmake ./src/  -G"Visual Studio 16 2019"  -DCMAKE_GENERATOR_PLATFORM=" ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (CMake Warning::String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
  Ignoring extra path from command line:
   ".\"
-- The C compiler identification is MSVC 19.29.30146.0
-- The CXX compiler identification is MSVC 19.29.30146.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
 EIGEN DIR 
 ROBIN_HOOD 
[STATUS]All Selected as the current DHARTAPI_Configuration
[STATUS]Generating all packages
[STATUS]Setting embree dir to C:/Users/USER/Documents/GitHub/dhart/src/external/Embree
Installing Python!
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:
    INSTALL_GTEST
-- Build files have been written to: C:/Users/USER/Documents/GitHub/dhart

Build and install complete successfully.

Build folder appears in the parent directory.

Additional context

Some of the Visual Studio tools required in BUILD.md are not listed in the Visual Studio Community 2019 Installer by name. As many as could be found + anything related was used.

Unity integration is not supported in Editor

The current unity integration demo requires users to build and run the project, so it works for releasing and running a Unity project, but not for running with the editor.

The issue is when users drag the DLLs into Assets, there is no error, and can use the DLL in visual studio. However, when pressing play in the editor, it says that the C DLL is not found and errors with DLLNotFoundException: DHARTAPI.dll. When using build and run the target project does work.

I am not sure how to solve it, or how to make the process easier.

Expose Edge Types

Edge type for step etc. is not exposed in C API.

EdgeSet is using intedge, which is 'lightweight', probably for performance. If performance isn't too bad, include an edgeset with cost type stored. Doesn't need to be returned with graph, but should act like a custom attribute or energy expenditure for query on an edge id.

Add tests to CI

Pytest, doctest, and google tests are used within the repo, but they currently aren't integrated with workflows. Need to add them to pull request on main.

Add built-in for object distance in graph

From the SHAPE paper, it shows how to make a path in the center of the room without removing nodes. This should be a default edge set value that takes in a specified distance and perhaps a falloff coefficient (function?)

Add Release workflow

Setup github actions to automatically create release/tags on pull to the main branch.

Add support for stream of rays in Embree

Currently, DHART only shoots single rays with the rtcOccluded1 method:

bool EmbreeRayTracer::Occluded_IMPL(float x, float y, float z, float dx, float dy, float dz, float distance, int mesh_id)
{
auto ray = ConstructRay(x, y, z, dx, dy, dz, distance);
rtcOccluded1(scene, &context, &ray);
return ray.tfar == -INFINITY;
}

Embree, however, supports shooting streams of rays in various configurations:
rtcOccluded1M
rtcOccluded1Mp
rtcOccludedNp

Furthermore, 3 flags can be passed to the intersection context to speed up ray traversal:
https://spec.oneapi.io/oneart/latest/embree-spec.html#rtcinitintersectcontext

enum RTCIntersectContextFlags
{
  RTC_INTERSECT_CONTEXT_FLAG_NONE,
  RTC_INTERSECT_CONTEXT_FLAG_INCOHERENT,
  RTC_INTERSECT_CONTEXT_FLAG_COHERENT,
}; 

It would be great if these could be added to the c# wrapper as well.

Missing Rhino and Grasshopper Plugin

Currently users need to export the mesh data from grasshopper and load in visualization results. We need to add a build of the plugin for direct access.

Documentation for Build missing visuals

There is a build.md in the main directory, but it does not contain any image guides and is not included in the C++/C#/Python docs.

Need to add a walkthrough of using visual studio to build the project from source, regenerating cmake, opening the build solution, using the cmake install (in VS).

Consider adding a method to modify an existing BVH in embree

Use case description:

I'm working with a large mesh (500.000 quads) against which I constantly cast single rays from mouse cursor's position. This mesh is then modified while the mouse moves. At any given time only a few dozen vertices are affected. Only vertex position changes, face indices remain unchanged.

Wish

I'd like to be able to keep the existing BVH and only update a subset of vertices.

@cadop, do you have any ideas on how to approach this?

Expose Save OBJ options

The Load OBJ functions are available for an obj file and create a mesh info. It would be helpful to debug and recognize what is being used in an analysis if mesh info was able to be stored as an obj file (which can then be loaded in a graphics tool).

Git functionality not working in VS 2022

When trying to switch between branches or committing to the active one from VS 2022 I get the following error:

Git failed with a fatal error.
Git failed with a fatal error.
unable to parse command-line config

Error reading git config: error running C:\Users\MRHE\AppData\Local\Programs\Git\mingw64\bin\git.exe 'config' '-l': 'error: bogus format in GIT_CONFIG_PARAMETERS
unable to parse command-line config' 'exit status 128'

The Git for Windows Desktop App works fine.
This is the first time I encounter a similar problem and unfortunately don't really know how to troubleshoot it.

EDIT, here is the error message when I try to pull from remote:

Remote: Total 74 (delta 52), reused 71 (delta 49), pack-reused 0        
From https://github.com/mariuszhermansdorfer/dhart
   f78e70523..5155c7795  support-for-stream-of-rays-in-embree -> origin/support-for-stream-of-rays-in-embree
Updating f78e70523..5155c7795
Error: failed to call git rev-parse --git-dir: exit status 128 : error: bogus format in GIT_CONFIG_PARAMETERS
Git failed with a fatal error.
Git failed with a fatal error.
unable to parse command-line config

Error reading git config: error running C:\Users\MRHE\AppData\Local\Programs\Git\mingw64\bin\git.exe 'config' '-l': 'error: bogus format in GIT_CONFIG_PARAMETERS
unable to parse command-line config' 'exit status 128'

Website needs better buttons

The current index.html simply defines some HTML buttons to navigate to individual docs. It would be nice to improve this landing/splash page.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.