Exemple #1
0
def is_coplanar(pyptlist):
    """
    This function checks if the list of points are coplanar. 
 
    Parameters
    ----------
    pyptlist : a list of tuples
        The list of points to be checked. List of points to be converted. A pypt is a tuple that documents the xyz coordinates of a pt e.g. (x,y,z), 
        thus a pyptlist is a list of tuples e.g. [(x1,y1,z1), (x2,y2,z2), ...]
        
    Returns
    -------
    True or False : bool
        If True the list of points are coplanar.
    """
    from sympy import Point3D
    sympt_list = []
    for pypt in pyptlist:
        sympt = Point3D(pypt[0], pypt[1], pypt[2])
        sympt_list.append(sympt)
    
    coplanar = Point3D.are_coplanar(*sympt_list)
    return coplanar
Exemple #2
0
def is_coplanar(pyptlist):
    """
    This function checks if the list of points are coplanar. 
 
    Parameters
    ----------
    pyptlist : a list of tuples
        The list of points to be checked. List of points to be converted. A pypt is a tuple that documents the xyz coordinates of a pt e.g. (x,y,z), 
        thus a pyptlist is a list of tuples e.g. [(x1,y1,z1), (x2,y2,z2), ...]
        
    Returns
    -------
    True or False : bool
        If True the list of points are coplanar.
    """
    from sympy import Point3D
    sympt_list = []
    for pypt in pyptlist:
        sympt = Point3D(pypt[0], pypt[1], pypt[2])
        sympt_list.append(sympt)

    coplanar = Point3D.are_coplanar(*sympt_list)
    return coplanar
 prtemp = Psp.projection(pointL1sp)
 prpointL1P = vector(
     [prtemp.x._sage_(),
      prtemp.y._sage_(),
      prtemp.z._sage_()])
 prL1Pparam = (solve([
     x - prM2P[_sage_const_0]
     == (prpointL1P[_sage_const_0] - prM2P[_sage_const_0]) * t,
     y - prM2P[_sage_const_1]
     == (prpointL1P[_sage_const_1] - prM2P[_sage_const_1]) * t,
     z - prM2P[_sage_const_2]
     == (prpointL1P[_sage_const_2] - prM2P[_sage_const_2]) * t
 ], x, y, z))[_sage_const_0]
 L2sp = Line3D(Point3D(M2), Point3D(M3))
 # проверка на компланарность (=, пересекаются или параллельны)
 w = Point3D.are_coplanar(Point3D(pointL), Point3D(point2L), Point3D(M2),
                          Point3D(M3))
 sL2 = M3 - M2
 sLL2 = M2 - pointL
 if w:
     if Line3D.is_parallel(Lsp, L2sp):
         strLL2 = r"параллельны"
         dLL2 = Lsp.distance(M2)
     else:
         if Line3D.is_similar(Lsp, L2sp):
             strLL2 = r"совпадают"
             dLL2 = _sage_const_0
         else:
             strLL2 = r"пересекаются"
             dLL2 = _sage_const_0
 else:
     strLL2 = r"скрещиваются"