"Fossies" - the Fresh Open Source Software Archive

Member "PDL-2.080/GENERATED/PDL/Graphics/TriD/Rout.pm" (28 May 2022, 6002 Bytes) of package /linux/misc/PDL-2.080.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "Rout.pm" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 2.079_vs_2.080.

    1 #
    2 # GENERATED WITH PDL::PP! Don't modify!
    3 #
    4 package PDL::Graphics::TriD::Rout;
    5 
    6 our @EXPORT_OK = qw(combcoords repulse attract vrmlcoordsvert contour_segments_internal );
    7 our %EXPORT_TAGS = (Func=>\@EXPORT_OK);
    8 
    9 use PDL::Core;
   10 use PDL::Exporter;
   11 use DynaLoader;
   12 
   13 
   14    
   15    our @ISA = ( 'PDL::Exporter','DynaLoader' );
   16    push @PDL::Core::PP, __PACKAGE__;
   17    bootstrap PDL::Graphics::TriD::Rout ;
   18 
   19 
   20 
   21 
   22 
   23 
   24 #line 4 "rout.pd"
   25 
   26 use strict;
   27 use warnings;
   28 
   29 =head1 NAME
   30 
   31 PDL::Graphics::TriD::Rout - Helper routines for Three-dimensional graphics
   32 
   33 =head1 DESCRIPTION
   34 
   35 This module is for miscellaneous PP-defined utility routines for
   36 the PDL::Graphics::TriD module. Currently, there are
   37 #line 38 "Rout.pm"
   38 
   39 
   40 
   41 
   42 
   43 
   44 =head1 FUNCTIONS
   45 
   46 =cut
   47 
   48 
   49 
   50 
   51 #line 948 "../../../blib/lib/PDL/PP.pm"
   52 
   53 
   54 
   55 =head2 combcoords
   56 
   57 =for sig
   58 
   59   Signature: (x(); y(); z();
   60         float [o]coords(tri=3);)
   61 
   62 =for ref
   63 
   64 Combine three coordinates into a single ndarray.
   65 
   66 Combine x, y and z to a single ndarray the first dimension
   67 of which is 3. This routine does dataflow automatically.
   68 
   69 
   70 =for bad
   71 
   72 combcoords does not process bad values.
   73 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
   74 
   75 
   76 =cut
   77 #line 78 "Rout.pm"
   78 
   79 
   80 
   81 #line 950 "../../../blib/lib/PDL/PP.pm"
   82 
   83 *combcoords = \&PDL::combcoords;
   84 #line 85 "Rout.pm"
   85 
   86 
   87 
   88 #line 948 "../../../blib/lib/PDL/PP.pm"
   89 
   90 
   91 
   92 =head2 repulse
   93 
   94 =for sig
   95 
   96   Signature: (coords(nc,np);
   97          [o]vecs(nc,np);
   98          int [t]links(np);; 
   99         double boxsize;
  100         int dmult;
  101         double a;
  102         double b;
  103         double c;
  104         double d;
  105     )
  106 
  107 
  108 =for ref
  109 
  110 Repulsive potential for molecule-like constructs.
  111 
  112 C<repulse> uses a hash table of cubes to quickly calculate
  113 a repulsive force that vanishes at infinity for many
  114 objects. For use by the module L<PDL::Graphics::TriD::MathGraph>.
  115 For definition of the potential, see the actual function.
  116 
  117 
  118 =for bad
  119 
  120 repulse does not process bad values.
  121 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
  122 
  123 
  124 =cut
  125 #line 126 "Rout.pm"
  126 
  127 
  128 
  129 #line 950 "../../../blib/lib/PDL/PP.pm"
  130 
  131 *repulse = \&PDL::repulse;
  132 #line 133 "Rout.pm"
  133 
  134 
  135 
  136 #line 948 "../../../blib/lib/PDL/PP.pm"
  137 
  138 
  139 
  140 =head2 attract
  141 
  142 =for sig
  143 
  144   Signature: (coords(nc,np);
  145         int from(nl);
  146         int to(nl);
  147         strength(nl);
  148         [o]vecs(nc,np);; 
  149         double m;
  150         double ms;
  151     )
  152 
  153 
  154 =for ref
  155 
  156 Attractive potential for molecule-like constructs.
  157 
  158 C<attract> is used to calculate
  159 an attractive force for many
  160 objects, of which some attract each other (in a way
  161 like molecular bonds).
  162 For use by the module L<PDL::Graphics::TriD::MathGraph>.
  163 For definition of the potential, see the actual function.
  164 
  165 
  166 =for bad
  167 
  168 attract does not process bad values.
  169 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
  170 
  171 
  172 =cut
  173 #line 174 "Rout.pm"
  174 
  175 
  176 
  177 #line 950 "../../../blib/lib/PDL/PP.pm"
  178 
  179 *attract = \&PDL::attract;
  180 #line 181 "Rout.pm"
  181 
  182 
  183 
  184 #line 948 "../../../blib/lib/PDL/PP.pm"
  185 
  186 
  187 
  188 =head2 vrmlcoordsvert
  189 
  190 =for sig
  191 
  192   Signature: (vertices(n=3); char* space; PerlIO *fp)
  193 
  194 
  195 =for ref
  196 
  197 info not available
  198 
  199 
  200 =for bad
  201 
  202 vrmlcoordsvert does not process bad values.
  203 It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.
  204 
  205 
  206 =cut
  207 #line 208 "Rout.pm"
  208 
  209 
  210 
  211 #line 950 "../../../blib/lib/PDL/PP.pm"
  212 
  213 *vrmlcoordsvert = \&PDL::vrmlcoordsvert;
  214 #line 215 "Rout.pm"
  215 
  216 
  217 
  218 #line 214 "rout.pd"
  219 
  220 
  221 =head2 contour_segments
  222 
  223 =for ref
  224 
  225 This is the interface for the pp routine contour_segments_internal
  226 - it takes 3 ndarrays as input
  227 
  228 C<$c> is a contour value (or a list of contour values)
  229 
  230 C<$data> is an [m,n] array of values at each point
  231 
  232 C<$points> is a list of [3,m,n] points, it should be a grid
  233 monotonically increasing with m and n.  
  234 
  235 contour_segments returns a reference to a Perl array of 
  236 line segments associated with each value of C<$c>.  It does not (yet) handle
  237 missing data values. 
  238 
  239 =over 4
  240 
  241 =item Algorithm
  242 
  243 The data array represents samples of some field observed on the surface described 
  244 by points.  For each contour value we look for intersections on the line segments
  245 joining points of the data.  When an intersection is found we look to the adjoining 
  246 line segments for the other end(s) of the line segment(s).  So suppose we find an
  247 intersection on an x-segment.  We first look down to the left y-segment, then to the
  248 right y-segment and finally across to the next x-segment.  Once we find one in a 
  249 box (two on a point) we can quit because there can only be one.  After we are done
  250 with a given x-segment, we look to the leftover possibilities for the adjoining y-segment.
  251 Thus the contours are built as a collection of line segments rather than a set of closed
  252 polygons.          
  253 
  254 =back
  255 
  256 =cut
  257 
  258 sub PDL::Graphics::TriD::Contours::contour_segments {
  259     my($this,$c,$data,$points) = @_;
  260 # pre compute space for output of pp routine
  261   my $segdim = ($data->getdim(0)-1)*($data->getdim(1)-1)*4;
  262   my $segs = zeroes(3,$segdim,$c->nelem);
  263   my $cnt = zeroes($c->nelem);
  264   contour_segments_internal($c,$data,$points,$segs,$cnt);
  265   $this->{Points} = pdl->null;
  266   my $pcnt=0;
  267   my $ncnt;
  268   for(my $i=0; $i<$c->nelem; $i++){
  269        $ncnt = $cnt->slice("($i)");
  270       next if($ncnt==-1);
  271         $pcnt = $pcnt+$ncnt;
  272         $this->{ContourSegCnt}[$i] =  $pcnt;
  273         $pcnt=$pcnt+1;    
  274         $this->{Points} = $this->{Points}->append($segs->slice(":,0:$ncnt,($i)")->transpose);
  275     }
  276     $this->{Points} = $this->{Points}->transpose;
  277     
  278 }
  279 #line 280 "Rout.pm"
  280 
  281 
  282 
  283 #line 950 "../../../blib/lib/PDL/PP.pm"
  284 
  285 *contour_segments_internal = \&PDL::contour_segments_internal;
  286 #line 287 "Rout.pm"
  287 
  288 
  289 
  290 
  291 
  292 #line 436 "rout.pd"
  293 
  294 
  295 =head1 AUTHOR
  296 
  297 Copyright (C) 2000 James P. Edwards
  298 Copyright (C) 1997 Tuomas J. Lukka.
  299 All rights reserved. There is no warranty. You are allowed
  300 to redistribute this software / documentation under certain
  301 conditions. For details, see the file COPYING in the PDL
  302 distribution. If this file is separated from the PDL distribution,
  303 the copyright notice should be included in the file.
  304 
  305 =cut
  306 #line 307 "Rout.pm"
  307 
  308 
  309 
  310 
  311 # Exit with OK status
  312 
  313 1;