Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Built-in function to delete all tetrahedrons that do not contain a particular face

Subject: Built-in function to delete all tetrahedrons that do not contain a particular face

From: Liana

Date: 17 Apr, 2011 01:39:04

Message: 1 of 5

Hello,

vertices = rand(100,3);
tess = delaunayn(vertices);
tess = sort(tess,2);
faces = [tess(:,[1 2 3]); tess(:,[2 3 4]); ...
                 tess(:,[1 3 4]); tess(:,[1 2 4])];

Is there any built-in function to delete all tetrahedrons that do not contain a particular face, e.g. newFace = [1 15 4], where 1, 15 and 4 are indices of vertices? I don't want to use FOR...END statement.

Thanks.

Subject: Built-in function to delete all tetrahedrons that do not contain a particular face

From: Liana

Date: 17 Apr, 2011 01:54:04

Message: 2 of 5

My idea is the following.
k = find(all(all(isnan(setdiff(tess(:),newFace(:))))))
tess([k,k+1],:)=[];
Are there other approaches?

"Liana" wrote in message <iodgbo$p69$1@fred.mathworks.com>...
> Hello,
>
> vertices = rand(100,3);
> tess = delaunayn(vertices);
> tess = sort(tess,2);
> faces = [tess(:,[1 2 3]); tess(:,[2 3 4]); ...
> tess(:,[1 3 4]); tess(:,[1 2 4])];
>
> Is there any built-in function to delete all tetrahedrons that do not contain a particular face, e.g. newFace = [1 15 4], where 1, 15 and 4 are indices of vertices? I don't want to use FOR...END statement.
>
> Thanks.

Subject: Built-in function to delete all tetrahedrons that do not contain a particular face

From: Matt J

Date: 17 Apr, 2011 13:09:05

Message: 3 of 5

"Liana" wrote in message <iodgbo$p69$1@fred.mathworks.com>...
> Hello,
>
> vertices = rand(100,3);
> tess = delaunayn(vertices);
> tess = sort(tess,2);
> faces = [tess(:,[1 2 3]); tess(:,[2 3 4]); ...
> tess(:,[1 3 4]); tess(:,[1 2 4])];
>

Perhaps as follows:

tess( sum(any(bsxfun(@equal,tess, reshape(newFace,1,1,3)), 3),2)>=3 )=[];

Subject: Built-in function to delete all tetrahedrons that do not contain a particular face

From: Matt J

Date: 17 Apr, 2011 13:22:05

Message: 4 of 5

"Matt J" wrote in message <ioeoph$hm7$1@fred.mathworks.com>...
>
>
> Perhaps as follows:
>
> tess( sum(any(bsxfun(@equal,tess, reshape(newFace,1,1,3)), 3),2)>=3 )=[];

or rather


tess( sum(any(bsxfun(@eq,tess, reshape(newFace,1,1,3)), 3),2)<3 )=[];
 

Subject: Built-in function to delete all tetrahedrons that do not contain a particular face

From: Liana

Date: 19 Apr, 2011 05:19:05

Message: 5 of 5

Thanks, Matt!

"Matt J" wrote in message <ioepht$6f7$1@fred.mathworks.com>...
> "Matt J" wrote in message <ioeoph$hm7$1@fred.mathworks.com>...
> >
> >
> > Perhaps as follows:
> >
> > tess( sum(any(bsxfun(@equal,tess, reshape(newFace,1,1,3)), 3),2)>=3 )=[];
>
> or rather
>
>
> tess( sum(any(bsxfun(@eq,tess, reshape(newFace,1,1,3)), 3),2)<3 )=[];
>

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us