RefVertex *RefEdge::common_ref_vertex( RefEdge *next_ref_edge, RefFace *ref_face_ptr ) { CoEdge *co_edge_this = NULL; CoEdge *co_edge_next = NULL; //First get the two coedges that corrispond to //this ref_edge an the next one, with reference to //the ref_face_ptr. CubitStatus status = get_two_co_edges( next_ref_edge, ref_face_ptr, co_edge_this, co_edge_next ); if (status == CUBIT_FAILURE ) return NULL; assert(co_edge_this != NULL ); assert(co_edge_next != NULL ); RefVertex *common_vertex; //Now according to the sense get the vertex at the //end of this edge (start if reversed). if ( co_edge_this->get_sense() == CUBIT_FORWARD ) common_vertex = end_vertex(); else common_vertex = start_vertex(); //Lets just do a sanitiy check... if (common_vertex == NULL || !next_ref_edge->is_directly_related( common_vertex )) { // let's check for bad sense, then print warning and return // correct vertex common_vertex = other_vertex(common_vertex); if (common_vertex != NULL && next_ref_edge->is_directly_related( common_vertex )) { PRINT_ERROR(" bad sense between curve %d and surface %d; please" " report this.\n", id(), ref_face_ptr->id()); } else { PRINT_ERROR("unable to find common vertex (curves %d, %d)", this->id(), next_ref_edge->id()); assert(CUBIT_TRUE); return (RefVertex*)NULL; } } //Hurray, Success... return common_vertex; }
Bface* cw_face(CBvert* v) const { return ccw_face(other_vertex(v)); }