Skip to content

Commit 4e05ddc

Browse files
committed
define parametric type in function --> no allocations anymore
1 parent d12e44b commit 4e05ddc

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/contactDetection/ContactDetectionMPR/handler.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ function computeDistances(scene::Composition.Scene{F}, ch::Composition.ContactDe
146146
n += 1
147147
nextObj = nextSuperObj[j]
148148
nextAABB = nextSuperAABB[j]
149-
pairID::Int64 = computePairID(scene, actObj, nextObj, is,i,js,j)
149+
pairID = computePairID(scene, actObj, nextObj, is,i,js,j)
150150

151151
storeDistancesForSolver!(world, pairID, ch, actObj, nextObj,
152152
actAABB, nextAABB, phase2, hasEvent)

src/contactDetection/ContactDetectionMPR/utilitiesPairID.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,14 @@ function getPositionsOfObj(scene::Composition.Scene,
6060
if movablePos == 0
6161
return (false, 0, 0)
6262
else
63-
return (true, movablePos, findall(x->x==obj, scene.superObjs[movablePos].superObjMovable.superObj)[1] )
63+
# findall(x->x==obj, scene.superObjs[movablePos].superObjMovable.superObj)[1] # needs to be improved
64+
return (true, movablePos, 0 )
6465
end
6566
end
6667

67-
function computePairID(scene::Composition.Scene,
68-
actObj::Composition.Object3D, nextObj::Composition.Object3D,
69-
is::Int64, i::Int64, js::Int64, j::Int64)::Int64
68+
function computePairID(scene::Composition.Scene{F},
69+
actObj::Composition.Object3D{F}, nextObj::Composition.Object3D{F},
70+
is::Int64, i::Int64, js::Int64, j::Int64)::Int64 where F
7071
# is: actual super - object
7172
# js: subsequent super - object
7273
# i: Object3D of is_th super - object

0 commit comments

Comments
 (0)