//------------------------------------------------------------------------- // Purpose : reorient the facet // // Special Notes : This function should only be used if it is acceptable // to change the underlying data representation of the // facets (for example the Sierra facet representation // cannot change and will not permit changing of the // node orders on a facet) // // Also note that if this function is used, the isBackwards // flag on the facet should be set appropriately. // // Creator : Steve Owen // // Creation Date : 06/28/00 //------------------------------------------------------------------------- void CubitFacetData::flip() { CubitVector* ctrl_points=control_points( ); CubitPoint *pt_tmp = pointArray[1]; pointArray[1] = pointArray[2]; pointArray[2] = pt_tmp; CubitFacetEdge *ed_tmp = edgeArray[1]; edgeArray[1] = edgeArray[2]; edgeArray[2] = ed_tmp; //make sure the edgeUses are matched with the correct edge... int ed_use_tmp = edgeUse[1]; edgeUse[1]=edgeUse[2]; edgeUse[2]=ed_use_tmp; //now flip the edge uses... int ii; for (ii=0; ii<3; ii++) { if (edgeUse[ii] == -1) { edgeUse[ii] = 1; } else if(edgeUse[ii] == 1) { edgeUse[ii] = -1; } } if(ctrl_points){ CubitVector tmp_point; tmp_point = ctrl_points[0]; ctrl_points[0]=ctrl_points[1]; ctrl_points[1]=tmp_point; tmp_point = ctrl_points[2]; ctrl_points[2]=ctrl_points[5]; ctrl_points[5]=tmp_point; tmp_point = ctrl_points[3]; ctrl_points[3]=ctrl_points[4]; ctrl_points[4]=tmp_point; } update_plane(); //update the normals on the points (including boundary points) for (ii=0; ii<3; ii++) { pointArray[ii]->compute_avg_normal(); TDFacetBoundaryPoint* tdfbp = TDFacetBoundaryPoint::get_facet_boundary_point(pointArray[ii]); if(tdfbp){ if(!tdfbp->reset_normals()){ PRINT_ERROR("Could not reset all the normals for a point.\n"); } } } }
//precond, se llamo a srand...!!! void createFile(char* filename, int control_count, int range) { ofstream out; out.open(filename,ios::app); if(!out.is_open()) { cout << "No se pudo salvar el archivo " << filename << endl; return; } out << control_count << " " << M_SMPS << endl; //-->guardo #puntos_de_control y M vector<pair> control_points(control_count); control_points = getRandomControlPoints(control_count,range); for(int i=0;i<control_count;i++) out << control_points[i].first << " " << control_points[i].second << endl; out << endl << getRandDouble(range) << " " << getRandDouble(range) << endl; //-->x**,y** out << endl << 0 << " " << 0 << endl; //-->x*,y* out.close(); }