Ejemplo n.º 1
0
 def frame(self):
     """The local coordinate frame."""
     o  = self.center
     w  = self.normal
     p  = self.points[0]
     u  = Vector.from_start_end(o, p)
     u.unitize()
     v = Vector.cross(w, u)
     return o, u, v, w
Ejemplo n.º 2
0
 def from_point_and_two_vectors(cls, point, v1, v2):
     v1 = Vector(*v1)
     v2 = Vector(*v2)
     n = Vector.cross(v1, v2)
     n.unitize()
     plane = cls()
     plane.point = Point(*point)
     plane.normal = n
     return plane
Ejemplo n.º 3
0
 def from_three_points(cls, p1, p2, p3):
     p1 = Point(*p1)
     p2 = Point(*p2)
     p3 = Point(*p3)
     v1 = p2 - p1
     v2 = p3 - p1
     plane = cls()
     plane.point = p1
     plane.normal = Vector.cross(v1, v2)
     plane.normal.unitize()
     return plane
Ejemplo n.º 4
0
    def from_point_and_two_vectors(cls, point, u, v):
        """Construct a plane from a base point and two vectors.

        Parameters
        ----------
        point : point
            The base point.
        u : vector
            The first vector.
        v : vector
            The second vector.

        Returns
        -------
        Plane
            A plane with base point ``point`` and normal vector defined as the unitized
            cross product of vectors ``u`` and ``v``.

        """
        normal = Vector.cross(u, v)
        return cls(point, normal)
Ejemplo n.º 5
0
    def from_three_points(cls, a, b, c):
        """Construct a plane from three points in three-dimensional space.

        Parameters
        ----------
        a : point
            The first point.
        b : point
            The second point.
        c : point
            The second point.

        Returns
        -------
        Plane
            A plane with base point ``a`` and normal vector defined as the unitized
            cross product of the vectors ``ab`` and ``ac``.

        """
        a = Point(*a)
        b = Point(*b)
        c = Point(*c)
        normal = Vector.cross(b - a, c - a)
        return cls(a, normal)
Ejemplo n.º 6
0
 def yaxis(self, vector):
     yaxis = Vector(*vector)
     yaxis.unitize()
     zaxis = Vector.cross(self.xaxis, yaxis)
     self._yaxis = Vector.cross(zaxis, self.xaxis)