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
4bb3aef7
Commit
4bb3aef7
authored
Dec 12, 2022
by
rv3Dcv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add collisionMargin
parent
742f6d7c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
CollisionSolvingStep.cs
...imulation/Assets/Guidewire_Assets/CollisionSolvingStep.cs
+4
-3
CollisionSolvingStep_UnityVariant.cs
...ets/Guidewire_Assets/CollisionSolvingStep_UnityVariant.cs
+2
-1
No files found.
GuidewireSimulation/GuidewireSimulation/Assets/Guidewire_Assets/CollisionSolvingStep.cs
View file @
4bb3aef7
...
@@ -14,7 +14,7 @@ namespace GuidewireSim
...
@@ -14,7 +14,7 @@ namespace GuidewireSim
Vector3
initialPositionPrediction
=
new
Vector3
();
Vector3
initialPositionPrediction
=
new
Vector3
();
float
sphereRadius
=
5f
;
//!< The radius of a sphere of the guidewire.
float
sphereRadius
=
5f
;
//!< The radius of a sphere of the guidewire.
float
collisionMargin
=
0.0
0
1f
;
/**< A margin by which a colliding element of the guidewire is set away from the object colliding with
float
collisionMargin
=
0.01f
;
/**< A margin by which a colliding element of the guidewire is set away from the object colliding with
* in the direction of the normal.
* in the direction of the normal.
* @note Without this margin, the colliding element of the guidewire (e.g. a sphere) is corrected such that
* @note Without this margin, the colliding element of the guidewire (e.g. a sphere) is corrected such that
* its surface exactly touches the object colliding with, which results in the guidewire still
* its surface exactly touches the object colliding with, which results in the guidewire still
...
@@ -185,7 +185,7 @@ namespace GuidewireSim
...
@@ -185,7 +185,7 @@ namespace GuidewireSim
Vector3
closestSurfacePoint
,
Vector3
normalVector
)
Vector3
closestSurfacePoint
,
Vector3
normalVector
)
{
{
Debug
.
DrawLine
(
closestSurfacePoint
,
closestSurfacePoint
+
20f
*
normalVector
,
Color
.
blue
,
2f
);
Debug
.
DrawLine
(
closestSurfacePoint
,
closestSurfacePoint
+
20f
*
normalVector
,
Color
.
blue
,
2f
);
Debug
.
DrawLine
(
otherPosition
,
spherePositionPrediction
,
Color
.
yellow
,
2f
);
//
Debug.DrawLine(otherPosition, spherePositionPrediction, Color.yellow, 2f);
DebugExtension
.
DrawPoint
(
spherePositionPrediction
,
Color
.
white
);
DebugExtension
.
DrawPoint
(
spherePositionPrediction
,
Color
.
white
);
...
@@ -195,7 +195,8 @@ namespace GuidewireSim
...
@@ -195,7 +195,8 @@ namespace GuidewireSim
protected
Vector3
CalculateDeltaPosition
(
Vector3
spherePositionPrediction
,
Vector3
closestSurfacePoint
,
Vector3
normalVector
)
protected
Vector3
CalculateDeltaPosition
(
Vector3
spherePositionPrediction
,
Vector3
closestSurfacePoint
,
Vector3
normalVector
)
{
{
return
-
(
spherePositionPrediction
-
sphereRadius
*
normalVector
-
closestSurfacePoint
);
// return - (spherePositionPrediction - sphereRadius * normalVector - closestSurfacePoint);
return
-
(
spherePositionPrediction
-
sphereRadius
*
normalVector
-
closestSurfacePoint
-
collisionMargin
*
normalVector
);
}
}
private
void
CorrectCollisionPredictions
(
int
sphereIndex
,
Vector3
[]
spherePositionPredictions
,
int
solverStep
,
int
constraintSolverSteps
)
private
void
CorrectCollisionPredictions
(
int
sphereIndex
,
Vector3
[]
spherePositionPredictions
,
int
solverStep
,
int
constraintSolverSteps
)
...
...
GuidewireSimulation/GuidewireSimulation/Assets/Guidewire_Assets/CollisionSolvingStep_UnityVariant.cs
View file @
4bb3aef7
...
@@ -13,7 +13,8 @@ namespace GuidewireSim
...
@@ -13,7 +13,8 @@ namespace GuidewireSim
Vector3
otherPosition
=
contactPoint
.
otherCollider
.
transform
.
position
;
Vector3
otherPosition
=
contactPoint
.
otherCollider
.
transform
.
position
;
Vector3
closestSurfacePoint
=
contactPoint
.
point
;
Vector3
closestSurfacePoint
=
contactPoint
.
point
;
Vector3
normalVector
=
(
closestSurfacePoint
-
otherPosition
).
normalized
;
// Vector3 normalVector = (closestSurfacePoint - otherPosition).normalized;
Vector3
normalVector
=
contactPoint
.
normal
;
if
(
solverStep
==
0
)
if
(
solverStep
==
0
)
{
{
...
...
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