Hello Ashish,<br><br>Ya got your problem.<br><br>See you know all tetrahedra at the boundary surfaces. It means u know all the vertex of the tetrahedra ( out of four vertex three r makin boundary faces right ) . <br><br>try this <br>
<br> v0 = face[i].vertex[0];<br> v1 = face[i].vertex[1];<br> v2 = face[i].vertex[2];<br><br> r01 = vertex[v1] - vertex[v0];<br> r12 = vertex[v2] - vertex[v1];<br> <br> face[i].normal = (r01 X r12);<br>
<br> // Check orientation of normal<br> fourth_vertex = face[i].vertex[3]<br> check_normal_orientation = face[i].normal * ( fourth_vertex- vertex[v0]);<br><br> if ( check_normal_orientation > 0.0 )<br>
face[i].normal *= -1.0 ;<br><br>this will resolve your problem for sure.<br><br>regards<br><br>Ashish Garg<br>TIFR-CAM, Bangalore<br><br><div class="gmail_quote">On Thu, May 3, 2012 at 1:22 PM, Mark Starnes <span dir="ltr"><<a href="mailto:mark.starnes@fttech.co.uk" target="_blank">mark.starnes@fttech.co.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Ashish,<br>
<br>
Does it help if you change the sign of every line entry number<br>
in the Plane Surface definition that is a problem?<br>
<br>
Best regards,<br>
<br>
Mark.<br>
<div class="im"><br>
On Thu, May 03, 2012 at 06:23:34AM +0000, Negi, Ashish wrote:<br>
> Hi Ashish,<br>
><br>
><br>
><br>
> Thanks for replying.<br>
><br>
><br>
><br>
> Let me explain my problem again. I have attached 3 pictures below. First, shows<br>
> a Tetrahedral mesh of square duct. So, all surface elements are Triangle.<br>
> Second, shows normal vectors computed using cross product if Triangle vertices<br>
> are saved in clockwise sense (in the picture). Third, shows normal vector<br>
> computed if Triangle vertices are saved in anti-clockwise sense. So, second<br>
> picture gives me outward normal which I need.<br>
><br>
><br>
><br>
> I found that all Triangles do not give me outward normals if I assume clockwise<br>
> sense (in following picture). So, I wanted to know if GMSH has some other way<br>
> to provide me outward normal for each surface Triangle.<br>
><br>
</div>> [cid] [cid]<br>
<div class="im">><br>
><br>
><br>
> Thanks,<br>
><br>
> Ashish<br>
><br>
><br>
><br>
> From: Ashish Garg [mailto:<a href="mailto:ashish.garg.iisc@gmail.com">ashish.garg.iisc@gmail.com</a>]<br>
> Sent: Wednesday, May 02, 2012 1:09 PM<br>
> To: Negi, Ashish<br>
> Cc: <a href="mailto:gmsh@geuz.org">gmsh@geuz.org</a><br>
> Subject: Re: [Gmsh] outward normal of surface triangles<br>
><br>
><br>
><br>
> Hi Ashish<br>
><br>
> give the condition that the cross product should be greater than zero. I guess<br>
> it will resolve the problem.<br>
><br>
> Ashish Garg<br>
><br>
> On Wed, May 2, 2012 at 12:38 PM, Negi, Ashish <<a href="mailto:ashish.negi@honeywell.com">ashish.negi@honeywell.com</a>><br>
> wrote:<br>
><br>
> Hello Everyone,<br>
><br>
><br>
><br>
</div>> I?ve been using GMSH library to open Nastran BDF file and extract mesh data for<br>
<div class="im">> my software. I generally load a mesh consisting of only Tetrahedra. Hence,<br>
> surface of model have only Triangle elements.<br>
><br>
><br>
><br>
> I want to find outward normal at each Triangle. I get coordinates of each<br>
</div>> Triangle and then take cross product to get normal to the element. But, I?m not<br>
<div class="HOEnZb"><div class="h5">> sure if it will always be outward. Can someone suggest a solution to this<br>
> problem?<br>
><br>
><br>
><br>
> Thanks,<br>
><br>
> Ashish<br>
><br>
><br>
><br>
><br>
><br>
><br>
> _______________________________________________<br>
> gmsh mailing list<br>
> <a href="mailto:gmsh@geuz.org">gmsh@geuz.org</a><br>
> <a href="http://www.geuz.org/mailman/listinfo/gmsh" target="_blank">http://www.geuz.org/mailman/listinfo/gmsh</a><br>
><br>
><br>
><br>
<br>
<br>
<br>
<br>
> _______________________________________________<br>
> gmsh mailing list<br>
> <a href="mailto:gmsh@geuz.org">gmsh@geuz.org</a><br>
> <a href="http://www.geuz.org/mailman/listinfo/gmsh" target="_blank">http://www.geuz.org/mailman/listinfo/gmsh</a><br>
<br>
<br>
</div></div><span class="HOEnZb"><font color="#888888">--<br>
Dr. Mark Starnes<br>
Principal Physicist<br>
FT Technologies<br>
Church Lane<br>
Teddington<br>
TW11 8PA<br>
<br>
web: <a href="http://www.fttech.co.uk" target="_blank">www.fttech.co.uk</a><br>
DDI: 0208 614 2730<br>
</font></span></blockquote></div><br>