コード例 #1
0
ファイル: frame.py プロジェクト: compas-dev/compas
    def from_data(cls, data):
        """Construct a frame from its data representation.

        Parameters
        ----------
        data : dict
            The data dictionary.

        Returns
        -------
        :class:`compas.geometry.Frame`
            The constructed frame.

        Examples
        --------
        >>> data = {'point': [0.0, 0.0, 0.0], 'xaxis': [1.0, 0.0, 0.0], 'yaxis': [0.0, 1.0, 0.0]}
        >>> frame = Frame.from_data(data)
        >>> frame.point
        Point(0.000, 0.000, 0.000)
        >>> frame.xaxis
        Vector(1.000, 0.000, 0.000)
        >>> frame.yaxis
        Vector(0.000, 1.000, 0.000)

        """
        frame = cls(Point.from_data(data['point']), Vector.from_data(data['xaxis']), Vector.from_data(data['yaxis']))
        return frame
コード例 #2
0
ファイル: plane.py プロジェクト: compas-dev/compas
    def from_data(cls, data):
        """Construct a plane from its data representation.

        Parameters
        ----------
        data : dict
            The data dictionary.

        Returns
        -------
        :class:`compas.geometry.Plane`
            The constructed plane.

        Examples
        --------
        >>> plane = Plane.from_data({'point': [0.0, 0.0, 0.0], 'normal': [0.0, 0.0, 1.0]})
        >>> plane.point
        Point(0.000, 0.000, 0.000)
        >>> plane.normal
        Vector(0.000, 0.000, 1.000)

        """
        return cls(Point.from_data(data['point']), Vector.from_data(data['normal']))
コード例 #3
0
ファイル: plane.py プロジェクト: compas-dev/compas
 def data(self, data):
     self.point = Point.from_data(data['point'])
     self.normal = Vector.from_data(data['normal'])
コード例 #4
0
ファイル: frame.py プロジェクト: compas-dev/compas
 def data(self, data):
     self.point = Point.from_data(data['point'])
     self.xaxis = Vector.from_data(data['xaxis'])
     self.yaxis = Vector.from_data(data['yaxis'])