Triangle Triangle Contact
This is a translation of the triangle overlap code found in the UNC-CH RAPID package. It has not been overly optimized for Matlab. The triangles are of the form
t1 = [v1x, v1y, v1z;
v2x, v2y, v2z;
v3x, v3y, v3z ]
Here is a snippet of test code
%% test triangle collision code
clf;
hold on;
set(gcf, 'Renderer', 'zbuffer')
t1 = [1,1,1; 1,2,1; 2,2,2];
patch( t1(:,1), t1(:,2), t1(:,3), [0.5,0.5,0.5] )
t2 = [1.5,1.5,1.5; 1.2,3,-1; 0.5,2.4,1.0];
patch( t2(:,1), t2(:,2), t2(:,3), [0.75,0.5,0.5] )
t3 = [2.5,3.5,3.5; 1.2,3,-1; 0.5,2.4,1.0];
patch( t3(:,1), t3(:,2), t3(:,3), [0.5,0.75,0.5] )
t4 = [-1.1,-1,-1; -1,-2,-1; -2,-2,-2];
patch( t4(:,1), t4(:,2), t4(:,3), [0.5,0.5,0.75] )
%%
tic;
result = [triTriContact( t1, t2 ), triTriContact( t1, t3 ), triTriContact( t2, t3 ), triTriContact( t1, t4 ),triTriContact( t2, t4 )]
toc
Cite As
David Johnson (2024). Triangle Triangle Contact (https://www.mathworks.com/matlabcentral/fileexchange/38135-triangle-triangle-contact), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |