Changeset 3676


Ignore:
Timestamp:
Sep 29, 2006, 12:14:03 PM (18 years ago)
Author:
duncan
Message:

checked in hack in angle.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/utilities/numerical_tools.py

    r3514 r3676  
    4646    c = innerproduct(v1, normal_vector(v2)) # Projection onto normal
    4747                                            # (negative cross product)
    48    
    49     theta = acos(p)
     48    #print "p",p
     49    #print "v1", v1
     50    #print "v2", v2
     51
     52   
     53    # Warning, this is a hack.  It could cause code to go in loop forever
     54    if False:
     55        try:
     56            theta = acos(p)
     57            #print "theta",theta
     58        except ValueError:
     59            print "Doing a hack in numerical tools."
     60            print "p",p
     61            print "v1", v1
     62            print "v2", v2
     63            if p > (1.0 - 1e-12): #sus, checking a float
     64                # Throw a warning
     65                theta = 0.0
     66            else:
     67                raise
     68    else:
     69        theta = acos(p)
     70           
     71     #   print "problem with p",p
     72     # as p goes to 1 theta goes to 0
    5073   
    5174    # Correct if v1 is in quadrant 3 or 4 with respect to v2 (as the x-axis)
Note: See TracChangeset for help on using the changeset viewer.