コード例 #1
0
def draw_edge_rhino(edge):
    # ==============================================================================
    # Use a frame artist to visualize the boundary frame.
    # ==============================================================================
    artist = FrameArtist(edge['frames'][0],
                         layer=edge['layer'] + "::Frame",
                         scale=0.3)
    artist.clear_layer()
    artist.draw()
    # ==============================================================================
    # Use a frame artist to visualize the frame of the intersection points.
    # ==============================================================================
    artist = FrameArtist(edge['frames'][1],
                         layer=edge['layer'] + "::Frame",
                         scale=0.3)
    artist.clear_layer()
    artist.draw()
    # ==============================================================================
    # Use a point artist to visualize the intersection points.
    # ==============================================================================
    PointArtist.draw_collection(edge['intersections'],
                                layer=edge['layer'] + "::Intersections",
                                clear=True)
    # ==============================================================================
    # Use a mesh artist to visualize beams
    # ==============================================================================
    artist = MeshArtist(None, layer=edge['layer'] + "::BBox")
    artist.clear_layer()
    for mesh in edge['meshes']:
        artist = MeshArtist(mesh, layer=edge['layer'] + "::BBox")
        artist.draw_mesh()
コード例 #2
0
    def draw_cloud(self, colormap='viridis', points=None):
        """Returns the points and colors to create a point cloud.

        The colors are calculated on the score at the respective frame. If the
        frames are a 2D list, the point of the first frame of the list is used.

        Parameters
        ----------
        colormap : str, optional
            The colormap for the point cloud.
        points : list of :class:`compas.geometry.Points`, optional
            Points to override the points from the reachability map.

        Returns
        -------
        list[System.Guid]
            The GUIDs of the created Rhino objects.

        """

        points = points or self.reachability_map.points

        cmap = ColorMap.from_mpl(colormap)
        score = self.reachability_map.score
        minv, maxv = min(score), max(score)

        guids = []
        for num, pt in zip(score, points):
            color = cmap(num, minv, maxv)
            artist = PointArtist(pt, layer=self.layer)
            guids.extend(artist.draw(color))

        return guids
コード例 #3
0
# ==============================================================================
# Visualize
# ==============================================================================

meshartist = MeshArtist(None)

meshartist.mesh = Mesh.from_vertices_and_faces(*A)
meshartist.layer = "CGAL::Intersections::A"
meshartist.clear_layer()
meshartist.draw_faces(join_faces=True, color=hex_to_rgb('#222222'))

meshartist.mesh = Mesh.from_vertices_and_faces(*B)
meshartist.layer = "CGAL::Intersections::B"
meshartist.clear_layer()
meshartist.draw_faces(join_faces=True, color=hex_to_rgb('#888888'))

polylineartist = PolylineArtist(None, layer="CGAL::Intersections::Polylines")
polylineartist.clear_layer()
pointartist = PointArtist(None, layer='CGAL::Intersections::Points')
pointartist.clear_layer()

for polyline in polylines:
    polylineartist.primitive = polyline
    polylineartist.color = hex_to_rgb('#ffffff')
    polylineartist.draw()
    PointArtist.draw_collection(
        polyline.points, color=(255, 0, 0), layer='CGAL::Intersections::Points')

polylineartist.redraw()
コード例 #4
0
from math import radians

from compas.geometry import Pointcloud
from compas.geometry import Rotation
from compas.geometry import Translation
from compas.geometry import Frame
from compas.geometry import Point, Vector, Line
from compas.geometry import closest_point_on_line
from compas.rpc import Proxy

import compas_rhino
from compas_rhino.artists import PointArtist
from compas_rhino.artists import FrameArtist
from compas_rhino.artists import LineArtist

numerical = Proxy('compas.numerical')

pcl = Pointcloud.from_bounds(10, 5, 3, 100)

Rz = Rotation.from_axis_and_angle([0.0, 0.0, 1.0], radians(60))
Ry = Rotation.from_axis_and_angle([0.0, 1.0, 0.0], radians(20))
Rx = Rotation.from_axis_and_angle([1.0, 0.0, 0.0], radians(10))

T = Translation.from_vector([2.0, 5.0, 8.0])

pcl.transform(T * Rz * Ry * Rx)

PointArtist.draw_collection(pcl, layer="ITA20::PCL", clear=True)
コード例 #5
0
ファイル: boundary.py プロジェクト: tetov/ITA19
bbox = Mesh.from_vertices_and_faces(bbox, [[0, 1, 2, 3]])

# ==============================================================================
# Use a frame artist to visualize the boundary frame.
# ==============================================================================

artist = FrameArtist(frame, layer="SOUTH::Frame", scale=0.3)
artist.clear_layer()
artist.draw()

# ==============================================================================
# Use a point artist to visualize the intersection points.
# ==============================================================================

PointArtist.draw_collection(intersections,
                            layer="SOUTH::Intersections",
                            clear=True)

# ==============================================================================
# Use a frame artist to visualize the frame of the intersection points.
# ==============================================================================

artist = FrameArtist(frame1, layer="SOUTH::Frame1", scale=0.3)
artist.clear_layer()
artist.draw()

# ==============================================================================
# Use a mesh artist to visualize the bounding box.
# ==============================================================================

artist = MeshArtist(bbox, layer="SOUTH::Bbox1")
    for key in l:
        a = cablenet.vertex_coordinates(key)
        r = cablenet.residual(key)
        b = add_vectors(a, r)
        x_front = intersection_line_plane((a, b), plane_front)
        x_back = intersection_line_plane((a, b), plane_back)
        move_point_to_front = add_vectors(
            x_back, scale_vector(frame_0.zaxis, -THICKNESS))

        intersections_front.append(x_front)
        intersections_back.append(x_back)
        pca_points.append(x_front)
        pca_points.append(move_point_to_front)

    PointArtist.draw_collection(intersections_back,
                                layer=name + "::Intersections_back",
                                clear=True)
    PointArtist.draw_collection(pca_points,
                                layer=name + "::Intersections_front",
                                clear=True)

    # # ==============================================================================
    # # Generate a beam every 3 vertices of the boundary. Compute a local frame for the
    # # selected vertices using a PCA of the vertex locations.
    # # ==============================================================================

    step = 6
    start = 0
    end = step
    clear_layer(name + "::Beams", include_children=True, include_hidden=True)