Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
Simulating Guidewires In Blood Vessels
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Robin Viellieber
Simulating Guidewires In Blood Vessels
Commits
10e0d319
Commit
10e0d319
authored
Dec 19, 2022
by
rv3Dcv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add CollisionDetectionVessel.cs
parent
39af84d5
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
5631 additions
and
48 deletions
+5631
-48
.gitignore
.gitignore
+2
-1
CollisionDetectionPrimitive.cs
...on/Assets/Guidewire_Assets/CollisionDetectionPrimitive.cs
+46
-35
CollisionDetectionVessel.cs
...ation/Assets/Guidewire_Assets/CollisionDetectionVessel.cs
+56
-0
CollisionDetectionVessel.cs.meta
.../Assets/Guidewire_Assets/CollisionDetectionVessel.cs.meta
+11
-0
CollisionHandler.cs
...ireSimulation/Assets/Guidewire_Assets/CollisionHandler.cs
+1
-1
CollisionSolvingStep.cs
...imulation/Assets/Guidewire_Assets/CollisionSolvingStep.cs
+1
-1
CollisionTestScene_2Spheres_PrimitiveMeshSphere_UnityVariant 1.unity
...stScene_2Spheres_PrimitiveMeshSphere_UnityVariant 1.unity
+5472
-0
CollisionTestScene_2Spheres_PrimitiveMeshSphere_UnityVariant 1.unity.meta
...ne_2Spheres_PrimitiveMeshSphere_UnityVariant 1.unity.meta
+7
-0
CollisionTestScene_2Spheres_PrimitiveMeshSphere_UnityVariant.unity
...TestScene_2Spheres_PrimitiveMeshSphere_UnityVariant.unity
+25
-0
EditorUserSettings.asset
...GuidewireSimulation/UserSettings/EditorUserSettings.asset
+10
-10
No files found.
.gitignore
View file @
10e0d319
...
...
@@ -58,4 +58,5 @@ sysinfo.txt
# Crashlytics generated file
crashlytics-build.properties
GuidewireSimulation/GuidewireSimulation/.vscode/launch.json
\ No newline at end of file
GuidewireSimulation/GuidewireSimulation/.vscode/launch.json
GuidewireSimulation/GuidewireSimulation/UserSettings/EditorUserSettings.asset
GuidewireSimulation/GuidewireSimulation/Assets/Guidewire_Assets/CollisionDetectionPrimitive.cs
View file @
10e0d319
...
...
@@ -16,7 +16,6 @@ namespace GuidewireSim
* @note Should also match the position in @p spherePositions, @p sphereVelocities, @p sphereExternalForces,
* @p spherePositionPredictions in #SimulationLoop.
*/
[
SerializeField
]
bool
insideCollision
=
false
;
//!< Whether the guidewire collides from within the blood vessel or from the outside.
private
void
Awake
()
{
...
...
@@ -48,6 +47,29 @@ namespace GuidewireSim
Debug
.
LogWarning
(
"No sphereID could be assigned."
);
}
private
void
OnCollisionEnter
(
Collision
other
)
{
Debug
.
Log
(
"trigger "
+
transform
.
name
);
collisionHandler
.
RegisterCollision
(
this
.
transform
,
other
,
sphereID
);
}
private
void
OnCollisionStay
(
Collision
other
)
{
Debug
.
Log
(
"trigger "
+
transform
.
name
);
collisionHandler
.
RegisterCollision
(
this
.
transform
,
other
,
sphereID
);
}
// private void OnTriggerEnter(Collider other)
// {
// Debug.Log("trigger " + transform.name);
...
...
@@ -88,45 +110,34 @@ namespace GuidewireSim
// }
// }
private
void
OnCollisionEnter
(
Collision
other
)
{
Debug
.
Log
(
"trigger "
+
transform
.
name
);
// needed to use ClosestPoint().
// other.collider.GetComponent<MeshCollider>().convex = true;
collisionHandler
.
RegisterCollision
(
this
.
transform
,
other
,
sphereID
);
// Debug.Log(other.GetContact(0).normal.ToString("e2"));
// private void OnCollisionEnter(Collision other)
// {
// Debug.Log("trigger " + transform.name);
// // needed to use ClosestPoint().
// // other.collider.GetComponent<MeshCollider>().convex = true;
// if (!insideCollision)
// {
// collisionHandler.RegisterCollision(this.transform, other, sphereID);
// Debug.Log("pos" + this.transform.position);
// Debug.Log("colpos" + this.transform.GetComponent<SphereCollider>().center);
// Debug.Log("otherpos" + other.transform.position);
// collisionHandler.RegisterCollision(this.transform, other, sphereID);
// // Debug.Log(other.GetContact(0).normal.ToString("e2"));
// other.collider.GetComponent<MeshCollider>().convex = true;
// Vector3 otherClosestPoint = other.collider.ClosestPoint(this.transform.position);
// Debug.Log("otherclosestpoint" + otherClosestPoint.ToString("e4"));
// Debug.Log("thisclosestpoint" + this.transform.GetComponent<SphereCollider>().ClosestPoint(otherClosestPoint).ToString("e4"));
// Vector3 thisclosestpoint2 = this.transform.GetComponent<SphereCollider>().ClosestPoint(other.transform.position);
// Debug.Log("thisclosestpoint2" + thisclosestpoint2.ToString("e4"));
// Vector3 DiffCollisionPointToCenter = thisclosestpoint2 - (this.transform.position + this.transform.GetComponent<SphereCollider>().center);
// Debug.Log("DiffCollisionPointToCenter" + DiffCollisionPointToCenter.ToString("e4"));
// }
// // if (!insideCollision)
// // {
// // collisionHandler.RegisterCollision(this.transform, other, sphereID);
// // Debug.Log("pos" + this.transform.position);
// // Debug.Log("colpos" + this.transform.GetComponent<SphereCollider>().center);
// // Debug.Log("otherpos" + other.transform.position);
}
// // other.collider.GetComponent<MeshCollider>().convex = true;
// // Vector3 otherClosestPoint = other.collider.ClosestPoint(this.transform.position);
private
void
OnCollisionStay
(
Collision
other
)
{
Debug
.
Log
(
"trigger "
+
transform
.
name
);
// // Debug.Log("otherclosestpoint" + otherClosestPoint.ToString("e4"));
// // Debug.Log("thisclosestpoint" + this.transform.GetComponent<SphereCollider>().ClosestPoint(otherClosestPoint).ToString("e4"));
// // Vector3 thisclosestpoint2 = this.transform.GetComponent<SphereCollider>().ClosestPoint(other.transform.position);
// // Debug.Log("thisclosestpoint2" + thisclosestpoint2.ToString("e4"));
// // Vector3 DiffCollisionPointToCenter = thisclosestpoint2 - (this.transform.position + this.transform.GetComponent<SphereCollider>().center);
// // Debug.Log("DiffCollisionPointToCenter" + DiffCollisionPointToCenter.ToString("e4"));
// // }
if
(!
insideCollision
)
{
collisionHandler
.
RegisterCollision
(
this
.
transform
,
other
,
sphereID
);
}
}
// }
}
}
\ No newline at end of file
GuidewireSimulation/GuidewireSimulation/Assets/Guidewire_Assets/CollisionDetectionVessel.cs
0 → 100644
View file @
10e0d319
using
System.Collections
;
using
System.Collections.Generic
;
using
UnityEngine
;
using
UnityEngine.Assertions
;
namespace
GuidewireSim
{
public
class
CollisionDetectionVessel
:
MonoBehaviour
{
SimulationLoop
simulationLoop
;
//!< The SimulationLoop component in the Simulation GameObject
CollisionHandler
collisionHandler
;
//!< The CollisionHandler component in the Simulation GameObject
private
void
Awake
()
{
simulationLoop
=
FindObjectOfType
<
SimulationLoop
>();
Assert
.
IsNotNull
(
simulationLoop
);
collisionHandler
=
FindObjectOfType
<
CollisionHandler
>();
Assert
.
IsNotNull
(
collisionHandler
);
}
// private void OnCollisionEnter(Collision other)
// {
// // ContactPoint contactPoint = other.GetContact(0);
// // DebugExtension.DrawPoint(contactPoint.point, Color.black);
// int sphereID = 1;
// collisionHandler.RegisterCollision(other.transform, other, sphereID);
// }
// private void OnCollisionStay(Collision other)
// {
// // ContactPoint contactPoint = other.GetContact(0);
// // DebugExtension.DrawPoint(contactPoint.point, Color.black);
// int sphereID = 1;
// collisionHandler.RegisterCollision(other.transform, other, sphereID);
// }
private
int
YieldSphereID
(
Transform
sphereTransform
)
{
GameObject
sphereGO
=
sphereTransform
.
gameObject
;
for
(
int
sphereIndex
=
0
;
sphereIndex
<
simulationLoop
.
SpheresCount
;
sphereIndex
++)
{
if
(
sphereGO
==
simulationLoop
.
spheres
[
sphereIndex
])
{
return
sphereIndex
;
}
}
Debug
.
LogWarning
(
"No sphereID could be assigned."
);
return
0
;
}
}
}
\ No newline at end of file
GuidewireSimulation/GuidewireSimulation/Assets/Guidewire_Assets/CollisionDetectionVessel.cs.meta
0 → 100644
View file @
10e0d319
fileFormatVersion: 2
guid: bb0903acb76666a4a9257caa76e71835
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
GuidewireSimulation/GuidewireSimulation/Assets/Guidewire_Assets/CollisionHandler.cs
View file @
10e0d319
...
...
@@ -16,7 +16,7 @@ namespace GuidewireSim
* sphere GameObject that is referenced in the second element of @p spheres in SimulationLoop.
*/
float
sphereRadius
=
5f
;
float
sphereRadius
=
5f
;
//!< The radius of the sphere elements of the guidewire.
private
void
Start
()
{
...
...
GuidewireSimulation/GuidewireSimulation/Assets/Guidewire_Assets/CollisionSolvingStep.cs
View file @
10e0d319
...
...
@@ -64,7 +64,7 @@ namespace GuidewireSim
protected
virtual
void
SolveCollisionConstraint
(
Vector3
spherePositionPrediction
,
CollisionPair
collisionPair
,
int
solverStep
,
out
Vector3
deltaPosition
)
{
int
sphereID
=
collisionPair
.
sphereID
;
//
int sphereID = collisionPair.sphereID;
ContactPoint
contactPoint
=
collisionPair
.
vesselCollider
.
GetContact
(
0
);
Vector3
otherPosition
=
contactPoint
.
otherCollider
.
transform
.
position
;
...
...
GuidewireSimulation/GuidewireSimulation/Assets/Guidewire_Assets/CollisionTestScene_2Spheres_PrimitiveMeshSphere_UnityVariant 1.unity
0 → 100644
View file @
10e0d319
This diff is collapsed.
Click to expand it.
GuidewireSimulation/GuidewireSimulation/Assets/Guidewire_Assets/CollisionTestScene_2Spheres_PrimitiveMeshSphere_UnityVariant 1.unity.meta
0 → 100644
View file @
10e0d319
fileFormatVersion: 2
guid: cea302732c4b76f4ea21bc1b324d78a9
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
GuidewireSimulation/GuidewireSimulation/Assets/Guidewire_Assets/CollisionTestScene_2Spheres_PrimitiveMeshSphere_UnityVariant.unity
View file @
10e0d319
...
...
@@ -169,6 +169,7 @@ GameObject:
-
component
:
{
fileID
:
137101341
}
-
component
:
{
fileID
:
137101339
}
-
component
:
{
fileID
:
137101340
}
-
component
:
{
fileID
:
137101344
}
m_Layer
:
6
m_Name
:
Sphere_MeshCollider
m_TagString
:
Untagged
...
...
@@ -269,6 +270,18 @@ Transform:
m_Father
:
{
fileID
:
0
}
m_RootOrder
:
5
m_LocalEulerAnglesHint
:
{
x
:
0
,
y
:
0
,
z
:
0
}
---
!u!114
&137101344
MonoBehaviour
:
m_ObjectHideFlags
:
0
m_CorrespondingSourceObject
:
{
fileID
:
0
}
m_PrefabInstance
:
{
fileID
:
0
}
m_PrefabAsset
:
{
fileID
:
0
}
m_GameObject
:
{
fileID
:
137101338
}
m_Enabled
:
1
m_EditorHideFlags
:
0
m_Script
:
{
fileID
:
11500000
,
guid
:
bb0903acb76666a4a9257caa76e71835
,
type
:
3
}
m_Name
:
m_EditorClassIdentifier
:
---
!u!1
&152071858
stripped
GameObject
:
m_CorrespondingSourceObject
:
{
fileID
:
2996864074033366817
,
guid
:
21245aa63eb67904188b68d3b66312df
,
type
:
3
}
...
...
@@ -286,6 +299,10 @@ PrefabInstance:
m_Modification
:
m_TransformParent
:
{
fileID
:
49749013
}
m_Modifications
:
-
target
:
{
fileID
:
163888678
,
guid
:
71f983e886cdf6b418bb6e5402e7361d
,
type
:
3
}
propertyPath
:
m_Enabled
value
:
0
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
163888678
,
guid
:
71f983e886cdf6b418bb6e5402e7361d
,
type
:
3
}
propertyPath
:
insideCollision
value
:
0
...
...
@@ -425,6 +442,10 @@ PrefabInstance:
propertyPath
:
fixedTimeStep
value
:
0.02
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
4233146888435007091
,
guid
:
0e128b35dc3ea6746b6de609560d672d
,
type
:
3
}
propertyPath
:
constraintSolverSteps
value
:
1000
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
4233146888435007091
,
guid
:
0e128b35dc3ea6746b6de609560d672d
,
type
:
3
}
propertyPath
:
spheres.Array.data[0]
value
:
...
...
@@ -5375,6 +5396,10 @@ PrefabInstance:
m_Modification
:
m_TransformParent
:
{
fileID
:
49749013
}
m_Modifications
:
-
target
:
{
fileID
:
163888678
,
guid
:
71f983e886cdf6b418bb6e5402e7361d
,
type
:
3
}
propertyPath
:
m_Enabled
value
:
0
objectReference
:
{
fileID
:
0
}
-
target
:
{
fileID
:
163888678
,
guid
:
71f983e886cdf6b418bb6e5402e7361d
,
type
:
3
}
propertyPath
:
insideCollision
value
:
0
...
...
GuidewireSimulation/GuidewireSimulation/UserSettings/EditorUserSettings.asset
View file @
10e0d319
...
...
@@ -6,34 +6,34 @@ EditorUserSettings:
serializedVersion
:
4
m_ConfigSettings
:
RecentlyUsedScenePath-0
:
value
:
224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34c6190306181af41814
cc001b14d71dfa2fc61608d22f1ddcc41cdff79bc3dae3ccf2
value
:
224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34c6190306181af41814
d2150019e60dc71ff72a12c20d05f8cc0fd8e2dbc29affd6e2f3c1
flags
:
0
RecentlyUsedScenePath-1
:
value
:
224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34c6190306181af41814
cc001b14d71d8b0fc61608d2
value
:
224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34c6190306181af41814
d2150019e60dc71ff72a12c20d05f8cc0fd8e2dbc2ebf8d7ffe6ccdbdbeee7faf9fae1
flags
:
0
RecentlyUsedScenePath-2
:
value
:
224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34c6190306181af41814d2150019
f511d51f860a12c20d05
value
:
224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34c6190306181af41814d2150019
e60dc71ff72a12c20d05f8cc0fd8e2dbc2ebefdcece296cbd1a9e6ed
flags
:
0
RecentlyUsedScenePath-3
:
value
:
224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34c6190306181af41814d2150019
f511d51ff72a12c20d05f8cc0fd8e2dbc29affd6e2f3c1
value
:
224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34c6190306181af41814d2150019
e60dc71ff72a12c20d05f8cc0fd8e2dbc2ebc8dde7e8cffbdba7f7bae5e0f1e1e8
flags
:
0
RecentlyUsedScenePath-4
:
value
:
224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06
d540d1137f7180c18c93b18021c07e90707fa3d1602cd28cc0acd2029c51008d7fb1cc3ead4d8c0a4cde5eeccc7
value
:
224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06
e372e093ae00f1a34c6190306181af41814d2150019f511d51ff72a12c20d05f8cc0fd8e2dbc29affd6e2f3c1
flags
:
0
RecentlyUsedScenePath-5
:
value
:
224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34c6190306181af41814d2150019
f608cd1fda1a23fe1715dad42bd0f1dcd7dafe96fee9d1cac6
value
:
224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34c6190306181af41814d2150019
e60dc71ff72a12c20d05f8cc0fd8e2dbc2ebd9ccf9e6d1d9d7b4bce1fee7ecec
flags
:
0
RecentlyUsedScenePath-6
:
value
:
224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34c6190306181af41814d2150019e60dc71ff72a12c20d05f8cc0fd8e2dbc2
9affd6e2f3c
1
value
:
224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34c6190306181af41814d2150019e60dc71ff72a12c20d05f8cc0fd8e2dbc2
ebd8d7ffe6ccdbdbeee7faf9fae
1
flags
:
0
RecentlyUsedScenePath-7
:
value
:
224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34c6190306181af41814d2150019
e60dc71ff72a12c20d05f8cc0fd8e2dbc2ebf8d7ffe6ccdbdbeee7faf9fae1
value
:
224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34c6190306181af41814d2150019
f608cd1fda1a23fe1715dad42bd0f1dcd7dafe96fee9d1cac6
flags
:
0
RecentlyUsedScenePath-8
:
value
:
224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34c6190306181af41814d2150019
e60dc71ff72a12c20d05f8cc0fd8e2dbc2ebefdcece296cbd1a9e6ed
value
:
224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06e372e093ae00f1a34c6190306181af41814d2150019
f608cd1fda1a23fe1715dad42bd0f1dcd7dafe98baa9cdd0d6b4eb
flags
:
0
RecentlyUsedScenePath-9
:
value
:
224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06
e372e093ae00f1a34c6190306181af41814d2150019e60dc71ff72a12c20d05f8cc0fd8e2dbc2ebc8dde7e8cffbdba7f7bae5e0f1e1e8
value
:
224247031146467c18070827072a4d1529360b39293c357f0e26113febf33d37ecd333faf3093c393707d06
d540d1137f7180c18c93b18021c07e90707fa3d1602cd28cc0acd2029c51008d7fb1cc3ead4d8c0a4cde5eeccc7
flags
:
0
vcSharedLogLevel
:
value
:
0d5e400f0650
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment