def DrawForeground(self, e): p1 = self.mouse.p1 p2 = self.mouse.p2 for i, p0 in enumerate(self.points): if distance_point_line(p0, (p1, p2)) < self.tol: e.Display.DrawDot(Point3d(*p0), str(i), self.dotcolor, self.textcolor) break
def pull_to_edge(self, s_mesh, f_id): for u, v in s_mesh.c_mesh.face_halfedges(f_id): line = s_mesh.c_mesh.edge_coordinates(u, v) if cg.distance_point_point(line[0], line[1]) > TOL: if cg.distance_point_line(self.pos, line) < TOL: return (u, v) return None
def distance_to_line(self, line): """Compute the distance to a line. Parameters ---------- line : :class:`compas.geometry.Line` or tuple of points. The line. Returns ------- float The distance. Examples -------- >>> from compas.geometry import Line >>> point = Point(0.0, 0.0, 0.0) >>> line = Line(Point(1.0, 0.0, 0.0), Point(1.0, 1.0, 0.0)) >>> point.distance_to_line(line) 1.0 """ return distance_point_line(self, line)
def distance_to_line(self, line): return distance_point_line(self, line)
def distance_point_triangle(point, tri_end_pts): lines = [(pt_1, pt_2) for pt_1, pt_2 in combinations(tri_end_pts, 2)] return sum([distance_point_line(point, line) for line in lines])