static Boolean attempt_three_to_two( Triangulation *manifold) { EdgeClass *edge, *where_to_resume; /* * Note: It's easy to prove that if the three original Tetrahedra * are positively oriented, then the two new Tetrahedra must be * positively oriented as well. So we needn't worry about negatively * oriented Tetrahedra here. */ for (edge = manifold->edge_list_begin.next; edge != &manifold->edge_list_end; edge = edge->next) if (edge->order == 3) if (concave_edge(edge) == TRUE) { if (three_to_two(edge, &where_to_resume, &manifold->num_tetrahedra) == func_OK) return TRUE; else /* * The only reason three_to_two() can fail is that the * three Tetrahedra surrounding the EdgeClass are not * distinct. But by Corolloary 3 of "Convex hulls..." * this cannot happen where the hull is concave. */ uFatalError("attempt_three_to_two", "canonize_part_1"); } return FALSE; }
void cube_to_rects() { if (m_sighted) { m_quads[0][0].position = three_to_two(m_abs_posits[m_cubordinates[0]][m_cubordinates[1]][m_cubordinates[2]]); m_quads[0][1].position = three_to_two(m_abs_posits[!m_cubordinates[0]][m_cubordinates[1]][m_cubordinates[2]]); m_quads[0][2].position = three_to_two(m_abs_posits[!m_cubordinates[0]][!m_cubordinates[1]][m_cubordinates[2]]); m_quads[0][3].position = three_to_two(m_abs_posits[m_cubordinates[0]][!m_cubordinates[1]][m_cubordinates[2]]); m_quads[0][0].color = square_to_color(m_color, m_abs_squares[m_cubordinates[0]][m_cubordinates[1]][m_cubordinates[2]], m_sight_inverse); m_quads[0][1].color = square_to_color(m_color, m_abs_squares[!m_cubordinates[0]][m_cubordinates[1]][m_cubordinates[2]], m_sight_inverse); m_quads[0][2].color = square_to_color(m_color, m_abs_squares[!m_cubordinates[0]][!m_cubordinates[1]][m_cubordinates[2]], m_sight_inverse); m_quads[0][3].color = square_to_color(m_color, m_abs_squares[m_cubordinates[0]][!m_cubordinates[1]][m_cubordinates[2]], m_sight_inverse); m_average_squares[0] = 0.25f*(m_abs_squares[m_cubordinates[0]][m_cubordinates[1]][m_cubordinates[2]] + m_abs_squares[!m_cubordinates[0]][m_cubordinates[1]][m_cubordinates[2]] + m_abs_squares[!m_cubordinates[0]][!m_cubordinates[1]][m_cubordinates[2]] + m_abs_squares[m_cubordinates[0]][!m_cubordinates[1]][m_cubordinates[2]]); m_quads[1][0].position = three_to_two(m_abs_posits[m_cubordinates[0]][m_cubordinates[1]][m_cubordinates[2]]); m_quads[1][1].position = three_to_two(m_abs_posits[m_cubordinates[0]][!m_cubordinates[1]][m_cubordinates[2]]); m_quads[1][2].position = three_to_two(m_abs_posits[m_cubordinates[0]][!m_cubordinates[1]][!m_cubordinates[2]]); m_quads[1][3].position = three_to_two(m_abs_posits[m_cubordinates[0]][m_cubordinates[1]][!m_cubordinates[2]]); m_quads[1][0].color = square_to_color(m_color, m_abs_squares[m_cubordinates[0]][m_cubordinates[1]][m_cubordinates[2]], m_sight_inverse); m_quads[1][1].color = square_to_color(m_color, m_abs_squares[m_cubordinates[0]][!m_cubordinates[1]][m_cubordinates[2]], m_sight_inverse); m_quads[1][2].color = square_to_color(m_color, m_abs_squares[m_cubordinates[0]][!m_cubordinates[1]][!m_cubordinates[2]], m_sight_inverse); m_quads[1][3].color = square_to_color(m_color, m_abs_squares[m_cubordinates[0]][m_cubordinates[1]][!m_cubordinates[2]], m_sight_inverse); m_average_squares[1] = 0.25f*(m_abs_squares[m_cubordinates[0]][m_cubordinates[1]][m_cubordinates[2]] + m_abs_squares[m_cubordinates[0]][!m_cubordinates[1]][m_cubordinates[2]] + m_abs_squares[m_cubordinates[0]][!m_cubordinates[1]][!m_cubordinates[2]] + m_abs_squares[m_cubordinates[0]][m_cubordinates[1]][!m_cubordinates[2]]); m_quads[2][0].position = three_to_two(m_abs_posits[m_cubordinates[0]][m_cubordinates[1]][m_cubordinates[2]]); m_quads[2][1].position = three_to_two(m_abs_posits[m_cubordinates[0]][m_cubordinates[1]][!m_cubordinates[2]]); m_quads[2][2].position = three_to_two(m_abs_posits[!m_cubordinates[0]][m_cubordinates[1]][!m_cubordinates[2]]); m_quads[2][3].position = three_to_two(m_abs_posits[!m_cubordinates[0]][m_cubordinates[1]][m_cubordinates[2]]); m_quads[2][0].color = square_to_color(m_color, m_abs_squares[m_cubordinates[0]][m_cubordinates[1]][m_cubordinates[2]], m_sight_inverse); m_quads[2][1].color = square_to_color(m_color, m_abs_squares[m_cubordinates[0]][m_cubordinates[1]][!m_cubordinates[2]], m_sight_inverse); m_quads[2][2].color = square_to_color(m_color, m_abs_squares[!m_cubordinates[0]][m_cubordinates[1]][!m_cubordinates[2]], m_sight_inverse); m_quads[2][3].color = square_to_color(m_color, m_abs_squares[!m_cubordinates[0]][m_cubordinates[1]][m_cubordinates[2]], m_sight_inverse); m_average_squares[2] = 0.25f*(m_abs_squares[m_cubordinates[0]][m_cubordinates[1]][m_cubordinates[2]] + m_abs_squares[m_cubordinates[0]][m_cubordinates[1]][!m_cubordinates[2]] + m_abs_squares[!m_cubordinates[0]][m_cubordinates[1]][!m_cubordinates[2]] + m_abs_squares[!m_cubordinates[0]][m_cubordinates[1]][m_cubordinates[2]]); } }