VTK/Examples/CSharp/PolyData/ClosedSurface

From KitwarePublic
< VTK‎ | Examples‎ | CSharp
Revision as of 02:48, 21 June 2012 by Jochen (talk | contribs) (initial creation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

A tutorial on how to setup a Windows Forms Application utilizing ActiViz.NET can be found here: Setup a Windows Forms Application to use ActiViz.NET

ClosedSurface.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using System.Diagnostics;

using Kitware.VTK;

namespace ActiViz.Examples {
   public partial class Form1 : Form {
      public Form1() {
         InitializeComponent();
      }


      private void renderWindowControl1_Load(object sender, EventArgs e) {
         try {
            ClosedSurface();
         }
         catch(Exception ex) {
            MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK);
         }
      }


      private void ClosedSurface() {
         // Create a sphere
         vtkSphereSource sphereSource = vtkSphereSource.New();
         sphereSource.Update();

         vtkFeatureEdges featureEdges = vtkFeatureEdges.New();
         featureEdges.FeatureEdgesOff();
         featureEdges.BoundaryEdgesOn();
         featureEdges.NonManifoldEdgesOn();
         featureEdges.SetInputConnection(sphereSource.GetOutputPort());
         featureEdges.Update();

         int numberOfOpenEdges = featureEdges.GetOutput().GetNumberOfCells();

         if(numberOfOpenEdges > 0) {
            Debug.WriteLine("Surface is not closed");
         }
         else {
            Debug.WriteLine("Surface is closed");
         }
         // nothing to show graphically
      }
   }
}