[vtkusers] surface normal and curvatures calculation

Andrew Maclean andrew.amaclean at gmail.com
Sun Nov 26 17:50:58 EST 2006


You are going to have to generate a surface first. Normals and curvatures
are meaningless for points.

Andrew


On 11/27/06, Ismail Elkhrachy <I.Elkhrachy at tu-bs.de> wrote:
>
> dear All,
> I have point cloud xyz coordinates of surface i want to claculate
> surface normal and curvatures (Min and Max).
> I use visual c++6 with vtk 5.0. I am beginner with c++ op.  I used the
> following code,  i have got a stack!!
>
> Theres is any one help thanks in advanced
>
> ismail
>
> #include "vtkPolyDataNormals.h"
> #include "vtkCurvatures.h"
> #include "vtkPointData.h"
> #include "vtkPoints.h"
> #include "vtkPolyData.h"
> #include "vtkPolyDataMapper.h"
> #include "vtkRenderWindow.h"
> int main()
> {
>    FILE *fp;
>      vtkPoints* cloud1      = vtkPoints::New();
>        static float mypoint_1[3];
>    fp=fopen("data\\scan4.nor","rb"); // cloud points X Y Z coordinates
>    if(fp==NULL)
>    {
>        puts("Cannot open file");
>        exit(0);
>    }
>    while(fscanf (fp,"%f %f
> %f\n",&mypoint_1[0],&mypoint_1[1],&mypoint_1[2]) != EOF)
>    {
>        cloud1->InsertNextPoint(mypoint_1);
>    }
>    fclose(fp);
>     vtkPolyData* polyData1 = vtkPolyData::New();
>    polyData1->SetPoints(cloud1);
>    polyData1->GetPolys();
>        //Surface Normals calculation for polyData1
>        vtkPolyDataNormals *Normals1 = vtkPolyDataNormals::New();
>    Normals1->SetInput(polyData1);
>    Normals1->SetFeatureAngle(45);
>    Normals1->FlipNormalsOff();
>    Normals1->Update();
>        //I need to calculate Mean and Gauss curvatures But I am not
> sure with the following code or not
>    vtkCurvatures *curvater = vtkCurvatures::New();
>    curvater->SetInput(polyData1);
>        // How to print the normal values and the curvature (Min and
> Max) foe each vertix
>        for ( int pointID=0; pointID < polyData1->GetNumberOfPoints();
> pointID++)
>    {
>     float *point =
> (float*)polyData1->GetPointData()->GetNormals()->GetTuple(pointID);
>        printf("x-> %f",(*point+0) );
>        printf("y-> %f",(*point+1) );
>        printf("z-> %f",(*point+2) );
>    }
>        return 0;
> }
>
> --
> M.Sc. Ismail Elkhrachy
> PhD student
>
> Institut für Geodäsie und Photogrammetrie
> Technische Universität Braunschweig
> Gaußstr. 22
> 38106 Braunschweig
> Germany
>
> Mob.           : 0049 0163 3623486
> Tel.           : 0049 0531 3917497
> Fax            : 0049 0531 3917499
> E-mail         : I.Elkhrachy at tu-bs.de, I.Elkhrachy at yahoo.com
>
>
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>



-- 

___________________________________________
Andrew J. P. Maclean
Centre for Autonomous Systems
The Rose Street Building J04
The University of Sydney  2006  NSW
AUSTRALIA
Ph: +61 2 9351 3283
Fax: +61 2 9351 7474
URL: http://www.cas.edu.au/
___________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20061127/7495114c/attachment.htm>


More information about the vtkusers mailing list