1 /*=========================================================================
3 Program: Visualization Toolkit
4 Module: $RCSfile: vtkLinearExtrusionFilter.h,v $
6 Date: $Date: 2002/02/01 06:33:18 $
7 Version: $Revision: 1.1.1.1 $
10 Copyright (c) 1993-1998 Ken Martin, Will Schroeder, Bill Lorensen.
12 This software is copyrighted by Ken Martin, Will Schroeder and Bill Lorensen.
13 The following terms apply to all files associated with the software unless
14 explicitly disclaimed in individual files. This copyright specifically does
15 not apply to the related textbook "The Visualization Toolkit" ISBN
16 013199837-4 published by Prentice Hall which is covered by its own copyright.
18 The authors hereby grant permission to use, copy, and distribute this
19 software and its documentation for any purpose, provided that existing
20 copyright notices are retained in all copies and that this notice is included
21 verbatim in any distributions. Additionally, the authors grant permission to
22 modify this software and its documentation for any purpose, provided that
23 such modifications are not distributed without the explicit consent of the
24 authors and that existing copyright notices are retained in all copies. Some
25 of the algorithms implemented by this software are patented, observe all
26 applicable patent law.
28 IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR
29 DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
30 OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF,
31 EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
34 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
35 PARTICULAR PURPOSE, AND NON-INFRINGEMENT. THIS SOFTWARE IS PROVIDED ON AN
36 "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
37 MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
40 =========================================================================*/
41 // .NAME vtkLinearExtrusionFilter - sweep polygonal data creating a "skirt" from free edges and lines, and lines from vertices
42 // .SECTION Description
43 // vtkLinearExtrusionFilter is a modelling filter. It takes polygonal data as
44 // input and generates polygonal data on output. The input dataset is swept
45 // according to some extrusion function and creates new polygonal primitives.
46 // These primitives form a "skirt" or swept surface. For example, sweeping a
47 // line results in a quadrilateral, and sweeping a triangle creates a "wedge".
49 // There are a number of control parameters for this filter. You can
50 // control whether the sweep of a 2D object (i.e., polygon or triangle strip)
51 // is capped with the generating geometry via the "Capping" ivar. Also, you
52 // can extrude in the direction of a user specified vector, towards a point,
53 // or in the direction of vertex normals (normals must be provided - use
54 // vtkPolyDataNormals if necessary). The amount of extrusion is controlled by
55 // the "ScaleFactor" instance variable.
57 // The skirt is generated by locating certain topological features. Free
58 // edges (edges of polygons or triangle strips only used by one polygon or
59 // triangle strips) generate surfaces. This is true also of lines or
60 // polylines. Vertices generate lines.
62 // This filter can be used to create 3D fonts, 3D irregular bar charts,
63 // or to model 2 1/2D objects like punched plates. It also can be used to
64 // create solid objects from 2D polygonal meshes.
66 // Some polygonal objects have no free edges (e.g., sphere). When swept,
67 // this will result in two separate surfaces if capping is on, or no surface
70 // vtkRotationalExtrusionFilter
72 #ifndef __vtkLinearExtrusionFilter_h
73 #define __vtkLinearExtrusionFilter_h
75 #include "vtkPolyDataToPolyDataFilter.h"
77 #define VTK_VECTOR_EXTRUSION 1
78 #define VTK_NORMAL_EXTRUSION 2
79 #define VTK_POINT_EXTRUSION 3
81 class VTK_EXPORT vtkLinearExtrusionFilter : public vtkPolyDataToPolyDataFilter
84 vtkLinearExtrusionFilter();
85 static vtkLinearExtrusionFilter *New() {return new vtkLinearExtrusionFilter;};
86 const char *GetClassName() {return "vtkLinearExtrusionFilter";};
87 void PrintSelf(ostream& os, vtkIndent indent);
90 // Set/Get the type of extrusion.
91 vtkSetClampMacro(ExtrusionType,int,VTK_VECTOR_EXTRUSION,VTK_POINT_EXTRUSION);
92 vtkGetMacro(ExtrusionType,int);
95 // Turn on/off the capping of the skirt.
96 vtkSetMacro(Capping,int);
97 vtkGetMacro(Capping,int);
98 vtkBooleanMacro(Capping,int);
101 // Set/Get extrusion scale factor,
102 vtkSetMacro(ScaleFactor,float);
103 vtkGetMacro(ScaleFactor,float);
106 // Set/Get extrusion vector. Only needs to be set if VectorExtrusion is
108 vtkSetVector3Macro(Vector,float);
109 vtkGetVectorMacro(Vector,float,3);
112 // Set/Get extrusion point. Only needs to be set if PointExtrusion is
113 // turned on. This is the point towards which extrusion occurs.
114 vtkSetVector3Macro(ExtrusionPoint,float);
115 vtkGetVectorMacro(ExtrusionPoint,float,3);
123 float ExtrusionPoint[3];
126 float *(vtkLinearExtrusionFilter::*ExtrudePoint)(float x[3], int id, vtkNormals *normals);
127 float *ViaNormal(float x[3], int id, vtkNormals *normals=NULL);
128 float *ViaVector(float x[3], int id, vtkNormals *normals=NULL);
129 float *ViaPoint(float x[3], int id, vtkNormals *normals=NULL);