コード例 #1
0
ファイル: VEditMltRun.cpp プロジェクト: amongll/AVFX
void MltRuntime::replace_runtime_entry(const string& src_uuid,
	json_t* script_serialed, int give) throw(Exception)
{
	PathIter it = uuid_pathmap.find(src_uuid);
	if ( it == uuid_pathmap.end()) {
		throw_error_v(ErrorRuntimeJsonUUIDNotFound,"%s", src_uuid.c_str());
	}
	JsonPath pcp(it->second);
	erase_runtime_entry(src_uuid);
	add_runtime_entry(pcp, script_serialed, give);
}
コード例 #2
0
ファイル: simon.c プロジェクト: DanIverson/OpenVnmrJ
static void ficlPcp(ficlVm *vm)
{
  char srcfile[FICL_COUNTED_STRING_MAX];
  ficlCountedString *srccounted = (ficlCountedString *)srcfile;
  char dstfile[FICL_COUNTED_STRING_MAX];
  ficlCountedString *dstcounted = (ficlCountedString *)dstfile;

  ficlVmGetString(vm, srccounted, ' ');
  ficlVmGetString(vm, dstcounted, '\n');

  pcp(FICL_COUNTED_STRING_GET_POINTER(*srccounted),FICL_COUNTED_STRING_GET_POINTER(*dstcounted));
}
コード例 #3
0
ファイル: prune.cpp プロジェクト: lgarron/acube
// =========================================================================
   Pruning_table_mp_cp::
   Pruning_table_mp_cp(Transform_table *tr, Turn_table *tn, int e1, int c1):
   e1(e1), c1(c1)
// -------------------------------------------------------------------------
{
  int n, d, mx = 0;
  int mp, cp, t;
  unsigned int sm = 0;
  Pack_mp pmp(e1);
  int Nmp = pmp.len();
  int Smp = pmp.startlen();
  Pack_cp pcp(c1);
  int Ncp = pcp.len();
  int Scp = pcp.startlen();

  for (mp = 0; mp < Nmp; mp++)
    for (cp = 0; cp < Ncp; cp++)
      a[mp][cp] = BIG;

  for (t = 0; t < B_N_TW; t++)
    if (mx < tn->b_len(t))
      mx = tn->b_len(t);

  fprintf(stderr, "\n - middle edge permutations - corner permutations (phase 2, %i x %i goal/s):\n", Smp, Scp);

  for (mp = 0; mp < Smp; mp++)
    for (cp = 0; cp < Scp; cp++)
      a[pmp.start(mp)][pcp.start(cp)] = 0;
  d = 0;
  n = Smp * Scp;
  while (n) {
    fprintf(stderr,"   %2i %8i %10u\n", d, n, sm += n);
    n = 0;
    d++;
    for (mp = 0; mp < Nmp; mp++) {
      for (cp = 0; cp < Ncp; cp++) {
        if (d <= a[mp][cp] || d > a[mp][cp] + mx)
          continue;
        for (t = 0; t < B_N_TW; t++) {
          if (d == a[mp][cp] + tn->b_len(t)) {
            int nmp = tr->mp->b_do_tw(t, mp);
            int ncp = tr->cp->b_do_tw(t, cp);
            if (a[nmp][ncp] > d) {
              a[nmp][ncp] = d;
              n++;
            }
          }
        }
      }
    }
  }
}
コード例 #4
0
ファイル: prune.cpp プロジェクト: lgarron/acube
// =========================================================================
   Pruning_table_cp_xx::
   Pruning_table_cp_xx(Transform_table *tr, Turn_table *tn, int c1):
   c1(c1)
