Example #1
0
 def validateMidPoints_p1p2(self):
     pa = []
     for p in [self.lines[1][0], self.lines[1][1]]:
         if nSect(p, self.centroids):
             for c in self.centroids:
                 c.verts.append(p)
                 n = list(self.centroids - {c})[0]
                 c.addNeighbor(n, p)
Example #2
0
	def validateMidPoints_p1p2(self):
		pa=[]
		for p in [self.lines[1][0],self.lines[1][1]]:
			if nSect(p,self.centroids):
				for c in self.centroids:
					c.verts.append(p)
					n= list(self.centroids-{c})[0]
					c.addNeighbor(n,p)
Example #3
0
 def validateBoundaryIntersects_p0p3(self):
     self.nIntersects = 0
     for p in [self.lines[0][0], self.lines[2][1]]:
         if nSect(p, self.centroids):
             self.nIntersects += 1
             for c in self.centroids:
                 c.verts.append(p)
                 n = list(self.centroids - {c})[0]
                 c.addNeighbor(n, p)
                 c.isClosed = False
Example #4
0
	def validateBoundaryIntersects_p0p3(self):
		self.nIntersects= 0
		for p in [self.lines[0][0],self.lines[2][1]]:
			if nSect(p,self.centroids):
				self.nIntersects+=1
				for c in self.centroids:
					c.verts.append(p)
					n= list(self.centroids-{c})[0]
					c.addNeighbor(n,p)
					c.isClosed= False
Example #5
0
	def validate_BorderBorderIntersectPoint(self, other):
		if self.centroids & other.centroids: # do they have a centroid in common
			C= self.centroids | other.centroids # both's centroids. len(C)==3
			if not C in Border.IntersectsTested: # 3 centroids, 3 borders
				Border.IntersectsTested.append(C) # 3 intersect tests, 2nd and 3rd ~= 1st

				v= self.getBorderBorderIntersectPoint(other)
				if v and nSect(v,C):
					C3= self.centroids ^ other.centroids
					assert len(C3)==2,str(C3)
					third= Border.of(C3)
					self.nIntersects+=1
					other.nIntersects+=1
					third.nIntersects+=1
					for c in C:
						c.verts.append(v)
						for n in C-{c}:
							c.addNeighbor(n,v)

					return v
Example #6
0
    def validate_BorderBorderIntersectPoint(self, other):
        if self.centroids & other.centroids:  # do they have a centroid in common
            C = self.centroids | other.centroids  # both's centroids. len(C)==3
            if not C in Border.IntersectsTested:  # 3 centroids, 3 borders
                Border.IntersectsTested.append(
                    C)  # 3 intersect tests, 2nd and 3rd ~= 1st

                v = self.getBorderBorderIntersectPoint(other)
                if v and nSect(v, C):
                    C3 = self.centroids ^ other.centroids
                    assert len(C3) == 2, str(C3)
                    third = Border.of(C3)
                    self.nIntersects += 1
                    other.nIntersects += 1
                    third.nIntersects += 1
                    for c in C:
                        c.verts.append(v)
                        for n in C - {c}:
                            c.addNeighbor(n, v)

                    return v