Changeset 385

Show
Ignore:
Timestamp:
08/19/08 19:37:01 (3 months ago)
Author:
powell
Message:

Fixes to NewtonRefine?, now it works.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/matml/src/ternary/qhull.c

    r383 r385  
    125125      double vG=x2*y3-x3*y2; 
    126126      slope2 = (xG*y3-x3*yG)/vG; 
    127       slope3 = (xG*y2-x2*yG)/vG; 
     127      slope3 = (x2*yG-xG*y2)/vG; 
    128128 
    129129      printf ("      corners: %g %g %g %g %g %g %g %g %g\n      slopes: %g %g\n", 
     
    146146         current.C2>=0. && current.C3>=0. && current.C2+current.C3<=1.) 
    147147    { 
    148       double dC2, dC3; 
     148      double dC2, dC3, det; 
    149149 
    150150      /*+ Calculate the energy derivatives +*/ 
     
    152152 
    153153      /*+ Subtract the facet slopes from the energy derivatives +*/ 
    154       current.G2 += slope2; 
    155       current.G3 += slope3; 
     154      current.G2 -= slope2; 
     155      current.G3 -= slope3; 
    156156 
    157157      /*+ Solve the linear system to estimate the vector to the minimum +*/ 
    158       dC3 = current.G22*current.G33 - current.G23*current.G23; 
    159       dC2 = (current.G3*current.G23 - current.G2*current.G33) / dC3; 
    160       dC3 = (current.G2*current.G23 - current.G3*current.G22) / dC3; 
     158      det = current.G22*current.G33 - current.G23*current.G23; 
     159      dC2 = (current.G3*current.G23 - current.G2*current.G33) / det; 
     160      dC3 = (current.G2*current.G23 - current.G3*current.G22) / det; 
    161161 
    162162      /*+ Add that vector to the point +*/