Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
84bbd8a
initial commit to bring back multi-staged collision pipeline
fredroy Dec 9, 2025
047ece4
clean
fredroy Dec 9, 2025
755927a
wip
fredroy Dec 22, 2025
0b5ab60
set links
fredroy Dec 15, 2025
78c3cf5
set getresponselist to a static function
fredroy Dec 15, 2025
d20e6b5
add one unit test on warning with no model and update other tests
fredroy Dec 23, 2025
987df29
add into registry
fredroy Dec 24, 2025
6f25d7b
Update Sofa/Component/Collision/Detection/Algorithm/src/sofa/componen…
fredroy Jan 7, 2026
34deb64
use rangeloop with structured bindings in getResponseList
fredroy Jan 22, 2026
53629cb
set do*() and ctor protected in AbstractSubCollisionPipeline
fredroy Jan 22, 2026
8301776
put implementations into a cpp for AbstractSubCollisionPipeline
fredroy Jan 22, 2026
ddeb53f
Update Sofa/Component/Collision/Detection/Algorithm/src/sofa/componen…
fredroy Jan 22, 2026
ad108fa
multipipeline inherits TaskSchedulerUser
fredroy Jan 22, 2026
3a2e9e2
rename AbstractSubCollisionPipeline to BaseSubCollisionPipeline
fredroy Jan 22, 2026
bf62901
remove sorting the sub pipelines
fredroy Jan 22, 2026
7139201
remove useless code (about parallel computeResponse)
fredroy Jan 22, 2026
8453e79
remove possible dereference to null
fredroy Jan 22, 2026
add0b08
rename MultiCollisionPipeline to CompositeCollisionPipeline
fredroy Jan 22, 2026
fe73c65
the compat class CollisionPipeline now inherits CompositeCollisionPip…
fredroy Jan 22, 2026
7eba05f
CollisionPipeline: search from the local node instead of the root node
fredroy Jan 23, 2026
0bb31af
refactoring
fredroy Jan 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Sofa/Component/Collision/Detection/Algorithm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ set(SOFACOMPONENTCOLLISIONDETECTIONALGORITHM_SOURCE_DIR "src/sofa/component/coll
set(HEADER_FILES
${SOFACOMPONENTCOLLISIONDETECTIONALGORITHM_SOURCE_DIR}/config.h.in
${SOFACOMPONENTCOLLISIONDETECTIONALGORITHM_SOURCE_DIR}/init.h
${SOFACOMPONENTCOLLISIONDETECTIONALGORITHM_SOURCE_DIR}/BaseSubCollisionPipeline.h
${SOFACOMPONENTCOLLISIONDETECTIONALGORITHM_SOURCE_DIR}/BVHNarrowPhase.h
${SOFACOMPONENTCOLLISIONDETECTIONALGORITHM_SOURCE_DIR}/BruteForceBroadPhase.h
${SOFACOMPONENTCOLLISIONDETECTIONALGORITHM_SOURCE_DIR}/BruteForceDetection.h
${SOFACOMPONENTCOLLISIONDETECTIONALGORITHM_SOURCE_DIR}/CollisionPM.h
${SOFACOMPONENTCOLLISIONDETECTIONALGORITHM_SOURCE_DIR}/CompositeCollisionPipeline.h
${SOFACOMPONENTCOLLISIONDETECTIONALGORITHM_SOURCE_DIR}/DSAPBox.h
${SOFACOMPONENTCOLLISIONDETECTIONALGORITHM_SOURCE_DIR}/CollisionPipeline.h
${SOFACOMPONENTCOLLISIONDETECTIONALGORITHM_SOURCE_DIR}/DirectSAP.h
Expand All @@ -19,20 +21,24 @@ set(HEADER_FILES
${SOFACOMPONENTCOLLISIONDETECTIONALGORITHM_SOURCE_DIR}/MirrorIntersector.h
${SOFACOMPONENTCOLLISIONDETECTIONALGORITHM_SOURCE_DIR}/RayTraceDetection.h
${SOFACOMPONENTCOLLISIONDETECTIONALGORITHM_SOURCE_DIR}/RayTraceNarrowPhase.h
${SOFACOMPONENTCOLLISIONDETECTIONALGORITHM_SOURCE_DIR}/SubCollisionPipeline.h
)

set(SOURCE_FILES
${SOFACOMPONENTCOLLISIONDETECTIONALGORITHM_SOURCE_DIR}/init.cpp
${SOFACOMPONENTCOLLISIONDETECTIONALGORITHM_SOURCE_DIR}/BaseSubCollisionPipeline.cpp
${SOFACOMPONENTCOLLISIONDETECTIONALGORITHM_SOURCE_DIR}/BVHNarrowPhase.cpp
${SOFACOMPONENTCOLLISIONDETECTIONALGORITHM_SOURCE_DIR}/BruteForceBroadPhase.cpp
${SOFACOMPONENTCOLLISIONDETECTIONALGORITHM_SOURCE_DIR}/BruteForceDetection.cpp
${SOFACOMPONENTCOLLISIONDETECTIONALGORITHM_SOURCE_DIR}/DSAPBox.cpp
${SOFACOMPONENTCOLLISIONDETECTIONALGORITHM_SOURCE_DIR}/CollisionPipeline.cpp
${SOFACOMPONENTCOLLISIONDETECTIONALGORITHM_SOURCE_DIR}/CompositeCollisionPipeline.cpp
${SOFACOMPONENTCOLLISIONDETECTIONALGORITHM_SOURCE_DIR}/DirectSAP.cpp
${SOFACOMPONENTCOLLISIONDETECTIONALGORITHM_SOURCE_DIR}/DirectSAPNarrowPhase.cpp
${SOFACOMPONENTCOLLISIONDETECTIONALGORITHM_SOURCE_DIR}/IncrSAP.cpp
${SOFACOMPONENTCOLLISIONDETECTIONALGORITHM_SOURCE_DIR}/RayTraceDetection.cpp
${SOFACOMPONENTCOLLISIONDETECTIONALGORITHM_SOURCE_DIR}/RayTraceNarrowPhase.cpp
${SOFACOMPONENTCOLLISIONDETECTIONALGORITHM_SOURCE_DIR}/SubCollisionPipeline.cpp
)

sofa_find_package(Sofa.Simulation.Core REQUIRED)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/******************************************************************************
* SOFA, Simulation Open-Framework Architecture *
* (c) 2006 INRIA, USTL, UJF, CNRS, MGH *
* *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by *
* the Free Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*******************************************************************************
* Authors: The SOFA Team and external contributors (see Authors.txt) *
* *
* Contact information: contact@sofa-framework.org *
******************************************************************************/
#pragma once
#include <sofa/component/collision/detection/algorithm/BaseSubCollisionPipeline.h>

#include <sofa/core/visual/VisualParams.h>
#include <sofa/core/collision/Contact.h>

namespace sofa::component::collision::detection::algorithm
{

BaseSubCollisionPipeline::BaseSubCollisionPipeline()
: sofa::core::objectmodel::BaseObject()
{

}

void BaseSubCollisionPipeline::doBwdInit()
{

}

void BaseSubCollisionPipeline::doDraw(const core::visual::VisualParams* vparams)
{
SOFA_UNUSED(vparams);

}

void BaseSubCollisionPipeline::init()
{
this->d_componentState.setValue(sofa::core::objectmodel::ComponentState::Loading);

doInit();
}

std::set< std::string > BaseSubCollisionPipeline::getResponseList()
{
std::set< std::string > listResponse;
for (const auto& [key, creatorPtr] : *core::collision::Contact::Factory::getInstance())
{
listResponse.insert(key);
}
return listResponse;
}

void BaseSubCollisionPipeline::draw(const core::visual::VisualParams* vparams)
{
const auto stateLifeCycle = vparams->drawTool()->makeStateLifeCycle();

doDraw(vparams);
}

void BaseSubCollisionPipeline::handleEvent(sofa::core::objectmodel::Event* e)
{
doHandleEvent(e);
}

} // namespace sofa::component::collision::detection::algorithm
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/******************************************************************************
* SOFA, Simulation Open-Framework Architecture *
* (c) 2006 INRIA, USTL, UJF, CNRS, MGH *
* *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by *
* the Free Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*******************************************************************************
* Authors: The SOFA Team and external contributors (see Authors.txt) *
* *
* Contact information: contact@sofa-framework.org *
******************************************************************************/
#pragma once
#include <sofa/component/collision/detection/algorithm/config.h>

#include <sofa/core/objectmodel/BaseObject.h>

#include <set>
#include <string>

namespace sofa::core
{
class CollisionModel;
}

namespace sofa::component::collision::detection::algorithm
{

class SOFA_COMPONENT_COLLISION_DETECTION_ALGORITHM_API BaseSubCollisionPipeline : public sofa::core::objectmodel::BaseObject
{
public:
SOFA_ABSTRACT_CLASS(BaseSubCollisionPipeline, sofa::core::objectmodel::BaseObject);

protected:
BaseSubCollisionPipeline();

virtual void doInit() = 0;
virtual void doBwdInit();
virtual void doHandleEvent(sofa::core::objectmodel::Event* e) = 0;
virtual void doDraw(const core::visual::VisualParams* vparams);

public:
virtual void computeCollisionReset() = 0;
virtual void computeCollisionDetection() = 0;
virtual void computeCollisionResponse() = 0;

virtual std::vector<sofa::core::CollisionModel*> getCollisionModels() = 0;

void init() override final;
void draw(const core::visual::VisualParams* vparams) override final;
void handleEvent(sofa::core::objectmodel::Event* e) override final;

static std::set< std::string > getResponseList();
};

} // namespace sofa::component::collision::detection::algorithm
Loading
Loading