// -------------------------------------------------------------------------
{
  int n, d, mx = 0;
  int cp, t;
  unsigned int sm = 0;
  Pack_cp pcp(c1);
  int Ncp = pcp.len();
  int Scp = pcp.startlen();

  for (cp = 0; cp < Ncp; cp++)
    a[cp] = BIG;

  for (t = 0; t < A_N_TW; t++)
    if (mx < tn->a_len(t))
      mx = tn->a_len(t);

  fprintf(stderr, "\n - corner permutations (phase 1, %i goal/s):\n", Scp);

  for (cp = 0; cp < Scp; cp++)
    a[pcp.start(cp)] = 0;
  d = 0;
  n = Scp;
  while (n) {
    fprintf(stderr,"   %2i %8i %10u\n", d, n, sm += n);
    n = 0;
    d++;
    for (cp = 0; cp < Ncp; cp++) {
      if (d <= a[cp] || d > a[cp] + mx)
        continue;
      for (t = 0; t < A_N_TW; t++) {
        if (d == a[cp] + tn->a_len(t)) {
          int ncp = tr->cp->a_do_tw(t, cp);
          if (a[ncp] > d) {
            a[ncp] = d;
            n++;
          }
        }
      }
    }
  }
}
コード例 #5
0
	vector<PCPolygonPtr> PCPolyhedron::detectPolygons(const PCPtr& cloud, float planeTolerance, float pointsTolerance, bool limitFaces)
	{
		float DOT_EPSILON = 0.15;
		saveCloud("1_toDetect.pcd", *cloud);

		PCPtr cloudTemp(cloud);
		
		float maxFaces = limitFaces ? MAX_FACES : 100;
		sensor_msgs::PointCloud2::Ptr cloud_blob (new sensor_msgs::PointCloud2());
		sensor_msgs::PointCloud2::Ptr cloud_filtered_blob (new sensor_msgs::PointCloud2);
		pcl::StatisticalOutlierRemoval<pcl::PointXYZ> sor;
		
		vector<PCPolygonPtr> nuevos;
		
		PCPtr cloudP (new PC());
		pcl::PointIndices::Ptr inliers (new pcl::PointIndices ());
		pcl::SACSegmentation<pcl::PointXYZ> seg;
		pcl::ExtractIndices<pcl::PointXYZ> extract;
		std::vector<ofVec3f> vCloudHull;

		// Optional
		seg.setOptimizeCoefficients (true);
		// Mandatory
		seg.setModelType (pcl::SACMODEL_PLANE);
		seg.setMethodType (pcl::SAC_RANSAC);
		seg.setMaxIterations (50);
		seg.setDistanceThreshold (planeTolerance); //original: 0.01
		// Create the filtering object
		int i = 0, nrPoints = cloudTemp->points.size ();
		// mientras 7% de la nube no se haya procesad+o

		int numFaces = 0;
		
		while (cloudTemp->points.size () > 0.07 * nrPoints && numFaces < maxFaces)
		{
			pcl::ModelCoefficients::Ptr coefficients (new pcl::ModelCoefficients ());
			// Segment the largest planar component from the remaining cloud
			seg.setInputCloud (cloudTemp);
			seg.segment (*inliers, *coefficients);
			if (inliers->indices.size () == 0) {
				std::cerr << "Could not estimate a planar model for the given dataset." << std::endl;
				break;
			}

			//FIX
			PCPtr cloudFilteredTempInliers (new PC());
			PCPtr cloudFilteredTempOutliers (new PC());
			if(inliers->indices.size() != cloudTemp->size())
			{
				// Extract the inliers
				extract.setInputCloud (cloudTemp);
				extract.setIndices (inliers);
				extract.setNegative (false);
				extract.filter (*cloudFilteredTempInliers);
				cloudP = cloudFilteredTempInliers;
			}
			else
				cloudP = cloudTemp;
		
			// Create the filtering object
			extract.setInputCloud (cloudTemp);
			extract.setIndices (inliers);
			extract.setNegative (true);

		
			if(cloudP->size() != cloudTemp->size())
				extract.filter (*cloudFilteredTempOutliers);

			cloudTemp = cloudFilteredTempOutliers;

			saveCloud("2_DetectedPol" + ofToString(i) + ".pcd", *cloudP);
			
			//Remove outliers by clustering	
			vector<pcl::PointIndices> clusterIndices(findClusters(cloudP, pointsTolerance, 10, 10000));
			int debuccount = 0;

			PCPtr cloudPFiltered (new PC());
			if(clusterIndices.size() > 0)
			{
				cloudPFiltered = getCloudFromIndices(cloudP, clusterIndices.at(0));
			}

			saveCloud("3_Postfilter_pol" + ofToString(i) + ".pcd",*cloudPFiltered);
			if (cloudPFiltered->size() < 4)
				break;

			//Controlo que las normales sean perpendiculares
			ofVec3f norm (coefficients->values[0],coefficients->values[1],coefficients->values[2]);
			norm.normalize();
			bool normalCheck = true;
			for(int i = 0; i < nuevos.size() && normalCheck; i++)
			{
				float dot = abs(nuevos[i]->getNormal().dot(norm));
				if( dot > DOT_EPSILON)
				{
					normalCheck = false;
				}
			}

			if(normalCheck)
			{
				//proyecto los puntos sobre el plano
				pcl::ProjectInliers<pcl::PointXYZ> proj; 
				proj.setModelType(pcl::SACMODEL_PLANE); 
				PCPtr projectedCloud (new PC()); 
				proj.setInputCloud(cloudPFiltered); 
				proj.setModelCoefficients(coefficients); 
				proj.filter(*projectedCloud);

				saveCloud("4_Proy_Pol" + ofToString(i) + ".pcd",*projectedCloud);

				PCPolygonPtr pcp(new PCQuadrilateral(*coefficients, projectedCloud));
				pcp->detectPolygon();
			
				nuevos.push_back(pcp);
				numFaces++;
			}
			i++;
		}

		return nuevos;
	}