Cody

Problem 45262. Remove duplicated vertices

Solution 2091178

Submitted on 13 Jan 2020 by Nicolas Douillet
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
V_in = [0 0 1;... sqrt(2) sqrt(2) 0;... -sqrt(2) sqrt(2) 0;... 0 0 1;... -sqrt(2) -sqrt(2) 0;... sqrt(2) sqrt(2) 0;... sqrt(2) -sqrt(2) 0;... 0 0 -1]; T_in = [1, 2, 3;... 1, 3, 5;... 4, 5, 7;... 2, 4, 7;... 2, 3, 8;... 3, 5, 8;... 5, 7, 8;... 2, 7, 8]; V_check = [0 0 1;... sqrt(2) sqrt(2) 0;... -sqrt(2) sqrt(2) 0;... -sqrt(2) -sqrt(2) 0;... sqrt(2) -sqrt(2) 0;... 0 0 -1]; T_check = [1, 2, 3;... 1, 2, 5;... 1, 3, 4;... 1, 4, 5;... 2, 3, 6;... 2, 5, 6;... 3, 4, 6;... 4, 5, 6]; [V_out,T_out] = remove_duplicated_vertices(V_in,T_in); assert(isequal(V_check,V_out) && isequal(sortrows(T_check),sortrows(sort(T_out,2))))

2   Pass
V_in = [1, 1, 1;... -1, 1, 1;... -1, -1, 1;... 1, 1, 1;... 1, -1, 1;... 1, 1, -1;... -1, 1, -1;... -1, 1, -1;... -1, -1, -1;... 1, -1, -1]*sqrt(3)/3; T_in = [1, 2, 5;... 1, 2, 6;... 1, 5, 6;... 2, 3, 5;... 2, 3, 7;... 2, 6, 7;... 3, 5, 9;... 3, 8, 9;... 5, 9, 10;... 5, 6, 10;... 6, 8, 10;... 8, 9, 10;... ]; V_check = [1, 1, 1;... -1, 1, 1;... -1, -1, 1;... 1, -1, 1;... 1, 1, -1;... -1, 1, -1;... -1, -1, -1;... 1, -1, -1]*sqrt(3)/3; T_check = [1, 2, 4;... 1, 2, 5;... 1, 4, 5;... 2, 3, 4;... 2, 3, 6;... 2, 5, 6;... 3, 4, 7;... 3, 6, 7;... 4, 7, 8;... 4, 5, 8;... 5, 6, 8;... 6, 7, 8;... ]; [V_out,T_out] = remove_duplicated_vertices(V_in,T_in); assert(isequal(V_check,V_out) && isequal(sortrows(T_check),sortrows(sort(T_out,2))))

Suggested Problems

More from this Author9