File tree Expand file tree Collapse file tree
Sources/Filters/Sources/CylinderSource Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -65,6 +65,8 @@ function vtkCylinderSource(publicAPI, model) {
6565 // y coordinate
6666 xbot [ 1 ] = 0.5 * model . height + model . center [ 1 ] ;
6767 xtop [ 1 ] = - 0.5 * model . height + model . center [ 1 ] ;
68+ nbot [ 1 ] = 0.0 ;
69+ ntop [ 1 ] = 0.0 ;
6870 tcbot [ 1 ] = 0.0 ;
6971 tctop [ 1 ] = 1.0 ;
7072
@@ -100,6 +102,13 @@ function vtkCylinderSource(publicAPI, model) {
100102 if ( model . capping ) {
101103 // Generate points for top/bottom polygons
102104 for ( let i = 0 ; i < model . resolution ; i ++ ) {
105+ nbot [ 0 ] = 0.0 ;
106+ nbot [ 1 ] = 1.0 ;
107+ nbot [ 2 ] = 0.0 ;
108+ ntop [ 0 ] = 0.0 ;
109+ ntop [ 1 ] = - 1.0 ;
110+ ntop [ 2 ] = 0.0 ;
111+
103112 // x coordinate
104113 xbot [ 0 ] = model . radius * Math . cos ( i * angle + model . initAngle ) ;
105114 xtop [ 0 ] = xbot [ 0 ] ;
@@ -109,8 +118,6 @@ function vtkCylinderSource(publicAPI, model) {
109118 xtop [ 0 ] += model . center [ 0 ] ;
110119
111120 // y coordinate
112- nbot [ 1 ] = 1.0 ;
113- ntop [ 1 ] = - 1.0 ;
114121 xbot [ 1 ] = 0.5 * model . height + model . center [ 1 ] ;
115122 xtop [ 1 ] = - 0.5 * model . height + model . center [ 1 ] ;
116123
@@ -154,6 +161,11 @@ function vtkCylinderSource(publicAPI, model) {
154161 . translate ( ...model . center . map ( ( c ) => c * - 1 ) )
155162 . apply ( points ) ;
156163
164+ vtkMatrixBuilder
165+ . buildFromRadian ( )
166+ . rotateFromDirections ( [ 0 , 1 , 0 ] , model . direction )
167+ . apply ( normalsData ) ;
168+
157169 const dataset = outData [ 0 ] ?. initialize ( ) || vtkPolyData . newInstance ( ) ;
158170 dataset . getPoints ( ) . setData ( points , 3 ) ;
159171 dataset . getPolys ( ) . setData ( polys , 1 ) ;
You can’t perform that action at this time.
0 commit comments