(euc_obj:Union[Point23, Vector23])
return result
Given a Point3/Vector3, return a Point2/Vector2 ignoring the original Z coordinate
Given a Point3/Vector3, return a Point2/Vector2 ignoring the original Z coordinate
Given a Point3 / Vector3 return a Point2 / Vector2 ignoring the original Z coordinate
def project_to_2D(euc_obj:Union[Point23, Vector23]) -> Union[Vector2, Point2]:
    """
    Given a Point3/Vector3, return a Point2/Vector2 ignoring the original Z coordinate
    """
    result:Union[Vector2, Point2] = None
    if isinstance(euc_obj, (Point2, Vector2)):
        result = euc_obj
    elif isinstance(euc_obj, Point3):
        result = Point2(euc_obj.x, euc_obj.y)
    elif isinstance(euc_obj, Vector3):
        result = Vector2(euc_obj.x, euc_obj.y)
    else:
        raise ValueError(f"Can't transform object {euc_obj} to a Point2 or Vector2")

    return result
def project_to_2D ( euc_obj : Union [ Point23 , Vector23 ] ) -> Union [ Vector2 , Point2 ] : result : Union [ Vector2 , Point2 ] = None if isinstance ( euc_obj , ( Point2 , Vector2 ) ) : result = euc_obj elif isinstance ( euc_obj , Point3 ) : result = Point2 ( euc_obj . x , euc_obj . y ) elif isinstance ( euc_obj , Vector3 ) : result = Vector2 ( euc_obj . x , euc_obj . y ) else : raise ValueError ( f"Can't transform object {euc_obj} to a Point2 or Vector2" ) return result