def intersections_with_crack(self, crack, path_ordered): reload(GeoMath) intersections = [] edges_floor = GeoMath.getEdgesFromPoints(self.get_absolute_points()) prev_intersection = None next_intersection = None #======================================================================= # we group the intersections in pairs, because after we'll have a different # destruction in the floor for each pair of intersection #======================================================================= for infoPrim in path_ordered: patterns = crack[infoPrim.getPrim()] for pattern in patterns: pattern_edges = GeoMath.getEdgesFromPoints(pattern.getPoints()) may_intersect, pattern_edge_inter, floor_edge_inter = GeoMath.bolzanoIntersectionEdges2_5D( pattern_edges, edges_floor) if (may_intersect): # FIXME: HACK: we take one point of the pattern edge and put the y of the floor. # We are assuming the edge is perpendicular to the floor. # TEMP: point_intersection = [ pattern_edge_inter[0][0], floor_edge_inter[0][1], pattern_edge_inter[0][2] ] logging.debug("Intersection bef" + str(point_intersection)) logging.debug("fllor_edge_inter " + str(floor_edge_inter)) #point2DToProjectOntoXZ = [point_intersection[0], 0, point_intersection[2]] #floorEdge2DToCalculateProjectionOntoXZ = [[floor_edge_inter[0][0],0 , floor_edge_inter[0][2]], [floor_edge_inter[1][0], 0, floor_edge_inter[1][2]]] #point_intersection = GeoMath.getPointProjectionOnLine(floorEdge2DToCalculateProjectionOntoXZ, point2DToProjectOntoXZ) #point_intersection = [point_intersection[0], floor_edge_inter[0][1], point_intersection[2]] logging.debug("Intersection " + str(point_intersection)) if (not prev_intersection): prev_intersection = point_intersection break elif (not GeoMath.pointEqualPoint(point_intersection, prev_intersection)): next_intersection = point_intersection new_intersection = [ prev_intersection, next_intersection ] intersections.append(new_intersection) prev_intersection = None next_intersection = None break return intersections
def intersections_with_crack(self, crack, path_ordered): reload(GeoMath) intersections = [] edges_floor = GeoMath.getEdgesFromPoints(self.get_absolute_points()) prev_intersection = None next_intersection = None #======================================================================= # we group the intersections in pairs, because after we'll have a different # destruction in the floor for each pair of intersection #======================================================================= for infoPrim in path_ordered: patterns = crack[infoPrim.getPrim()] for pattern in patterns: pattern_edges = GeoMath.getEdgesFromPoints(pattern.getPoints()) may_intersect, pattern_edge_inter, floor_edge_inter = GeoMath.bolzanoIntersectionEdges2_5D(pattern_edges, edges_floor) if(may_intersect): # FIXME: HACK: we take one point of the pattern edge and put the y of the floor. # We are assuming the edge is perpendicular to the floor. # TEMP: point_intersection = [pattern_edge_inter[0][0], floor_edge_inter[0][1], pattern_edge_inter[0][2]] logging.debug("Intersection bef" + str(point_intersection)) logging.debug("fllor_edge_inter " + str(floor_edge_inter)) #point2DToProjectOntoXZ = [point_intersection[0], 0, point_intersection[2]] #floorEdge2DToCalculateProjectionOntoXZ = [[floor_edge_inter[0][0],0 , floor_edge_inter[0][2]], [floor_edge_inter[1][0], 0, floor_edge_inter[1][2]]] #point_intersection = GeoMath.getPointProjectionOnLine(floorEdge2DToCalculateProjectionOntoXZ, point2DToProjectOntoXZ) #point_intersection = [point_intersection[0], floor_edge_inter[0][1], point_intersection[2]] logging.debug("Intersection " + str(point_intersection)) if(not prev_intersection): prev_intersection = point_intersection break elif(not GeoMath.pointEqualPoint(point_intersection, prev_intersection)): next_intersection = point_intersection new_intersection = [prev_intersection, next_intersection] intersections.append(new_intersection) prev_intersection = None next_intersection = None break return intersections