{"id":13445528,"url":"https://github.com/flexible-collision-library/fcl","last_synced_at":"2025-04-10T23:28:14.390Z","repository":{"id":4726451,"uuid":"5875030","full_name":"flexible-collision-library/fcl","owner":"flexible-collision-library","description":"Flexible Collision Library","archived":false,"fork":false,"pushed_at":"2025-03-31T23:19:49.000Z","size":12023,"stargazers_count":1516,"open_issues_count":237,"forks_count":430,"subscribers_count":55,"default_branch":"master","last_synced_at":"2025-04-03T16:53:20.414Z","etag":null,"topics":["collision","collision-detection"],"latest_commit_sha":null,"homepage":"https://flexible-collision-library.github.io/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flexible-collision-library.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-09-19T16:50:51.000Z","updated_at":"2025-04-02T01:56:56.000Z","dependencies_parsed_at":"2023-07-05T20:17:13.359Z","dependency_job_id":"c0cb975a-e41e-4a6d-8956-72fca0be8f9d","html_url":"https://github.com/flexible-collision-library/fcl","commit_stats":{"total_commits":725,"total_committers":72,"mean_commits":"10.069444444444445","dds":0.6537931034482758,"last_synced_commit":"b03987c495b75b5d873f932b1ff3fc27c1494c87"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flexible-collision-library%2Ffcl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flexible-collision-library%2Ffcl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flexible-collision-library%2Ffcl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flexible-collision-library%2Ffcl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flexible-collision-library","download_url":"https://codeload.github.com/flexible-collision-library/fcl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248314305,"owners_count":21083030,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["collision","collision-detection"],"created_at":"2024-07-31T05:00:35.588Z","updated_at":"2025-04-10T23:28:14.360Z","avatar_url":"https://github.com/flexible-collision-library.png","language":"C++","funding_links":[],"categories":["6. Planning","Physics","Uncategorized","Collision Detection","Planning and Control","[Libraries](#awesome-collision-detection)","3D视觉生成重建"],"sub_categories":["3.4 High Performance Inference","Uncategorized","Vector Map","资源传输下载"],"readme":"## FCL -- The Flexible Collision Library \n\nLinux / OS X [![Build Status](https://travis-ci.org/flexible-collision-library/fcl.svg?branch=master)](https://travis-ci.org/flexible-collision-library/fcl)\nWindows [![Build status](https://ci.appveyor.com/api/projects/status/do1k727uu6e8uemf/branch/master?svg=true)](https://ci.appveyor.com/project/flexible-collision-library/fcl)\nCoverage [![Coverage Status](https://coveralls.io/repos/github/flexible-collision-library/fcl/badge.svg?branch=master)](https://coveralls.io/github/flexible-collision-library/fcl?branch=master)\n\nFCL is a library for performing three types of proximity queries on a pair of\ngeometric models composed of triangles.\n - Collision detection: detecting whether the two models overlap, and\n   optionally, all of the triangles that overlap.\n - Distance computation: computing the minimum distance between a pair of\n   models, i.e., the distance between the closest pair of points.\n - Tolerance verification: determining whether two models are closer or farther\n   than a tolerance distance.\n - Continuous collision detection: detecting whether the two moving models\n   overlap during the movement, and optionally, the time of contact.\n - Contact information: for collision detection and continuous collision\n   detection, the contact information (including contact normals and contact\n   points) can be returned optionally.\n\nFCL has the following features\n - C++ interface\n - Compilable for either linux or win32 (both makefiles and Microsoft Visual\n   projects can be generated using cmake)\n - No special topological constraints or adjacency information required for\n   input models – all that is necessary is a list of the model's triangles\n - Supported different object shapes:\n  + box\n  + sphere\n  + ellipsoid\n  + capsule\n  + cone\n  + cylinder\n  + convex\n  + half-space\n  + plane\n  + mesh\n  + octree (optional, octrees are represented using the octomap library\n    http://octomap.github.com)\n\n\n## Installation\n\nBefore compiling FCL, please make sure Eigen and libccd (for collision checking\nbetween convex objects and is available here https://github.com/danfis/libccd)\nare installed. For libccd, make sure to compile from github version instead of\nthe zip file from the webpage, because one bug fixing is not included in the\nzipped version.\n\nSome optional libraries need to be installed for some optional capability of\nFCL. For octree collision, please install the octomap library from\nhttps://octomap.github.io/.\n\nCMakeLists.txt is used to generate makefiles in Linux or Visual studio projects\nin windows. In command line, run\n``` cmake\nmkdir build\ncd build\ncmake ..\n```\nNext, in linux, use make to compile the code. \n\nIn windows, there will generate a visual studio project and then you can compile\nthe code.\n\n## Interfaces\nBefore starting the proximity computation, we need first to set the geometry and\ntransform for the objects involving in computation. The geometry of an object is\nrepresented as a mesh soup, which can be set as follows:\n\n```cpp\n// set mesh triangles and vertice indices\nstd::vector\u003cVector3f\u003e vertices;\nstd::vector\u003cTriangle\u003e triangles;\n// code to set the vertices and triangles\n...\n// BVHModel is a template class for mesh geometry, for default OBBRSS template\n// is used\ntypedef BVHModel\u003cOBBRSSf\u003e Model;\nstd::shared_ptr\u003cModel\u003e geom = std::make_shared\u003cModel\u003e();\n// add the mesh data into the BVHModel structure\ngeom-\u003ebeginModel();\ngeom-\u003eaddSubModel(vertices, triangles);\ngeom-\u003eendModel();\n```\n\nThe transform of an object includes the rotation and translation:\n```cpp\n// R and T are the rotation matrix and translation vector\nMatrix3f R;\nVector3f T;\n// code for setting R and T\n...\n// transform is configured according to R and T\nTransform3f pose = Transform3f::Identity();\npose.linear() = R;\npose.translation() = T;\n```\n\n\nGiven the geometry and the transform, we can also combine them together to\nobtain a collision object instance and here is an example:\n```cpp\n//geom and tf are the geometry and the transform of the object\nstd::shared_ptr\u003cBVHModel\u003cOBBRSSf\u003e\u003e geom = ...\nTransform3f tf = ...\n//Combine them together\nCollisionObjectf* obj = new CollisionObjectf(geom, tf);\n```\n\nOnce the objects are set, we can perform the proximity computation between them.\nAll the proximity queries in FCL follow a common pipeline: first, set the query\nrequest data structure and then run the query function by using request as the\ninput. The result is returned in a query result data structure. For example, for\ncollision checking, we first set the CollisionRequest data structure, and then\nrun the collision function:\n```cpp\n// Given two objects o1 and o2\nCollisionObjectf* o1 = ...\nCollisionObjectf* o2 = ...\n// set the collision request structure, here we just use the default setting\nCollisionRequest request;\n// result will be returned via the collision result structure\nCollisionResult result;\n// perform collision test\ncollide(o1, o2, request, result);\n```\n\nBy setting the collision request, the user can easily choose whether to return\ncontact information (which is slower) or just return binary collision results\n(which is faster).\n\n\nFor distance computation, the pipeline is almost the same:\n\n```cpp\n// Given two objects o1 and o2\nCollisionObjectf* o1 = ...\nCollisionObjectf* o2 = ...\n// set the distance request structure, here we just use the default setting\nDistanceRequest request;\n// result will be returned via the collision result structure\nDistanceResult result;\n// perform distance test\ndistance(o1, o2, request, result);\n```\n\nFor continuous collision, FCL requires the goal transform to be provided (the\ninitial transform is included in the collision object data structure). Beside\nthat, the pipeline is almost the same as distance/collision:\n\n```cpp\n// Given two objects o1 and o2\nCollisionObjectf* o1 = ...\nCollisionObjectf* o2 = ...\n// The goal transforms for o1 and o2\nTransform3f tf_goal_o1 = ...\nTransform3f tf_goal_o2 = ...\n// set the continuous collision request structure, here we just use the default\n// setting\nContinuousCollisionRequest request;\n// result will be returned via the continuous collision result structure\nContinuousCollisionResult result;\n// perform continuous collision test\ncontinuousCollide(o1, tf_goal_o1, o2, tf_goal_o2, request, result);\n```\n\nFCL supports broadphase collision/distance between two groups of objects and can\navoid the n square complexity. For collision, broadphase algorithm can return\nall the collision pairs. For distance, it can return the pair with the minimum\ndistance. FCL uses a CollisionManager structure to manage all the objects\ninvolving the collision or distance operations.\n```cpp\n// Initialize the collision manager for the first group of objects. \n// FCL provides various different implementations of CollisionManager.\n// Generally, the DynamicAABBTreeCollisionManager would provide the best\n// performance.\nBroadPhaseCollisionManagerf* manager1 = new DynamicAABBTreeCollisionManagerf(); \n// Initialize the collision manager for the second group of objects.\nBroadPhaseCollisionManagerf* manager2 = new DynamicAABBTreeCollisionManagerf();\n// To add objects into the collision manager, using\n// BroadPhaseCollisionManager::registerObject() function to add one object\nstd::vector\u003cCollisionObjectf*\u003e objects1 = ...\nfor(std::size_t i = 0; i \u003c objects1.size(); ++i)\nmanager1-\u003eregisterObject(objects1[i]);\n// Another choose is to use BroadPhaseCollisionManager::registerObjects()\n// function to add a set of objects\nstd::vector\u003cCollisionObjectf*\u003e objects2 = ...\nmanager2-\u003eregisterObjects(objects2);\n// In order to collect the information during broadphase, CollisionManager\n// requires two settings:\n// a) a callback to collision or distance; \n// b) an intermediate data to store the information generated during the\n//    broadphase computation.\n// For convenience, FCL provides default callbacks to satisfy a) and a\n// corresponding call back data to satisfy b) for both collision and distance\n// queries. For collision use DefaultCollisionCallback and DefaultCollisionData\n// and for distance use DefaultDistanceCallback and DefaultDistanceData.\n// The default collision/distance data structs are simply containers which\n// include the request and distance structures for each query type as mentioned\n// above.\nDefaultCollisionData collision_data;\nDefaultDistanceData distance_data;\n// Setup the managers, which is related with initializing the broadphase\n// acceleration structure according to objects input\nmanager1-\u003esetup();\nmanager2-\u003esetup();\n// Examples for various queries\n// 1. Collision query between two object groups and get collision numbers\nmanager2-\u003ecollide(manager1, \u0026collision_data, DefaultCollisionFunction);\nint n_contact_num = collision_data.result.numContacts(); \n// 2. Distance query between two object groups and get the minimum distance\nmanager2-\u003edistance(manager1, \u0026distance_data, DefaultDistanceFunction);\ndouble min_distance = distance_data.result.min_distance;\n// 3. Self collision query for group 1\nmanager1-\u003ecollide(\u0026collision_data, DefaultCollisionFunction);\n// 4. Self distance query for group 1\nmanager1-\u003edistance(\u0026distance_data, DefaultDistanceFunction);\n// 5. Collision query between one object in group 1 and the entire group 2\nmanager2-\u003ecollide(objects1[0], \u0026collision_data, DefaultCollisionFunction);\n// 6. Distance query between one object in group 1 and the entire group 2\nmanager2-\u003edistance(objects1[0], \u0026distance_data, DefaultDistanceFunction);\n```\n\n\nFor more examples, please refer to the test folder:\n- test_fcl_collision.cpp: provide examples for collision test\n- test_fcl_distance.cpp: provide examples for distance test\n- test_fcl_broadphase.cpp: provide examples for broadphase collision/distance\n  test\n- test_fcl_frontlist.cpp: provide examples for frontlist collision acceleration\n- test_fcl_octomap.cpp: provide examples for collision/distance computation\n  between octomap data and other data types.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflexible-collision-library%2Ffcl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflexible-collision-library%2Ffcl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflexible-collision-library%2Ffcl/lists"}