(a, b, c,
               ab_weight=0.5, bc_weight=0.5, ca_weight=0.5,
               pyr_a_weight=ONE_THIRD, pyr_b_weight=ONE_THIRD, pyr_c_weight=ONE_THIRD,
               pyr_height_weight=ONE_THIRD
               )
return triangles
Point3s a, b, and c must be coplanar and define a face
    ab_weight, etc define the subdivision of the original face
    pyr_a_weight, etc define where the point of the new pyramid face will go
    pyr_height determines how far from the face the new pyramid's point will be
Point3s a, b, and c must be coplanar and define a face
    ab_weight, etc define the subdivision of the original face
    pyr_a_weight, etc define where the point of the new pyramid face will go
    pyr_height determines how far from the face the new pyramid's point will be
Point3s a b and c must be coplanar and define a face ab_weight etc define the subdivision of the original face pyr_a_weight etc define where the point of the new pyramid face will go pyr_height determines how far from the face the new pyramid s point will be
def kochify_3d(a, b, c,
               ab_weight=0.5, bc_weight=0.5, ca_weight=0.5,
               pyr_a_weight=ONE_THIRD, pyr_b_weight=ONE_THIRD, pyr_c_weight=ONE_THIRD,
               pyr_height_weight=ONE_THIRD
               ):
    """
    Point3s a, b, and c must be coplanar and define a face
    ab_weight, etc define the subdivision of the original face
    pyr_a_weight, etc define where the point of the new pyramid face will go
    pyr_height determines how far from the face the new pyramid's point will be
    """
    triangles = []
    new_a = affine_combination(a, b, ab_weight)
    new_b = affine_combination(b, c, bc_weight)
    new_c = affine_combination(c, a, ca_weight)

    triangles.extend([[a, new_a, new_c], [b, new_b, new_a], [c, new_c, new_b]])

    avg_pt_x = a.x * pyr_a_weight + b.x * pyr_b_weight + c.x * pyr_c_weight
    avg_pt_y = a.y * pyr_a_weight + b.y * pyr_b_weight + c.y * pyr_c_weight
    avg_pt_z = a.z * pyr_a_weight + b.z * pyr_b_weight + c.z * pyr_c_weight

    center_pt = Point3(avg_pt_x, avg_pt_y, avg_pt_z)

    # The top of the pyramid will be on a normal
    ab_vec = b - a
    bc_vec = c - b
    ca_vec = a - c
    normal = ab_vec.cross(bc_vec).normalized()
    avg_side_length = (abs(ab_vec) + abs(bc_vec) + abs(ca_vec)) / 3
    pyr_h = avg_side_length * pyr_height_weight
    pyr_pt = LineSegment3(center_pt, normal, pyr_h).p2

    triangles.extend([[new_a, pyr_pt, new_c], [new_b, pyr_pt, new_a], [new_c, pyr_pt, new_b]])

    return triangles
def kochify_3d ( a , b , c , ab_weight = 0.5 , bc_weight = 0.5 , ca_weight = 0.5 , pyr_a_weight = ONE_THIRD , pyr_b_weight = ONE_THIRD , pyr_c_weight = ONE_THIRD , pyr_height_weight = ONE_THIRD ) : triangles = [ ] new_a = affine_combination ( a , b , ab_weight ) new_b = affine_combination ( b , c , bc_weight ) new_c = affine_combination ( c , a , ca_weight ) triangles . extend ( [ [ a , new_a , new_c ] , [ b , new_b , new_a ] , [ c , new_c , new_b ] ] ) avg_pt_x = a . x * pyr_a_weight + b . x * pyr_b_weight + c . x * pyr_c_weight avg_pt_y = a . y * pyr_a_weight + b . y * pyr_b_weight + c . y * pyr_c_weight avg_pt_z = a . z * pyr_a_weight + b . z * pyr_b_weight + c . z * pyr_c_weight center_pt = Point3 ( avg_pt_x , avg_pt_y , avg_pt_z ) # The top of the pyramid will be on a normal ab_vec = b - a bc_vec = c - b ca_vec = a - c normal = ab_vec . cross ( bc_vec ) . normalized ( ) avg_side_length = ( abs ( ab_vec ) + abs ( bc_vec ) + abs ( ca_vec ) ) / 3 pyr_h = avg_side_length * pyr_height_weight pyr_pt = LineSegment3 ( center_pt , normal , pyr_h ) . p2 triangles . extend ( [ [ new_a , pyr_pt , new_c ] , [ new_b , pyr_pt , new_a ] , [ new_c , pyr_pt , new_b ] ] ) return triangles