Personal tools
You are here: Home Forum Use mesh normals

mesh normals

Up to Use
  • mesh normals

    Posted by walter steffe at July 27. 2006

    Hi,

    In my application I need to generate a file which describes a surface mesh and, for each triangle, provides the following data:

    - The coordinates and the normal vectors associated with the following 7 Points:

       the triangle vertices + the centers of the triangle sides + the center of the triangle

    I need the exact normals related to the underlying surface (and not an approximation which is derived from the triangulated surface)

    I would like to know if it is possible to generate this data using the Salome Platform

    or if there is any plan to include this capability in a future release.

     

    Many thanks for your kindly attention

    Walter Steffè

     

    • Re: mesh normals

      Posted by Igor Nazarov at August 10. 2006
      Hi,

      Please consider recomendations below :

      1. For the mesh you can create group of faces on geometry corresponding to face under consideration (the shape has to be exploded into faces previously)
      2. Vertices of each triangle can be obtained with GetElemNode() python command
      3  Coordinates of vertices are obtained with GetNodeXYZ  python command
      4  the centers of the triangle sides + the center of the triangle are obtained with simple equations from analytical geometry
      5. All data are written into file in desirable format

      Igor
      • Re: mesh normals

        Posted by walter steffe at August 21. 2006

        Hi igor,

        Thanks for your replay. I am here back from a two weeks holiday anf I have read it just today.

        Your informatoin on the two commands "GetElemNode" and "GetNodeXYZ" is very usefull but it dees'nt solve completely my problem. This is because I need to have the Points placed on the curved surface and therefore I can not use the simple equation related to the flat triangle.

        Actually I think that the side centers (placed on the curved surface) can extracted by means of the two commands after having created a second order mesh (which provides exactly these data) but this approach does'nt work for the triangle center. In principle this last point could be computed as the intersection of the triangle normal (going trough the triangle center) and the curved surface.

        After having obtained the 7 points I still need to compute the surface normals and please note that I need the normals associated with the curved surface and not with the flat triangle. May be there is a command to extract the uv coordinates ov the curved surface and an other command to differentiate the surface with respect to u and v. This capability is common to many geometrical kernels and should be present also in OC but I do not know if it is implemented in the phython interface. Anyway, if these oprations are possible, than the surface normal can easely be computed as the vector product of the tangent vectors directed as u and v.

        I would be happy if somebody has already found a practical (and possibly fast) way to compute these data and can provide some informations on it.

        Walter

        • Re: mesh normals

          Posted by Sergey Mozokhin at September 06. 2006
          walter steffe wrote:

          Hi igor,

          Thanks for your replay. I am here back from a two weeks holiday anf I have read it just today.

          Your informatoin on the two commands "GetElemNode" and "GetNodeXYZ" is very usefull but it dees'nt solve completely my problem. This is because I need to have the Points placed on the curved surface and therefore I can not use the simple equation related to the flat triangle.

          Actually I think that the side centers (placed on the curved surface) can extracted by means of the two commands after having created a second order mesh (which provides exactly these data) but this approach does'nt work for the triangle center. In principle this last point could be computed as the intersection of the triangle normal (going trough the triangle center) and the curved surface.

          After having obtained the 7 points I still need to compute the surface normals and please note that I need the normals associated with the curved surface and not with the flat triangle. May be there is a command to extract the uv coordinates ov the curved surface and an other command to differentiate the surface with respect to u and v. This capability is common to many geometrical kernels and should be present also in OC but I do not know if it is implemented in the phython interface. Anyway, if these oprations are possible, than the surface normal can easely be computed as the vector product of the tangent vectors directed as u and v.

          I would be happy if somebody has already found a practical (and possibly fast) way to compute these data and can provide some informations on it.

          Walter


          Hello Walter.

          Unfortunatelly there is no ready solution for your request. I mean python funciton to obtain points from surface corresponded to center of triangles. However it can be written, and it's not very complex. There is funcitonality in OpenCASCADE Technology for normal projectting point into surface. So, it's not complex task to write piece of code which wil take coordinates of nodes and project on surfaces. I think similar code presents in the computation of second order traingle mesh in SMESH module. It's necessary to do it like there and then make python API for call of this funcitonality.

          Regards,

          Sergey.

          • Re: mesh normals

            Posted by walter steffe at September 06. 2006

            Thanks Sergey.

            All is clear. In the past I have done what you are suggesting (hacking a little bit the second order mesher to generate the missing points and related normals) with gmsh. In fact at the moment I am using this code to create the meshed geometries and I am very busy with the development of the electromagnetic code. When this job will be finished I will try to recreate the same data structure with Salome (which is much more user friendly than gmsh).

            Walter

Powered by Ploneboard
Document Actions