- Timestamp:
- Oct 4, 2006, 9:32:03 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/abstract_2d_finite_volumes/neighbour_mesh.py
r3684 r3688 517 517 518 518 519 # Check that previous are not in candidate list 520 #for p in candidate_list: 521 # assert not allclose(p0, p) 522 523 519 524 # Choose vector against which all angles will be measured 520 525 if len(polygon) > 1: 521 v_prev = p0 - polygon[-2] # Vector that leads to p0 522 523 # Normalise 524 #v_prev /= sqrt(sum(v_prev**2)) 526 v_prev = p0 - polygon[-2] # Vector that leads to p0 from previous point 525 527 else: 526 528 # FIXME (Ole): What do we do if the first point has multiple … … 531 533 v_prev = [1.0, 0.0] 532 534 533 535 534 536 # Choose candidate with minimum angle 535 537 minimum_angle = 2*pi 536 538 for pc in candidate_list: 537 vc = pc-p0 # Candidate vector 538 # Normalise 539 #vc /= sqrt(sum(vc**2)) 539 540 540 541 vc = pc-p0 # Candidate vector (from p0 to candidate pt) 542 541 543 # Angle between each candidate and the previous vector 542 544 # in [-pi, pi] 543 544 545 ac = angle(vc, v_prev) 545 if ac > pi: ac = pi-ac 546 if ac > pi: 547 # Give preference to angles on the right hand side of v_prev 548 #print 'pc = %s, changing angle from %f to %f' %(pc, ac*180/pi, (ac-2*pi)*180/pi) 549 ac = ac-2*pi 546 550 547 551 # take the minimal angle corresponding to the rightmost vector … … 553 557 if verbose is True: 554 558 print ' Best candidate %s, angle %f' %(p1, minimum_angle*180/pi) 555 559 556 560 else: 557 561 p1 = candidate_list[0]
Note: See TracChangeset
for help on using the changeset viewer.