"Fossies" - the Fresh Open Source Software Archive

Member "asymptote-2.61/runpath3d.cc" (18 Nov 2019, 25218 Bytes) of package /linux/misc/asymptote-2.61.src.tgz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ 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 "runpath3d.cc" see the Fossies "Dox" file reference documentation.

    1 /***** Autogenerated from runpath3d.in; changes will be overwritten *****/
    2 
    3 #line 1 "runtimebase.in"
    4 /*****
    5  * runtimebase.in
    6  * Andy Hammerlindl  2009/07/28
    7  *
    8  * Common declarations needed for all code-generating .in files.
    9  *
   10  *****/
   11 
   12 
   13 #line 1 "runpath3d.in"
   14 /*****
   15  * runpath3.in
   16  *
   17  * Runtime functions for path3 operations.
   18  *
   19  *****/
   20 
   21 #line 1 "runtimebase.in"
   22 #include "stack.h"
   23 #include "types.h"
   24 #include "builtin.h"
   25 #include "entry.h"
   26 #include "errormsg.h"
   27 #include "array.h"
   28 #include "triple.h"
   29 #include "callable.h"
   30 #include "opsymbols.h"
   31 
   32 using vm::stack;
   33 using vm::error;
   34 using vm::array;
   35 using vm::read;
   36 using vm::callable;
   37 using types::formal;
   38 using types::function;
   39 using camp::triple;
   40 
   41 #define PRIMITIVE(name,Name,asyName) using types::prim##Name;
   42 #include <primitives.h>
   43 #undef PRIMITIVE
   44 
   45 typedef double real;
   46 
   47 void unused(void *);
   48 
   49 namespace run {
   50 array *copyArray(array *a);
   51 array *copyArray2(array *a);
   52 array *copyArray3(array *a);
   53 
   54 double *copyTripleArray2Components(array *a, size_t &N,
   55                                    GCPlacement placement=NoGC);
   56 triple *copyTripleArray2C(array *a, size_t &N,
   57                           GCPlacement placement=NoGC);
   58 }
   59 
   60 function *realRealFunction();
   61 
   62 #define CURRENTPEN processData().currentpen
   63 
   64 #line 17 "runpath3d.in"
   65 #include "path3.h"
   66 #include "array.h"
   67 #include "drawsurface.h"
   68 #include "predicates.h"
   69 
   70 using namespace camp;
   71 using namespace vm;
   72 
   73 typedef array boolarray;
   74 typedef array realarray;
   75 typedef array realarray2;
   76 typedef array triplearray;
   77 typedef array triplearray2;
   78 
   79 using types::booleanArray;
   80 using types::realArray;
   81 using types::realArray2;
   82 using types::tripleArray;
   83 using types::tripleArray2;
   84 
   85 // Autogenerated routines:
   86 
   87 
   88 
   89 #ifndef NOSYM
   90 #include "runpath3d.symbols.h"
   91 
   92 #endif
   93 namespace run {
   94 #line 40 "runpath3d.in"
   95 // path3 path3(triplearray *pre, triplearray *point, triplearray *post,            boolarray *straight, bool cyclic);
   96 void gen_runpath3d0(stack *Stack)
   97 {
   98   bool cyclic=vm::pop<bool>(Stack);
   99   boolarray * straight=vm::pop<boolarray *>(Stack);
  100   triplearray * post=vm::pop<triplearray *>(Stack);
  101   triplearray * point=vm::pop<triplearray *>(Stack);
  102   triplearray * pre=vm::pop<triplearray *>(Stack);
  103 #line 42 "runpath3d.in"
  104   size_t n=checkArrays(pre,point);
  105   checkEqual(n,checkArray(post));
  106   checkEqual(n,checkArray(straight));
  107   mem::vector<solvedKnot3> nodes(n);
  108   for(size_t i=0; i < n; ++i) {
  109     nodes[i].pre=read<triple>(pre,i);
  110     nodes[i].point=read<triple>(point,i);
  111     nodes[i].post=read<triple>(post,i);
  112     nodes[i].straight=read<bool>(straight,i);
  113   }
  114 
  115   {Stack->push<path3>(path3(nodes,(Int) n,cyclic)); return;}
  116 }
  117 
  118 #line 57 "runpath3d.in"
  119 void nullPath3(stack *Stack)
  120 {
  121 #line 58 "runpath3d.in"
  122   {Stack->push<path3>(nullpath3); return;}
  123 }
  124 
  125 #line 62 "runpath3d.in"
  126 // bool ==(path3 a, path3 b);
  127 void gen_runpath3d2(stack *Stack)
  128 {
  129   path3 b=vm::pop<path3>(Stack);
  130   path3 a=vm::pop<path3>(Stack);
  131 #line 63 "runpath3d.in"
  132   {Stack->push<bool>(a == b); return;}
  133 }
  134 
  135 #line 67 "runpath3d.in"
  136 // bool !=(path3 a, path3 b);
  137 void gen_runpath3d3(stack *Stack)
  138 {
  139   path3 b=vm::pop<path3>(Stack);
  140   path3 a=vm::pop<path3>(Stack);
  141 #line 68 "runpath3d.in"
  142   {Stack->push<bool>(!(a == b)); return;}
  143 }
  144 
  145 #line 72 "runpath3d.in"
  146 // triple point(path3 p, Int t);
  147 void gen_runpath3d4(stack *Stack)
  148 {
  149   Int t=vm::pop<Int>(Stack);
  150   path3 p=vm::pop<path3>(Stack);
  151 #line 73 "runpath3d.in"
  152   {Stack->push<triple>(p.point((Int) t)); return;}
  153 }
  154 
  155 #line 77 "runpath3d.in"
  156 // triple point(path3 p, real t);
  157 void gen_runpath3d5(stack *Stack)
  158 {
  159   real t=vm::pop<real>(Stack);
  160   path3 p=vm::pop<path3>(Stack);
  161 #line 78 "runpath3d.in"
  162   {Stack->push<triple>(p.point(t)); return;}
  163 }
  164 
  165 #line 82 "runpath3d.in"
  166 // triple precontrol(path3 p, Int t);
  167 void gen_runpath3d6(stack *Stack)
  168 {
  169   Int t=vm::pop<Int>(Stack);
  170   path3 p=vm::pop<path3>(Stack);
  171 #line 83 "runpath3d.in"
  172   {Stack->push<triple>(p.precontrol((Int) t)); return;}
  173 }
  174 
  175 #line 87 "runpath3d.in"
  176 // triple precontrol(path3 p, real t);
  177 void gen_runpath3d7(stack *Stack)
  178 {
  179   real t=vm::pop<real>(Stack);
  180   path3 p=vm::pop<path3>(Stack);
  181 #line 88 "runpath3d.in"
  182   {Stack->push<triple>(p.precontrol(t)); return;}
  183 }
  184 
  185 #line 92 "runpath3d.in"
  186 // triple postcontrol(path3 p, Int t);
  187 void gen_runpath3d8(stack *Stack)
  188 {
  189   Int t=vm::pop<Int>(Stack);
  190   path3 p=vm::pop<path3>(Stack);
  191 #line 93 "runpath3d.in"
  192   {Stack->push<triple>(p.postcontrol((Int) t)); return;}
  193 }
  194 
  195 #line 97 "runpath3d.in"
  196 // triple postcontrol(path3 p, real t);
  197 void gen_runpath3d9(stack *Stack)
  198 {
  199   real t=vm::pop<real>(Stack);
  200   path3 p=vm::pop<path3>(Stack);
  201 #line 98 "runpath3d.in"
  202   {Stack->push<triple>(p.postcontrol(t)); return;}
  203 }
  204 
  205 #line 102 "runpath3d.in"
  206 // triple dir(path3 p, Int t, Int sign=0, bool normalize=true);
  207 void gen_runpath3d10(stack *Stack)
  208 {
  209   bool normalize=vm::pop<bool>(Stack,true);
  210   Int sign=vm::pop<Int>(Stack,0);
  211   Int t=vm::pop<Int>(Stack);
  212   path3 p=vm::pop<path3>(Stack);
  213 #line 103 "runpath3d.in"
  214   {Stack->push<triple>(p.dir(t,sign,normalize)); return;}
  215 }
  216 
  217 #line 107 "runpath3d.in"
  218 // triple dir(path3 p, real t, bool normalize=true);
  219 void gen_runpath3d11(stack *Stack)
  220 {
  221   bool normalize=vm::pop<bool>(Stack,true);
  222   real t=vm::pop<real>(Stack);
  223   path3 p=vm::pop<path3>(Stack);
  224 #line 108 "runpath3d.in"
  225   {Stack->push<triple>(p.dir(t,normalize)); return;}
  226 }
  227 
  228 #line 112 "runpath3d.in"
  229 // triple accel(path3 p, Int t, Int sign=0);
  230 void gen_runpath3d12(stack *Stack)
  231 {
  232   Int sign=vm::pop<Int>(Stack,0);
  233   Int t=vm::pop<Int>(Stack);
  234   path3 p=vm::pop<path3>(Stack);
  235 #line 113 "runpath3d.in"
  236   {Stack->push<triple>(p.accel(t,sign)); return;}
  237 }
  238 
  239 #line 117 "runpath3d.in"
  240 // triple accel(path3 p, real t);
  241 void gen_runpath3d13(stack *Stack)
  242 {
  243   real t=vm::pop<real>(Stack);
  244   path3 p=vm::pop<path3>(Stack);
  245 #line 118 "runpath3d.in"
  246   {Stack->push<triple>(p.accel(t)); return;}
  247 }
  248 
  249 #line 122 "runpath3d.in"
  250 // real radius(path3 p, real t);
  251 void gen_runpath3d14(stack *Stack)
  252 {
  253   real t=vm::pop<real>(Stack);
  254   path3 p=vm::pop<path3>(Stack);
  255 #line 123 "runpath3d.in"
  256   triple v=p.dir(t,false);
  257   triple a=p.accel(t);
  258   real d=dot(a,v);
  259   real v2=v.abs2();
  260   real a2=a.abs2();
  261   real denom=v2*a2-d*d;
  262   real r=v2*sqrt(v2);
  263   {Stack->push<real>(denom > 0 ? r/sqrt(denom) : 0.0); return;}
  264 }
  265 
  266 #line 134 "runpath3d.in"
  267 // real radius(triple z0, triple c0, triple c1, triple z1, real t);
  268 void gen_runpath3d15(stack *Stack)
  269 {
  270   real t=vm::pop<real>(Stack);
  271   triple z1=vm::pop<triple>(Stack);
  272   triple c1=vm::pop<triple>(Stack);
  273   triple c0=vm::pop<triple>(Stack);
  274   triple z0=vm::pop<triple>(Stack);
  275 #line 135 "runpath3d.in"
  276   triple v=(3.0*(z1-z0)+9.0*(c0-c1))*t*t+(6.0*(z0+c1)-12.0*c0)*t+3.0*(c0-z0);
  277   triple a=6.0*(z1-z0+3.0*(c0-c1))*t+6.0*(z0+c1)-12.0*c0;
  278   real d=dot(a,v);
  279   real v2=v.abs2();
  280   real a2=a.abs2();
  281   real denom=v2*a2-d*d;
  282   real r=v2*sqrt(v2);
  283   {Stack->push<real>(denom > 0 ? r/sqrt(denom) : 0.0); return;}
  284 }
  285 
  286 #line 146 "runpath3d.in"
  287 // path3 reverse(path3 p);
  288 void gen_runpath3d16(stack *Stack)
  289 {
  290   path3 p=vm::pop<path3>(Stack);
  291 #line 147 "runpath3d.in"
  292   {Stack->push<path3>(p.reverse()); return;}
  293 }
  294 
  295 #line 151 "runpath3d.in"
  296 // path3 subpath(path3 p, Int a, Int b);
  297 void gen_runpath3d17(stack *Stack)
  298 {
  299   Int b=vm::pop<Int>(Stack);
  300   Int a=vm::pop<Int>(Stack);
  301   path3 p=vm::pop<path3>(Stack);
  302 #line 152 "runpath3d.in"
  303   {Stack->push<path3>(p.subpath((Int) a, (Int) b)); return;}
  304 }
  305 
  306 #line 156 "runpath3d.in"
  307 // path3 subpath(path3 p, real a, real b);
  308 void gen_runpath3d18(stack *Stack)
  309 {
  310   real b=vm::pop<real>(Stack);
  311   real a=vm::pop<real>(Stack);
  312   path3 p=vm::pop<path3>(Stack);
  313 #line 157 "runpath3d.in"
  314   {Stack->push<path3>(p.subpath(a,b)); return;}
  315 }
  316 
  317 #line 161 "runpath3d.in"
  318 // Int length(path3 p);
  319 void gen_runpath3d19(stack *Stack)
  320 {
  321   path3 p=vm::pop<path3>(Stack);
  322 #line 162 "runpath3d.in"
  323   {Stack->push<Int>(p.length()); return;}
  324 }
  325 
  326 #line 166 "runpath3d.in"
  327 // bool cyclic(path3 p);
  328 void gen_runpath3d20(stack *Stack)
  329 {
  330   path3 p=vm::pop<path3>(Stack);
  331 #line 167 "runpath3d.in"
  332   {Stack->push<bool>(p.cyclic()); return;}
  333 }
  334 
  335 #line 171 "runpath3d.in"
  336 // bool straight(path3 p, Int t);
  337 void gen_runpath3d21(stack *Stack)
  338 {
  339   Int t=vm::pop<Int>(Stack);
  340   path3 p=vm::pop<path3>(Stack);
  341 #line 172 "runpath3d.in"
  342   {Stack->push<bool>(p.straight(t)); return;}
  343 }
  344 
  345 #line 176 "runpath3d.in"
  346 // path3 unstraighten(path3 p);
  347 void gen_runpath3d22(stack *Stack)
  348 {
  349   path3 p=vm::pop<path3>(Stack);
  350 #line 177 "runpath3d.in"
  351   {Stack->push<path3>(p.unstraighten()); return;}
  352 }
  353 
  354 // Return the maximum perpendicular deviation of segment i of path3 g
  355 // from a straight line.
  356 #line 183 "runpath3d.in"
  357 // real straightness(path3 p, Int t);
  358 void gen_runpath3d23(stack *Stack)
  359 {
  360   Int t=vm::pop<Int>(Stack);
  361   path3 p=vm::pop<path3>(Stack);
  362 #line 184 "runpath3d.in"
  363   if(p.straight(t)) {Stack->push<real>(0); return;}
  364   triple z0=p.point(t);
  365   triple u=unit(p.point(t+1)-z0);
  366   {Stack->push<real>(::max(length(perp(p.postcontrol(t)-z0,u)),
  367                length(perp(p.precontrol(t+1)-z0,u)))); return;}
  368 }
  369 
  370 // Return the maximum perpendicular deviation of z0..controls c0 and c1..z1
  371 // from a straight line.
  372 #line 194 "runpath3d.in"
  373 // real straightness(triple z0, triple c0, triple c1, triple z1);
  374 void gen_runpath3d24(stack *Stack)
  375 {
  376   triple z1=vm::pop<triple>(Stack);
  377   triple c1=vm::pop<triple>(Stack);
  378   triple c0=vm::pop<triple>(Stack);
  379   triple z0=vm::pop<triple>(Stack);
  380 #line 195 "runpath3d.in"
  381   triple u=unit(z1-z0);
  382   {Stack->push<real>(::max(length(perp(c0-z0,u)),length(perp(c1-z0,u)))); return;}
  383 }
  384 
  385 #line 200 "runpath3d.in"
  386 // bool piecewisestraight(path3 p);
  387 void gen_runpath3d25(stack *Stack)
  388 {
  389   path3 p=vm::pop<path3>(Stack);
  390 #line 201 "runpath3d.in"
  391   {Stack->push<bool>(p.piecewisestraight()); return;}
  392 }
  393 
  394 #line 205 "runpath3d.in"
  395 // real arclength(path3 p);
  396 void gen_runpath3d26(stack *Stack)
  397 {
  398   path3 p=vm::pop<path3>(Stack);
  399 #line 206 "runpath3d.in"
  400   {Stack->push<real>(p.arclength()); return;}
  401 }
  402 
  403 #line 210 "runpath3d.in"
  404 // real arctime(path3 p, real dval);
  405 void gen_runpath3d27(stack *Stack)
  406 {
  407   real dval=vm::pop<real>(Stack);
  408   path3 p=vm::pop<path3>(Stack);
  409 #line 211 "runpath3d.in"
  410   {Stack->push<real>(p.arctime(dval)); return;}
  411 }
  412 
  413 #line 215 "runpath3d.in"
  414 // realarray* intersect(path3 p, path3 q, real fuzz=-1);
  415 void gen_runpath3d28(stack *Stack)
  416 {
  417   real fuzz=vm::pop<real>(Stack,-1);
  418   path3 q=vm::pop<path3>(Stack);
  419   path3 p=vm::pop<path3>(Stack);
  420 #line 216 "runpath3d.in"
  421   bool exact=fuzz <= 0.0;
  422   if(fuzz < 0)
  423     fuzz=BigFuzz*::max(::max(length(p.max()),length(p.min())),
  424                        ::max(length(q.max()),length(q.min())));
  425   
  426   std::vector<real> S,T;
  427   real s,t;
  428   if(intersections(s,t,S,T,p,q,fuzz,true,exact)) {
  429     array *V=new array(2);
  430     (*V)[0]=s;
  431     (*V)[1]=t;
  432     {Stack->push<realarray*>(V); return;}
  433   } else
  434     {Stack->push<realarray*>(new array(0)); return;}
  435 }
  436 
  437 #line 233 "runpath3d.in"
  438 // realarray2* intersections(path3 p, path3 q, real fuzz=-1);
  439 void gen_runpath3d29(stack *Stack)
  440 {
  441   real fuzz=vm::pop<real>(Stack,-1);
  442   path3 q=vm::pop<path3>(Stack);
  443   path3 p=vm::pop<path3>(Stack);
  444 #line 234 "runpath3d.in"
  445   bool exact=fuzz <= 0.0;
  446   if(fuzz < 0)
  447     fuzz=BigFuzz*::max(::max(length(p.max()),length(p.min())),
  448                        ::max(length(q.max()),length(q.min())));
  449   bool single=!exact;
  450   
  451   real s,t;
  452   std::vector<real> S,T;
  453   bool found=intersections(s,t,S,T,p,q,fuzz,single,exact);
  454   if(!found) {Stack->push<realarray2*>(new array(0)); return;}
  455   array *V;
  456   if(single) {
  457     V=new array(1);
  458     array *Vi=new array(2);
  459     (*V)[0]=Vi;
  460     (*Vi)[0]=s;
  461     (*Vi)[1]=t;
  462   } else {
  463     size_t n=S.size();
  464     V=new array(n);
  465     for(size_t i=0; i < n; ++i) {
  466       array *Vi=new array(2);
  467       (*V)[i]=Vi;
  468       (*Vi)[0]=S[i];
  469       (*Vi)[1]=T[i];
  470     }
  471   }
  472   stable_sort(V->begin(),V->end(),run::compare2<real>());
  473   {Stack->push<realarray2*>(V); return;}
  474 }
  475 
  476 #line 266 "runpath3d.in"
  477 // realarray* intersect(path3 p, triplearray2 *P, real fuzz=-1);
  478 void gen_runpath3d30(stack *Stack)
  479 {
  480   real fuzz=vm::pop<real>(Stack,-1);
  481   triplearray2 * P=vm::pop<triplearray2 *>(Stack);
  482   path3 p=vm::pop<path3>(Stack);
  483 #line 267 "runpath3d.in"
  484   triple *A;
  485   copyArray2C(A,P,true,4);
  486   if(fuzz <= 0) fuzz=BigFuzz*::max(::max(length(p.max()),length(p.min())),
  487                                    norm(A,16));
  488   std::vector<real> T,U,V;
  489   bool found=intersections(T,U,V,p,A,fuzz,true);
  490   delete[] A;
  491   if(found) {
  492     array *W=new array(3);
  493     (*W)[0]=T[0];
  494     (*W)[1]=U[0];
  495     (*W)[2]=V[0];
  496     {Stack->push<realarray*>(W); return;}
  497   } else
  498     {Stack->push<realarray*>(new array(0)); return;}
  499 }
  500 
  501 #line 285 "runpath3d.in"
  502 // realarray2* intersections(path3 p, triplearray2 *P, real fuzz=-1);
  503 void gen_runpath3d31(stack *Stack)
  504 {
  505   real fuzz=vm::pop<real>(Stack,-1);
  506   triplearray2 * P=vm::pop<triplearray2 *>(Stack);
  507   path3 p=vm::pop<path3>(Stack);
  508 #line 286 "runpath3d.in"
  509   triple *A;
  510   copyArray2C(A,P,true,4);
  511   if(fuzz <= 0) fuzz=BigFuzz*::max(::max(length(p.max()),length(p.min())),
  512                                    norm(A,16));
  513   std::vector<real> T,U,V;
  514   intersections(T,U,V,p,A,fuzz,false);
  515   delete[] A;
  516   size_t n=T.size();
  517   array *W=new array(n);
  518   for(size_t i=0; i < n; ++i) {
  519     array *Wi=new array(3);
  520     (*W)[i]=Wi;
  521     (*Wi)[0]=T[i];
  522     (*Wi)[1]=U[i];
  523     (*Wi)[2]=V[i];
  524   }
  525   {Stack->push<realarray2*>(W); return;} // Sorting will done in asy.
  526 }
  527 
  528 #line 306 "runpath3d.in"
  529 // Int size(path3 p);
  530 void gen_runpath3d32(stack *Stack)
  531 {
  532   path3 p=vm::pop<path3>(Stack);
  533 #line 307 "runpath3d.in"
  534   {Stack->push<Int>(p.size()); return;}
  535 }
  536 
  537 #line 311 "runpath3d.in"
  538 // path3 &(path3 p, path3 q);
  539 void gen_runpath3d33(stack *Stack)
  540 {
  541   path3 q=vm::pop<path3>(Stack);
  542   path3 p=vm::pop<path3>(Stack);
  543 #line 312 "runpath3d.in"
  544   {Stack->push<path3>(camp::concat(p,q)); return;}
  545 }
  546 
  547 #line 316 "runpath3d.in"
  548 // triple min(path3 p);
  549 void gen_runpath3d34(stack *Stack)
  550 {
  551   path3 p=vm::pop<path3>(Stack);
  552 #line 317 "runpath3d.in"
  553   {Stack->push<triple>(p.min()); return;}
  554 }
  555 
  556 #line 321 "runpath3d.in"
  557 // triple max(path3 p);
  558 void gen_runpath3d35(stack *Stack)
  559 {
  560   path3 p=vm::pop<path3>(Stack);
  561 #line 322 "runpath3d.in"
  562   {Stack->push<triple>(p.max()); return;}
  563 }
  564 
  565 #line 326 "runpath3d.in"
  566 // realarray* mintimes(path3 p);
  567 void gen_runpath3d36(stack *Stack)
  568 {
  569   path3 p=vm::pop<path3>(Stack);
  570 #line 327 "runpath3d.in"
  571   array *V=new array(3);
  572   triple v=p.mintimes();
  573   (*V)[0]=v.getx();
  574   (*V)[1]=v.gety();
  575   (*V)[2]=v.getz();
  576   {Stack->push<realarray*>(V); return;}
  577 }
  578 
  579 #line 336 "runpath3d.in"
  580 // realarray* maxtimes(path3 p);
  581 void gen_runpath3d37(stack *Stack)
  582 {
  583   path3 p=vm::pop<path3>(Stack);
  584 #line 337 "runpath3d.in"
  585   array *V=new array(3);
  586   triple v=p.maxtimes();
  587   (*V)[0]=v.getx();
  588   (*V)[1]=v.gety();
  589   (*V)[2]=v.getz();
  590   {Stack->push<realarray*>(V); return;}
  591 }
  592 
  593 #line 346 "runpath3d.in"
  594 // path3 *(realarray2 *t, path3 g);
  595 void gen_runpath3d38(stack *Stack)
  596 {
  597   path3 g=vm::pop<path3>(Stack);
  598   realarray2 * t=vm::pop<realarray2 *>(Stack);
  599 #line 347 "runpath3d.in"
  600   {Stack->push<path3>(transformed(*t,g)); return;}
  601 }
  602 
  603 #line 351 "runpath3d.in"
  604 // pair minratio(path3 g);
  605 void gen_runpath3d39(stack *Stack)
  606 {
  607   path3 g=vm::pop<path3>(Stack);
  608 #line 352 "runpath3d.in"
  609   {Stack->push<pair>(g.ratio(::min)); return;}
  610 }
  611 
  612 #line 356 "runpath3d.in"
  613 // pair maxratio(path3 g);
  614 void gen_runpath3d40(stack *Stack)
  615 {
  616   path3 g=vm::pop<path3>(Stack);
  617 #line 357 "runpath3d.in"
  618   {Stack->push<pair>(g.ratio(::max)); return;}
  619 }
  620 
  621 // Return a negative (positive) value if a--b--c--cycle is oriented
  622 // counterclockwise (clockwise) when viewed from d or zero if all four
  623 // points are coplanar. 
  624 // The value returned is the determinant
  625 // |a.x a.y a.z 1|
  626 // |b.x b.y b.z 1|
  627 // |c.x c.y c.z 1|
  628 // |d.x d.y d.z 1|
  629 #line 369 "runpath3d.in"
  630 // real orient(triple a, triple b, triple c, triple d);
  631 void gen_runpath3d41(stack *Stack)
  632 {
  633   triple d=vm::pop<triple>(Stack);
  634   triple c=vm::pop<triple>(Stack);
  635   triple b=vm::pop<triple>(Stack);
  636   triple a=vm::pop<triple>(Stack);
  637 #line 370 "runpath3d.in"
  638   real A[]={a.getx(),a.gety(),a.getz()};
  639   real B[]={b.getx(),b.gety(),b.getz()};
  640   real C[]={c.getx(),c.gety(),c.getz()};
  641   real D[]={d.getx(),d.gety(),d.getz()};
  642   {Stack->push<real>(orient3d(A,B,C,D)); return;}
  643 }
  644 
  645 // Return a positive (negative) value if e lies inside (outside)
  646 // the sphere passing through the points a,b,c,d oriented so that
  647 // a--b--c--cycle appears in clockwise order when viewed from d
  648 // or zero if all five points are cospherical.
  649 // The value returned is the determinant
  650 // |a.x a.y a.z a.x^2+a.y^2+a.z^2 1|
  651 // |b.x b.y b.z b.x^2+b.y^2+b.z^2 1|
  652 // |c.x c.y c.z c.x^2+c.y^2+c.z^2 1|
  653 // |d.x d.y d.z d.x^2+d.y^2+d.z^2 1|
  654 // |e.x e.y e.z e.x^2+e.y^2+e.z^2 1|
  655 #line 388 "runpath3d.in"
  656 // real insphere(triple a, triple b, triple c, triple d, triple e);
  657 void gen_runpath3d42(stack *Stack)
  658 {
  659   triple e=vm::pop<triple>(Stack);
  660   triple d=vm::pop<triple>(Stack);
  661   triple c=vm::pop<triple>(Stack);
  662   triple b=vm::pop<triple>(Stack);
  663   triple a=vm::pop<triple>(Stack);
  664 #line 389 "runpath3d.in"
  665   real A[]={a.getx(),a.gety(),a.getz()};
  666   real B[]={b.getx(),b.gety(),b.getz()};
  667   real C[]={c.getx(),c.gety(),c.getz()};
  668   real D[]={d.getx(),d.gety(),d.getz()};
  669   real E[]={e.getx(),e.gety(),e.getz()};
  670   {Stack->push<real>(insphere(A,B,C,D,E)); return;}
  671 }
  672 
  673 } // namespace run
  674 
  675 namespace trans {
  676 
  677 void gen_runpath3d_venv(venv &ve)
  678 {
  679 #line 40 "runpath3d.in"
  680   addFunc(ve, run::gen_runpath3d0, primPath3(), SYM(path3), formal(tripleArray(), SYM(pre), false, false), formal(tripleArray(), SYM(point), false, false), formal(tripleArray(), SYM(post), false, false), formal(booleanArray(), SYM(straight), false, false), formal(primBoolean(), SYM(cyclic), false, false));
  681 #line 57 "runpath3d.in"
  682   REGISTER_BLTIN(run::nullPath3,"nullPath3");
  683 #line 62 "runpath3d.in"
  684   addFunc(ve, run::gen_runpath3d2, primBoolean(), SYM_EQ, formal(primPath3(), SYM(a), false, false), formal(primPath3(), SYM(b), false, false));
  685 #line 67 "runpath3d.in"
  686   addFunc(ve, run::gen_runpath3d3, primBoolean(), SYM_NEQ, formal(primPath3(), SYM(a), false, false), formal(primPath3(), SYM(b), false, false));
  687 #line 72 "runpath3d.in"
  688   addFunc(ve, run::gen_runpath3d4, primTriple(), SYM(point), formal(primPath3(), SYM(p), false, false), formal(primInt(), SYM(t), false, false));
  689 #line 77 "runpath3d.in"
  690   addFunc(ve, run::gen_runpath3d5, primTriple(), SYM(point), formal(primPath3(), SYM(p), false, false), formal(primReal(), SYM(t), false, false));
  691 #line 82 "runpath3d.in"
  692   addFunc(ve, run::gen_runpath3d6, primTriple(), SYM(precontrol), formal(primPath3(), SYM(p), false, false), formal(primInt(), SYM(t), false, false));
  693 #line 87 "runpath3d.in"
  694   addFunc(ve, run::gen_runpath3d7, primTriple(), SYM(precontrol), formal(primPath3(), SYM(p), false, false), formal(primReal(), SYM(t), false, false));
  695 #line 92 "runpath3d.in"
  696   addFunc(ve, run::gen_runpath3d8, primTriple(), SYM(postcontrol), formal(primPath3(), SYM(p), false, false), formal(primInt(), SYM(t), false, false));
  697 #line 97 "runpath3d.in"
  698   addFunc(ve, run::gen_runpath3d9, primTriple(), SYM(postcontrol), formal(primPath3(), SYM(p), false, false), formal(primReal(), SYM(t), false, false));
  699 #line 102 "runpath3d.in"
  700   addFunc(ve, run::gen_runpath3d10, primTriple(), SYM(dir), formal(primPath3(), SYM(p), false, false), formal(primInt(), SYM(t), false, false), formal(primInt(), SYM(sign), true, false), formal(primBoolean(), SYM(normalize), true, false));
  701 #line 107 "runpath3d.in"
  702   addFunc(ve, run::gen_runpath3d11, primTriple(), SYM(dir), formal(primPath3(), SYM(p), false, false), formal(primReal(), SYM(t), false, false), formal(primBoolean(), SYM(normalize), true, false));
  703 #line 112 "runpath3d.in"
  704   addFunc(ve, run::gen_runpath3d12, primTriple(), SYM(accel), formal(primPath3(), SYM(p), false, false), formal(primInt(), SYM(t), false, false), formal(primInt(), SYM(sign), true, false));
  705 #line 117 "runpath3d.in"
  706   addFunc(ve, run::gen_runpath3d13, primTriple(), SYM(accel), formal(primPath3(), SYM(p), false, false), formal(primReal(), SYM(t), false, false));
  707 #line 122 "runpath3d.in"
  708   addFunc(ve, run::gen_runpath3d14, primReal(), SYM(radius), formal(primPath3(), SYM(p), false, false), formal(primReal(), SYM(t), false, false));
  709 #line 134 "runpath3d.in"
  710   addFunc(ve, run::gen_runpath3d15, primReal(), SYM(radius), formal(primTriple(), SYM(z0), false, false), formal(primTriple(), SYM(c0), false, false), formal(primTriple(), SYM(c1), false, false), formal(primTriple(), SYM(z1), false, false), formal(primReal(), SYM(t), false, false));
  711 #line 146 "runpath3d.in"
  712   addFunc(ve, run::gen_runpath3d16, primPath3(), SYM(reverse), formal(primPath3(), SYM(p), false, false));
  713 #line 151 "runpath3d.in"
  714   addFunc(ve, run::gen_runpath3d17, primPath3(), SYM(subpath), formal(primPath3(), SYM(p), false, false), formal(primInt(), SYM(a), false, false), formal(primInt(), SYM(b), false, false));
  715 #line 156 "runpath3d.in"
  716   addFunc(ve, run::gen_runpath3d18, primPath3(), SYM(subpath), formal(primPath3(), SYM(p), false, false), formal(primReal(), SYM(a), false, false), formal(primReal(), SYM(b), false, false));
  717 #line 161 "runpath3d.in"
  718   addFunc(ve, run::gen_runpath3d19, primInt(), SYM(length), formal(primPath3(), SYM(p), false, false));
  719 #line 166 "runpath3d.in"
  720   addFunc(ve, run::gen_runpath3d20, primBoolean(), SYM(cyclic), formal(primPath3(), SYM(p), false, false));
  721 #line 171 "runpath3d.in"
  722   addFunc(ve, run::gen_runpath3d21, primBoolean(), SYM(straight), formal(primPath3(), SYM(p), false, false), formal(primInt(), SYM(t), false, false));
  723 #line 176 "runpath3d.in"
  724   addFunc(ve, run::gen_runpath3d22, primPath3(), SYM(unstraighten), formal(primPath3(), SYM(p), false, false));
  725 #line 181 "runpath3d.in"
  726   addFunc(ve, run::gen_runpath3d23, primReal(), SYM(straightness), formal(primPath3(), SYM(p), false, false), formal(primInt(), SYM(t), false, false));
  727 #line 192 "runpath3d.in"
  728   addFunc(ve, run::gen_runpath3d24, primReal(), SYM(straightness), formal(primTriple(), SYM(z0), false, false), formal(primTriple(), SYM(c0), false, false), formal(primTriple(), SYM(c1), false, false), formal(primTriple(), SYM(z1), false, false));
  729 #line 200 "runpath3d.in"
  730   addFunc(ve, run::gen_runpath3d25, primBoolean(), SYM(piecewisestraight), formal(primPath3(), SYM(p), false, false));
  731 #line 205 "runpath3d.in"
  732   addFunc(ve, run::gen_runpath3d26, primReal(), SYM(arclength), formal(primPath3(), SYM(p), false, false));
  733 #line 210 "runpath3d.in"
  734   addFunc(ve, run::gen_runpath3d27, primReal(), SYM(arctime), formal(primPath3(), SYM(p), false, false), formal(primReal(), SYM(dval), false, false));
  735 #line 215 "runpath3d.in"
  736   addFunc(ve, run::gen_runpath3d28, realArray(), SYM(intersect), formal(primPath3(), SYM(p), false, false), formal(primPath3(), SYM(q), false, false), formal(primReal(), SYM(fuzz), true, false));
  737 #line 233 "runpath3d.in"
  738   addFunc(ve, run::gen_runpath3d29, realArray2(), SYM(intersections), formal(primPath3(), SYM(p), false, false), formal(primPath3(), SYM(q), false, false), formal(primReal(), SYM(fuzz), true, false));
  739 #line 266 "runpath3d.in"
  740   addFunc(ve, run::gen_runpath3d30, realArray(), SYM(intersect), formal(primPath3(), SYM(p), false, false), formal(tripleArray2(), SYM(p), false, false), formal(primReal(), SYM(fuzz), true, false));
  741 #line 285 "runpath3d.in"
  742   addFunc(ve, run::gen_runpath3d31, realArray2(), SYM(intersections), formal(primPath3(), SYM(p), false, false), formal(tripleArray2(), SYM(p), false, false), formal(primReal(), SYM(fuzz), true, false));
  743 #line 306 "runpath3d.in"
  744   addFunc(ve, run::gen_runpath3d32, primInt(), SYM(size), formal(primPath3(), SYM(p), false, false));
  745 #line 311 "runpath3d.in"
  746   addFunc(ve, run::gen_runpath3d33, primPath3(), SYM_AMPERSAND, formal(primPath3(), SYM(p), false, false), formal(primPath3(), SYM(q), false, false));
  747 #line 316 "runpath3d.in"
  748   addFunc(ve, run::gen_runpath3d34, primTriple(), SYM(min), formal(primPath3(), SYM(p), false, false));
  749 #line 321 "runpath3d.in"
  750   addFunc(ve, run::gen_runpath3d35, primTriple(), SYM(max), formal(primPath3(), SYM(p), false, false));
  751 #line 326 "runpath3d.in"
  752   addFunc(ve, run::gen_runpath3d36, realArray(), SYM(mintimes), formal(primPath3(), SYM(p), false, false));
  753 #line 336 "runpath3d.in"
  754   addFunc(ve, run::gen_runpath3d37, realArray(), SYM(maxtimes), formal(primPath3(), SYM(p), false, false));
  755 #line 346 "runpath3d.in"
  756   addFunc(ve, run::gen_runpath3d38, primPath3(), SYM_TIMES, formal(realArray2(), SYM(t), false, false), formal(primPath3(), SYM(g), false, false));
  757 #line 351 "runpath3d.in"
  758   addFunc(ve, run::gen_runpath3d39, primPair(), SYM(minratio), formal(primPath3(), SYM(g), false, false));
  759 #line 356 "runpath3d.in"
  760   addFunc(ve, run::gen_runpath3d40, primPair(), SYM(maxratio), formal(primPath3(), SYM(g), false, false));
  761 #line 361 "runpath3d.in"
  762   addFunc(ve, run::gen_runpath3d41, primReal(), SYM(orient), formal(primTriple(), SYM(a), false, false), formal(primTriple(), SYM(b), false, false), formal(primTriple(), SYM(c), false, false), formal(primTriple(), SYM(d), false, false));
  763 #line 378 "runpath3d.in"
  764   addFunc(ve, run::gen_runpath3d42, primReal(), SYM(insphere), formal(primTriple(), SYM(a), false, false), formal(primTriple(), SYM(b), false, false), formal(primTriple(), SYM(c), false, false), formal(primTriple(), SYM(d), false, false), formal(primTriple(), SYM(e), false, false));
  765 }
  766 
  767 } // namespace trans