@@ -137,19 +137,13 @@ sub get_valid_options { +{
137137
138138package PDL::Graphics::TriD::Trigrid ;
139139use base qw/ PDL::Graphics::TriD::GObject/ ;
140+ use fields qw/ Faceidx FaceNormals Normals/ ;
140141sub new {
141142 my $options = ref ($_ [-1]) eq ' HASH' ? pop : {};
142143 my ($type ,$points ,$faceidx ,$colors ) = @_ ;
144+ my $this = $type -> SUPER::new($points ,$colors ,$options );
143145 # faceidx is 2D pdl of indices into points for each face
144- $faceidx = $faceidx -> ulong;
145- $points = PDL::Graphics::TriD::realcoords($type -> r_type,$points );
146- if (!defined $colors ) { $colors = PDL-> pdl(PDL::float(),0.8,0.8,0.8);
147- $colors = $type -> cdummies($colors ,$points );
148- $options -> { UseDefcols } = 1; } # for VRML efficiency
149- else { $colors = PDL::Graphics::TriD::realcoords(" COLOR" ,$colors ); }
150- my $this = bless { Points => $points , Faceidx => $faceidx ,
151- Colors => $colors , Options => $options },$type ;
152- $this -> check_options;
146+ $this -> {Faceidx } = $faceidx -> ulong;
153147 $this -> {Normals } = $this -> smoothn($points -> dice_axis(1,$faceidx -> flat)-> splitdim(1,3)) if $this -> {Options }{Smooth };
154148 $this ;
155149}
0 commit comments