Пример #1
0
std::ostream& ossimLasPointRecord3::print(std::ostream& out) const
{
   // Capture the original flags.
   std::ios_base::fmtflags f = out.flags();

   out << std::setiosflags(std::ios_base::fixed) << std::setprecision(8);
 
   out << "x:                 " << m_record.m_x
       << "\ny:                 " << m_record.m_y
       << "\nz:                 " << m_record.m_z
       << "\nintensity:         " << m_record.m_intensity
       << "\nreturn:            " << int(getReturnNumber())
       << "\nnumber_of_returns: " << int(getNumberOfReturns())
       << "\nedge:              " << (getEdgeFlag()?"true":"false")
       << "\nscan_direction:    " << int(m_record.m_bitFlags.m_scanDirection)
       << "\nclassification:    " << m_record.m_classification
       << "\nscan_angle_rank:   " << int(m_record.m_scanAngleRank)
       << "\nuser_data:         " << m_record.m_userData
       << "\npoint_source_id:   " << m_record.m_pointSourceId
       << "\ngrs_time:          " << m_record.m_gpsTime
       << "\nred:               " << m_record.m_red
       << "\ngreen:             " << m_record.m_green
       << "\nblue:              " << m_record.m_blue
       << std::endl;

   // Reset flags.
   out.setf(f);
   return out;
}
Пример #2
0
std::ostream& ossimLasPointRecord4::print(std::ostream& out) const
{
   // Capture the original flags.
   std::ios_base::fmtflags f = out.flags();

   out << std::setiosflags(std::ios_base::fixed) << std::setprecision(8);
 
   out << "x:                             " << m_record.m_x
       << "\ny:                             " << m_record.m_y
       << "\nz:                             " << m_record.m_z
       << "\nintensity:                     " << m_record.m_intensity
       << "\nreturn:                        " << int(getReturnNumber())
       << "\nnumber_of_returns:             " << int(getNumberOfReturns())
       << "\nedge:                          " << (getEdgeFlag()?"true":"false")
       << "\nscan_direction:                " << int(m_record.m_bitFlags.m_scanDirection)
       << "\nclassification:                " << m_record.m_classification
       << "\nscan_angle_rank:               " << int(m_record.m_scanAngleRank)
       << "\nuser_data:                     " << m_record.m_userData
       << "\npoint_source_id:               " << m_record.m_pointSourceId
       << "\ngrs_time:                      " << m_record.m_gpsTime
       << "\nwave_packet_descriptor_index:  " << m_record.m_wavePacketDescriptorIndex
       << "\nbyte_offset_to_waveform_data:  " << m_record.m_byteOffsetToWaveformData
       << "\nwaveform_packet_size_in_bytes: " << m_record.m_waveformPacketSizeInBytes
       << "\nm_returnPointWaveformLocation: " << m_record.m_returnPointWaveformLocation
       << "\nred:                           " << m_record.m_red
       << "\ngreen:                         " << m_record.m_green
       << "\nblue:                          " << m_record.m_blue
       << std::endl;

   // Reset flags.
   out.setf(f);
   return out;
}
void VoxelChunkTransitionSurfaceDesc::gen1D(std::vector<unsigned int>* tempIndices, bool inverted){
	for (int x = 0; x < dimInCells; x++){
		// first read the vertex index from the original index table.
		int ind0 = readIndex1D(x, 0);
		char edge = getEdgeFlag(x);
		if (edge != -1)
		{
			int ind3 = readIndex1D(x, 3);
			int ind1 = readIndex1D(x, 1);
			int ind2 = readIndex1D(x, 2);
			windQuad(edge, ind0, ind1, ind2, ind3, tempIndices, inverted);
		}
	}
}
Пример #4
0
void GeomData::calculateNumBDRYEdges(pMesh theMesh) {
    if (theMesh->getDim()==3) {
        return;
    }

    int ndom = getNumDomains();
    numDomBDRYEdges = new int[ndom];
    pEntity edge, face;
    std::set<pEntity> edgeList;
    for (int i=0; i<ndom; i++) {
        FIter fit = M_faceIter(theMesh);
        while ( (face = FIter_next(fit)) ) {
            if (getFaceFlag(face)==domainList[i]) {
                for (int j = 0; j<3; j++) {
                    edge = (pEdge)face->get(1,j);
                    //cout << "edge flag: " << getEdgeFlag(edge) << endl;
                    if ( getEdgeFlag(edge)!= domainList[i]) {
                        edgeList.insert(edge);
                    }
                }
            }
        }
        FIter_delete(fit);
        numDomBDRYEdges[i] = (int)edgeList.size();
        if (!numDomBDRYEdges[i]) {
            throw Exception(__LINE__,__FILE__,"Number of boundary edges: 0. You must set the correct flag to ");
        }
        edgeList.clear();
    }
    numExtBdryEdges = 0;
    EIter eit = M_edgeIter(theMesh);
    while ( (edge=EIter_next(eit)) ) {
        if (E_numFaces(edge)==1) {
            numExtBdryEdges++;
        }
    }
    EIter_delete(eit);
}
Пример #5
0
void readmesh_parametric(pMesh m, const char* filename, std::list<parametric_coords> &parametric_list){
	cout << "Lendo malha... \n";
	ifstream fid;
	fid.open(filename);
	int NbNod, iNod;
	double x,y,z;
	char line[512];
	fid.getline (line,256);
	fid >> NbNod;
	cout << setprecision(10) << fixed;
	cout << "\nNodes: " << NbNod << endl;
	for(int i=0;i<NbNod;i++){

		parametric_coords parametric;

		fid >> iNod >> x >> y >> z >> parametric.npc;
		m->createVertex(iNod,x,y,z,0);

		switch (parametric.npc){
		case 0:
			fid >> parametric.pcoord1;

			cout << x << " " << y << " " << z << " " << parametric.pcoord1 << endl;
			break;
		case 1:
			fid >> parametric.pcoord1 >> parametric.pcoord2;
			cout << x << " " << y << " " << z << " " << parametric.pcoord1 << " " << parametric.pcoord2 << endl;
			break;
		case 2:
			fid >> parametric.pcoord1 >> parametric.pcoord2 >> parametric.pcoord3;
			cout << x << " " << y << " " << z << " " << parametric.pcoord1 << " " << parametric.pcoord2 << " " << parametric.pcoord3 << endl;
			break;
		}
		parametric_list.push_back(parametric);
	}

	fid.getline (line,256);
	fid.getline (line,256);
	fid.getline (line,256);
	fid >> NbNod;
	cout << "\tElements: " << NbNod << endl;
//	int face_id = 0;

	int v_counter = 0;
	int e_counter = 0;
	int f_counter = 0;
	for (int i=0; i<NbNod; i++){
		int iNbNod,iTyp,iGrp,iElm,iNbSub,id;
		mVertex *nod[100];
		fid >> iElm >> iTyp >> iGrp >> iNbSub >> iNbNod;

		//cout << "iTyp: " << iTyp << "\tiGrp: " << iGrp << endl;
		for(int i=0;i<iNbNod;i++){
			fid >> id;
			nod[i] = m->getVertex(id);
		}

//		mEntity *theEntity = 0;
		switch(iTyp){
		case 2 :
			f_counter++;
			m->createFaceWithVertices(nod[0],nod[1],nod[2],m->getGEntity(iGrp,2));
			//EN_setID((pEntity)theEntity,++face_id);
			break;
		case 1 :
			e_counter++;
			m->createEdge(nod[0],nod[1],m->getGEntity(iGrp,1));
			break;
		case 15 :
			v_counter++;
			mVertex *v = nod[0];
			v->classify(m->getGEntity(iGrp,0));
			break;
		}
	}
	cout << "done!\n";
	cout << "Summary:\n";
	cout << "----------------------------------\n";
	cout << "#Prescribed vertices: " << v_counter << endl;
	cout << "#Boundary edges:      " << e_counter << endl;
	cout << "#Triangles:           " << f_counter << endl;


//	pVertex node;

	int flag;
	pEntity edge, ent;
	EIter eit = M_edgeIter(m);
	while ( (edge = EIter_next(eit)) ){
		flag = getEdgeFlag(edge);
		for (int i=0; i<2; i++){
			pVertex v = edge->get(0,i);
			if ( !v->getClassification() ){
				v->classify( m->getGEntity(flag,0) );
			}
		}
	}
	EIter_delete(eit);

	FIter fit = M_faceIter(m);
	while ( (ent = FIter_next(fit)) ){
		flag = GEN_tag(ent->getClassification());
		for (int i=0; i<3; i++){
			pVertex v = ent->get(0,i);
			if ( !v->getClassification() ){
				v->classify( m->getGEntity(flag,0) );
			}
		}
	}
	FIter_delete(fit);

	//	VIter vit = M_vertexIter(m);
	//	while ( (node = VIter_next(vit)) ){
	//		cout << "Node " << EN_id(node) << " has classification ";
	//		if ( !node->getClassification() ){
	//			cout << "NULL\n";
	//		}
	//		else{
	//			cout << GEN_tag(node->getClassification()) << endl;
	//		}
	//	}
	//	VIter_delete(vit);
	m->modifyState(2,1);
	m->modifyState(1,2);
}
Пример #6
0
void readmesh(pMesh m, const char* filename){
	cout << "Lendo malha... ";
	ifstream fid;
	fid.open(filename);
	int NbNod;
	int iNod;
	double x,y,z;
	char line[256];
	fid.getline (line,256);
	fid >> NbNod;
	cout << "\nNodes: " << NbNod;
	for(int i=0;i<NbNod;i++){
		fid >> iNod >> x >> y >> z;
		m->createVertex(iNod,x,y,z,0);
	}
	fid.getline (line,256);
	fid.getline (line,256);
	fid.getline (line,256);
	fid >> NbNod;
	cout << "\tElements: " << NbNod << endl;
//	int face_id = 0;

	int v_counter = 0;
	int e_counter = 0;
	int f_counter = 0;
	for (int i=0; i<NbNod; i++){
		int iNbNod,iTyp,iGrp,iElm,iNbSub,id;
		mVertex *nod[100];
		fid >> iElm >> iTyp >> iGrp >> iNbSub >> iNbNod;

		//cout << "iTyp: " << iTyp << "\tiGrp: " << iGrp << endl;
		for(int i=0;i<iNbNod;i++){
			fid >> id;
			nod[i] = m->getVertex(id);
		}

		switch(iTyp){
		case 2 :
			f_counter++;
			m->createFaceWithVertices(nod[0],nod[1],nod[2],m->getGEntity(iGrp,2));
			break;
		case 1 :
			e_counter++;
			m->createEdge(nod[0],nod[1],m->getGEntity(iGrp,1));
			break;
		case 15 :
			v_counter++;
			mVertex *v = nod[0];
			v->classify(m->getGEntity(iGrp,0));
			break;
		}
	}
	cout << "done!\n";
	cout << "Summary:\n";
	cout << "----------------------------------\n";
	cout << "#Prescribed vertices: " << v_counter << endl;
	cout << "#Boundary edges:      " << e_counter << endl;
	cout << "#Triangles:           " << f_counter << endl;


//	pVertex node;

	int flag;
	pEntity edge, ent;
	EIter eit = M_edgeIter(m);
	while ( (edge = EIter_next(eit)) ){
		flag = getEdgeFlag(edge);
		for (int i=0; i<2; i++){
			pVertex v = edge->get(0,i);
			if ( !v->getClassification() ){
				v->classify( m->getGEntity(flag,0) );
			}
		}
	}
	EIter_delete(eit);

	FIter fit = M_faceIter(m);
	while ( (ent = FIter_next(fit)) ){
		flag = GEN_tag(ent->getClassification());
		for (int i=0; i<3; i++){
			pVertex v = ent->get(0,i);
			if ( !v->getClassification() ){
				v->classify( m->getGEntity(flag,0) );
			}
		}
	}
	FIter_delete(fit);

	//	VIter vit = M_vertexIter(m);
	//	while ( (node = VIter_next(vit)) ){
	//		cout << "Node " << EN_id(node) << " has classification ";
	//		if ( !node->getClassification() ){
	//			cout << "NULL\n";
	//		}
	//		else{
	//			cout << GEN_tag(node->getClassification()) << endl;
	//		}
	//	}
	//	VIter_delete(vit);
	m->modifyState(2,1);
	m->modifyState(1,2);
}