def update_bar_lengths(self):
        """update each bar's length so that it can cover all the contact points specified in edges (contact joints)
        """
        for b in self.vertex:
            # edges are contact joints
            edges_con = self.vertex_connected_edges(b)
            list_pts = []
            # for each connnected joint
            for bar_vert_1, bar_vert_2 in edges_con:
                dpp = dropped_perpendicular_points(
                    self.vertex[bar_vert_1]["axis_endpoints"][0],
                    self.vertex[bar_vert_1]["axis_endpoints"][1],
                    self.vertex[bar_vert_2]["axis_endpoints"][0],
                    self.vertex[bar_vert_2]["axis_endpoints"][1])
                self.edge[bar_vert_1][bar_vert_2]["endpoints"][0] = dpp
                points = self.edge[bar_vert_1][bar_vert_2]["endpoints"]
                for p in points.keys():
                    pair_points = points[p]
                    if pair_points != []:
                        for pt in pair_points:
                            if is_point_on_line(
                                    pt, self.vertex[b]["axis_endpoints"], TOL):
                                list_pts.append(pt)

            if len(list_pts) > 0:
                if len(list_pts) > 2:
                    pts_extr = find_points_extreme(
                        list_pts, self.vertex[b]["axis_endpoints"])
                else:
                    pts_extr = list_pts
                # update axis end points
                self.vertex[b].update({"axis_endpoints": pts_extr})
Exemple #2
0
    def on_line(self, line):
        """Determine if the point lies on the given line.

        Parameters
        ----------
        line : :class:`compas.geometry.Line` or tuple of points.
            The line.

        Returns
        -------
        bool
            True, if the point lies on the line.
            False, otherwise.

        Examples
        --------
        >>> from compas.geometry import Line
        >>> line = Line(Point(1.0, 0.0, 0.0), Point(1.0, 1.0, 0.0))
        >>> point = line.point(1.5)
        >>> point.on_line(line)
        True
        """
        return is_point_on_line(self, line)