Ignore:
Timestamp:
Jun 5, 2006, 12:03:41 PM (18 years ago)
Author:
ole
Message:

Made boundary polygon return absolute UTM coordinates as per ticket:81

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/pyvolution/mesh.py

    r3062 r3072  
    426426
    427427
    428     def get_boundary_polygon(self, verbose = False):
     428    def get_boundary_polygon(self, verbose=False):
    429429        """Return bounding polygon for mesh (counter clockwise)
    430430
     
    432432        If multiple vertex values are present, the algorithm will select the
    433433        path that contains the mesh.
     434
     435        All points are in absolute UTM coordinates
    434436        """
    435437       
     
    438440
    439441
    440         # FIXME (Ole): Make sure all points are absolute UTM   
    441        
    442442        # Get mesh extent
    443         xmin, xmax, ymin, ymax = self.get_extent() # FIXME: Make Absolute
     443        xmin, xmax, ymin, ymax = self.get_extent(absolute=True)
    444444        pmin = ensure_numeric([xmin, ymin])
    445445        pmax = ensure_numeric([xmax, ymax])       
     
    456456            if edge_id == 2: a = 0; b = 1
    457457
    458             # FIXME: Make Absolute
    459             A = self.get_vertex_coordinate(i, a) # Start
    460             B = self.get_vertex_coordinate(i, b) # End
     458            A = self.get_vertex_coordinate(i, a, absolute=True) # Start
     459            B = self.get_vertex_coordinate(i, b, absolute=True) # End
     460
    461461
    462462            # Take the point closest to pmin as starting point
     
    488488
    489489
    490 
     490           
    491491        #Start with smallest point and follow boundary (counter clock wise)
    492492        polygon = [p0]      # Storage for final boundary polygon
    493         point_registry = {} # Keep track of storage to avoid multiple runs around boundary
    494                             # This will only be the case if there are more than one candidate
    495                             # FIXME (Ole): Perhaps we can do away with polygon and use
    496                             # only point_registry to save space.
     493        point_registry = {} # Keep track of storage to avoid multiple runs around
     494                            # boundary. This will only be the case if there are
     495                            # more than one candidate.
     496                            # FIXME (Ole): Perhaps we can do away with polygon
     497                            # and use only point_registry to save space.
    497498
    498499        point_registry[tuple(p0)] = 0                           
     
    509510
    510511                if verbose:
    511                     print 'Point %s has multiple candidates: %s' %(str(p0), candidate_list)
     512                    print 'Point %s has multiple candidates: %s'\
     513                          %(str(p0), candidate_list)
    512514
    513515
     
    516518                    v_prev = p0 - polygon[-2] # Vector that leads to p0
    517519                else:
    518                     # FIXME (Ole): What do we do if the first point has multiple candidates?
     520                    # FIXME (Ole): What do we do if the first point has multiple
     521                    # candidates?
    519522                    # Being the lower left corner, perhaps we can use the
    520523                    # vector [1, 0], but I really don't know if this is completely
     
    530533                    vc = pc-p0  # Candidate vector
    531534                   
    532                     # Angle between each candidate and the previous vector in [-pi, pi]
     535                    # Angle between each candidate and the previous vector
     536                    # in [-pi, pi]
    533537                    ac = angle(vc, v_prev)
    534538                    if ac > pi: ac = pi-ac
Note: See TracChangeset for help on using the changeset viewer.