@@ -124,21 +124,27 @@ use base qw/PDL::Graphics::TriD::GObject/;
124124use fields qw/ Faceidx FaceNormals VertexNormals/ ;
125125sub new {
126126 my $options = ref ($_ [-1]) eq ' HASH' ? pop : {};
127- my ($type ,$points ,$faceidx ,$colors ) = @_ ;
127+ my ($type ,$points ,$faceidx ,$colors ) = @_ ;
128128 my $this = $type -> SUPER::new($points ,$colors ,$options );
129129 # faceidx is 2D pdl of indices into points for each face
130- $this -> {Faceidx } = $faceidx -> ulong;
130+ $faceidx = $ this-> {Faceidx } = $faceidx -> ulong;
131131 $options = $this -> {Options };
132- if ($options -> {Shading } or $options -> { ShowNormals }) {
132+ if ($options -> {ShowNormals }) {
133133 my ($fn , $vn ) = triangle_normals($this -> {Points }, $faceidx );
134134 $this -> {VertexNormals } = $vn if $options -> {Smooth } or $options -> {ShowNormals };
135135 $this -> {FaceNormals } = $fn if !$options -> {Smooth } or $options -> {ShowNormals };
136136 }
137137 my %less = %$options ; delete @less {qw( ShowNormals Lines) };
138138 $less {Shading } = 3 if $options -> {Shading };
139139 $this -> add_object(PDL::Graphics::TriD::Triangles-> new($points , $faceidx -> clump(1..$faceidx -> ndims-1), $colors , \%less ));
140+ if ($options -> {Lines }) {
141+ $points = PDL::Graphics::TriD::realcoords($type -> r_type,$points );
142+ my $faces = $points -> dice_axis(1,$this -> {Faceidx }-> flat)-> splitdim(1,3);
143+ $this -> add_object(PDL::Graphics::TriD::Lines-> new($faces -> dice_axis(1,[0,1,2,0]), PDL::float(0,0,0)));
144+ }
140145 $this ;
141146}
147+ sub r_type { return " " ;}
142148sub get_valid_options { +{
143149 UseDefcols => 0,
144150 Lines => 0,
0 commit comments