Ejemplo n.º 1
0
inline std::atomic<Ob> &SymmetricFunction::value(Ob i, Ob j) const {
    sort(i, j);
    POMAGMA_ASSERT5(support().contains(i), "unsupported lhs: " << i);
    POMAGMA_ASSERT5(support().contains(j), "unsupported rhs: " << j);
    std::atomic<Ob> *tile = _tile(i / ITEMS_PER_TILE, j / ITEMS_PER_TILE);
    return _tile2value(tile, i & TILE_POS_MASK, j & TILE_POS_MASK);
}
Ejemplo n.º 2
0
void SymmetricFunction::validate() const {
    POMAGMA_INFO("Validating SymmetricFunction");

    m_lines.validate();

    POMAGMA_DEBUG("validating line-value consistency");
    for (size_t i = 1; i <= item_dim(); ++i)
        for (size_t j = i; j <= item_dim(); ++j) {
            auto val_iter = m_values.find(assert_sorted_pair(i, j));

            if (not(support().contains(i) and support().contains(j))) {
                POMAGMA_ASSERT(val_iter == m_values.end(),
                               "found unsupported lhs, rhs: " << i << ',' << j);
            } else if (val_iter != m_values.end()) {
                POMAGMA_ASSERT(defined(i, j),
                               "found undefined value: " << i << ',' << j);
                Ob val = val_iter->second;
                POMAGMA_ASSERT(val, "found zero value: " << i << ',' << j);
                POMAGMA_ASSERT(support().contains(val),
                               "found unsupported value: " << i << ',' << j);
            } else {
                POMAGMA_ASSERT(not defined(i, j),
                               "found defined null value: " << i << ',' << j);
            }
        }
}
Ejemplo n.º 3
0
bool cloth::NarrowPhaseCheck(Face &body1, Face &body2)
{
	//demoResult.clear();
	//std::vector<Simplex> simplex;

	glm::vec3 direction = body1.particleA->getPos() - body2.particleA->getPos();

	simplex.push_back(support(direction, body1, body2));

	direction = -simplex[0].minkowskiDifference;
	int counter = 100;

	while (counter > 0)
	{
		Simplex tempSimplex;
		tempSimplex = support(direction, body1, body2);

		// Last point added was not past the origin in this direction
		if(glm::dot(tempSimplex.minkowskiDifference, direction) < 0)
		{
			return false;
		}
		simplex.push_back(tempSimplex);

		//check intersect
		if (processSimplex(simplex, direction))
		{
			return true;
		}
		counter--;
	}
}
Ejemplo n.º 4
0
float SteerLib::GJK_EPA::EPA(std::vector<Util::Vector>& simplex, Util::Vector& return_penetration_vector, const std::vector<Util::Vector>& _shapeA, const std::vector<Util::Vector>& _shapeB)
{
	
	float prevDist = FLT_MAX;

	
	const float THRESHOLD = 0.01;
	while (true)
	{
		return_penetration_vector = closestMinkEdge(simplex, prevDist);
		

		Util::Vector supportPoint = support(_shapeA, return_penetration_vector) - support(_shapeB, -return_penetration_vector);

		// find distance from origin to support point
		float dist = dotProduct3d(supportPoint, return_penetration_vector);
		
		// now, we compare the difference between distances by the THRESHOLD
		if (dist - prevDist < THRESHOLD) {
			return dist;
		}
		else {
			prevDist = dist;
			simplex.push_back(supportPoint);
		}
	}
}
Ejemplo n.º 5
0
void NullaryFunction::unsafe_merge (Ob dep)
{
    UniqueLock lock(m_mutex);

    Ob rep = m_carrier.find(dep);
    POMAGMA_ASSERT4(rep < dep, "bad merge: " << dep << "," << rep);
    POMAGMA_ASSERT_RANGE_(4, dep, support().item_dim());
    POMAGMA_ASSERT_RANGE_(4, rep, support().item_dim());

    if (m_value == dep) {
        m_value = rep;
    }
}
Ejemplo n.º 6
0
inline void SymmetricFunction::raw_insert(Ob lhs, Ob rhs, Ob val) {
    POMAGMA_ASSERT5(support().contains(lhs), "unsupported lhs: " << lhs);
    POMAGMA_ASSERT5(support().contains(rhs), "unsupported rhs: " << rhs);
    POMAGMA_ASSERT5(support().contains(val), "unsupported val: " << val);

    value(lhs, rhs).store(val, relaxed);
    m_lines.Lx(lhs, rhs).one(relaxed);
    m_lines.Rx(lhs, rhs).one(relaxed);
    m_Vlr_table.insert(lhs, rhs, val);
    m_Vlr_table.insert(rhs, lhs, val);
    m_VLr_table.insert(lhs, rhs, val);
    m_VLr_table.insert(rhs, lhs, val);
}
Ejemplo n.º 7
0
void BinaryFunction::unsafe_merge(const Ob dep) {
    POMAGMA_ASSERT5(support().contains(dep), "unsupported dep: " << dep);
    Ob rep = carrier().find(dep);
    POMAGMA_ASSERT5(support().contains(rep), "unsupported rep: " << rep);
    POMAGMA_ASSERT4(rep != dep, "self merge: " << dep << "," << rep);

    // Note: in some cases, triples may move multiple times, e.g.
    //   (dep, dep) --> (dep, rep) --> (rep, rep)

    // dep as rhs
    for (auto iter = iter_rhs(dep); iter.ok(); iter.next()) {
        Ob lhs = *iter;
        auto dep_iter = m_values.find(std::make_pair(lhs, dep));
        Ob dep_val = dep_iter->second;
        m_values.erase(dep_iter);
        m_lines.Lx(lhs, dep).zero();
        Ob& rep_val = m_values[std::make_pair(lhs, rep)];
        if (carrier().set_or_merge(rep_val, dep_val)) {
            m_lines.Lx(lhs, rep).one();
        }
    }
    {
        DenseSet dep_set(item_dim(), m_lines.Rx(dep));
        DenseSet rep_set(item_dim(), m_lines.Rx(rep));
        rep_set.merge(dep_set);
    }

    // dep as lhs
    rep = carrier().find(rep);
    for (auto iter = iter_lhs(dep); iter.ok(); iter.next()) {
        Ob rhs = *iter;
        auto dep_iter = m_values.find(std::make_pair(dep, rhs));
        Ob dep_val = dep_iter->second;
        m_values.erase(dep_iter);
        m_lines.Rx(dep, rhs).zero();
        Ob& rep_val = m_values[std::make_pair(rep, rhs)];
        if (carrier().set_or_merge(rep_val, dep_val)) {
            m_lines.Rx(rep, rhs).one();
        }
    }
    {
        DenseSet dep_set(item_dim(), m_lines.Lx(dep));
        DenseSet rep_set(item_dim(), m_lines.Lx(rep));
        rep_set.merge(dep_set);
    }

    // values must be updated in batch by update_values
}
Ejemplo n.º 8
0
ATF_TC_BODY(mkfifo_err, tc)
{
	char buf[PATH_MAX + 1];

	support();

	(void)memset(buf, 'x', sizeof(buf));
	ATF_REQUIRE(mkfifo(path, 0600) == 0);

	errno = 0;
	ATF_REQUIRE_ERRNO(EFAULT, mkfifo((char *)-1, 0600) == -1);

	errno = 0;
	ATF_REQUIRE_ERRNO(EEXIST, mkfifo("/etc/passwd", 0600) == -1);

	errno = 0;
	ATF_REQUIRE_ERRNO(EEXIST, mkfifo(path, 0600) == -1);

	errno = 0;
	ATF_REQUIRE_ERRNO(ENAMETOOLONG, mkfifo(buf, 0600) == -1);

	errno = 0;
	ATF_REQUIRE_ERRNO(ENOENT, mkfifo("/a/b/c/d/e/f/g", 0600) == -1);

	ATF_REQUIRE(unlink(path) == 0);
}
  void intersecting_wavelets(const PeriodicBasis<RBasis>& basis,
                             const typename PeriodicBasis<RBasis>::Index& lambda,
			     const int j, const bool generators, std::list<std::pair<typename PeriodicBasis<RBasis>::Index,
			     typename PeriodicBasis<RBasis>::Support> >& intersecting)
  {
    typedef typename PeriodicBasis<RBasis>::Index Index;
    typedef typename PeriodicBasis<RBasis>::Support Support;

    intersecting.clear();

    // compute support of \psi_\lambda
    const int j_lambda = lambda.j() + lambda.e();
    int k1_lambda, k2_lambda;
    support(basis, lambda, k1_lambda, k2_lambda);
    
    // a brute force solution
    Support supp;
    if (generators) {
      for (Index nu = first_generator(&basis, j);; ++nu) {
	if (intersect_supports(basis, nu, j_lambda, k1_lambda, k2_lambda, supp.j, supp.k1, supp.k2))
	  intersecting.push_back(std::make_pair(nu, supp));
	if (nu == last_generator(&basis, j)) break;
      }
    } else {
      for (Index nu = first_wavelet(&basis, j);; ++nu) {
	if (intersect_supports(basis, nu, j_lambda, k1_lambda, k2_lambda, supp.j, supp.k1, supp.k2))
	  intersecting.push_back(std::make_pair(nu, supp));
	if (nu == last_wavelet(&basis, j)) break;
      }
    }
  }
Ejemplo n.º 10
0
int
ComboPicker(const TCHAR *caption,
            const ComboList &combo_list,
            ListHelpCallback_t help_callback,
            bool enable_item_help)
{
  ComboListPopup = &combo_list;

  const UPixelScalar font_height =
    UIGlobals::GetDialogLook().text_font->GetHeight() + Layout::FastScale(2);
  const UPixelScalar max_height = Layout::GetMaximumControlHeight();
  const UPixelScalar row_height = font_height >= max_height
    ? font_height
    /* this formula is supposed to be a compromise between too small
       and too large: */
    : (font_height + max_height) / 2;

  const UPixelScalar padding = (row_height - font_height) / 2;

  ComboPickerSupport support(combo_list, padding);
  return ListPicker(caption,
                    combo_list.size(),
                    combo_list.ComboPopupItemSavedIndex,
                    row_height,
                    support, false,
                    help_callback,
                    enable_item_help ? OnItemHelp : NULL);
}
Ejemplo n.º 11
0
std::string LLFloaterAbout::get_viewer_region_info(std::string you_are_at)
{
	std::string support("");
	LLViewerRegion* region = gAgent.getRegion();
	if (region)
	{
		const LLVector3d &pos = gAgent.getPositionGlobal();
		LLUIString pos_text = you_are_at;
		pos_text.setArg("[POSITION]",
			llformat("%.1f, %.1f, %.1f ", pos.mdV[VX], pos.mdV[VY], pos.mdV[VZ]));
		support.append(pos_text);

		std::string region_text = llformat("in %s located at ",
			gAgent.getRegion()->getName().c_str());
		support.append(region_text);

		std::string buffer;
		buffer = gAgent.getRegion()->getHost().getHostName();
		support.append(buffer);
		support.append(" (");
		buffer = gAgent.getRegion()->getHost().getString();
		support.append(buffer);
		support.append(")\n");
		support.append(gLastVersionChannel);
		support.append("\n");
	}
	return support;
}
Ejemplo n.º 12
0
		void Circle::appendBoundary(const IModel* p) {
			Circle c2;
			p->im_getBVolume(c2);
			Vec2 toC2 = c2.vCenter - vCenter;
			float lensq = toC2.len_sq();
			if(lensq >= ZEROVEC_LENGTH_SQ) {
				toC2 *= spn::RSqrt(lensq);
				Vec2 tv(support(toC2) - c2.support(-toC2));
				float r_min = std::min(fRadius, c2.fRadius);
				if(tv.dot(toC2) < 0 ||
					tv.len_sq() < spn::Square(r_min*2))
				{
					// 新たな円を算出
					Vec2 tv0(vCenter - toC2*fRadius),
						 tv1(c2.vCenter + toC2*c2.fRadius);
					fRadius = tv0.distance(tv1) * .5f;
					vCenter = (tv0+tv1) * .5f;
				} else {
					// 円が内包されている
					if(fRadius < c2.fRadius) {
						fRadius = c2.fRadius;
						vCenter = c2.vCenter;
					}
				}
			} else {
				// 円の中心が同じ位置にある
				fRadius = std::max(c2.fRadius, fRadius);
			}
		}
Ejemplo n.º 13
0
unsigned int NormalDetector::computeInterestPoints(const LaserReading& reading, const std::vector<double>& signal, std::vector<InterestPoint*>& point, 
						   std::vector< std::vector<unsigned int> >& indexes, std::vector<unsigned int>& maxRangeMapping) const
{
    point.clear();
    point.reserve(reading.getRho().size());
    const std::vector<Point2D>& worldPoints = reading.getWorldCartesian();
    for(unsigned int i = 0; i < indexes.size(); i++){
		for(unsigned int j = 0; j < indexes[i].size(); j++){
			OrientedPoint2D pose;
			unsigned int pointIndex = maxRangeMapping[indexes[i][j]];
		
			// Reomoving the detection in the background and pushing it to the foreground
			double rangeBefore = (pointIndex > 1)? reading.getRho()[pointIndex - 1] : reading.getMaxRange();
			double rangeAfter = (pointIndex < worldPoints.size() - 1)? reading.getRho()[pointIndex + 1] : reading.getMaxRange();
			double rangeCurrent = reading.getRho()[pointIndex];
			if(rangeBefore < rangeAfter){
				if(rangeBefore < rangeCurrent){
					pointIndex = pointIndex - 1;
				}
			} else if(rangeAfter < rangeCurrent){
				pointIndex = pointIndex + 1;
			}
			
			// Removing max range reading
			if(reading.getRho()[pointIndex] >= reading.getMaxRange()){
				continue;
			}

			pose.x =  (reading.getWorldCartesian()[pointIndex]).x;
			pose.y =  (reading.getWorldCartesian()[pointIndex]).y;
			pose.theta = normAngle(signal[indexes[i][j]], -M_PI);
			
			bool exists = false;
			for(unsigned int k = 0; !exists && k < point.size(); k++){
				exists = exists || (fabs(pose.x - point[k]->getPosition().x) <= 0.2 &&  fabs(pose.y - point[k]->getPosition().y) <= 0.2);
			}
			if(exists) continue;

	    unsigned int first = indexes[i][j] - floor((int)m_filterBank[i].size()/2.0);
	    unsigned int last = indexes[i][j] + floor((int)m_filterBank[i].size()/2.0);
	    std::vector<Point2D> support(last - first + 1);
	    for(unsigned int p = 0; p < support.size(); p++) {
		support[p] = Point2D(worldPoints[maxRangeMapping[p + first]]);
	    }
	    
			double maxDistance = -1e20;
			for(unsigned int k = 0; k < support.size(); k++){
				double distance = sqrt((pose.x - support[k].x)*(pose.x - support[k].x) + (pose.y - support[k].y)*(pose.y - support[k].y));
				maxDistance = maxDistance < distance ? distance : maxDistance;
			}
			InterestPoint *interest = new InterestPoint(pose, maxDistance);
	// 	    InterestPoint *interest = new InterestPoint(pose, m_scales[i]);
			interest->setSupport(support);
			interest->setScaleLevel(i);
			point.push_back(interest);
		}
    }
    return point.size();
}
Ejemplo n.º 14
0
	int WebServer::Start()
	{
		cout << "Reading Config" << endl;

		libconfig::Config cfg;
		int result = ReadConfig(cfg, "webserver.cfg");
		if (result != EXIT_SUCCESS)
		{
			return result;
		}

		ChainedSetting config(cfg.getRoot());

		// read config
		int port = config["port"].min(0).max(65535).defaultValue(43113);

		auto wmsConfig = config["wms"];
		if (wmsConfig.exists())
		{
			wms = new WebMapService();
			const auto wmsStartResult = wms->Start(wmsConfig);
			if (wmsStartResult)
			{
				delete wms;
				wms = NULL;
			}
		}

		wmts = new WebMapTileService();
		const auto wmtsStartResult = wmts->Start();
		if (wmtsStartResult)
		{
			delete wmts;
			wmts = NULL;
		}

		cout << "Starting HTTP Server listening to port " << port << endl;

		utility::string_t address = U("http://localhost:");
		address.append(to_wstring(port));

		listener = new http_listener(address);
		if (!listener) 
		{
			cout << "ERROR: unable to create HTTP server" << endl;
			return -1;
		}

		listener->support(methods::GET, std::bind(&WebServer::HandleGetRequest, this, std::placeholders::_1));

		Concurrency::task_status status = listener->open().wait();
		if (status == Concurrency::completed)
		{
			cout << "ready" << endl;
			return 0;
		}

		return -1;
	}
Ejemplo n.º 15
0
inline void SymmetricFunction::insert(Ob lhs, Ob rhs, Ob val) const {
    SharedLock lock(m_mutex);

    POMAGMA_ASSERT5(support().contains(lhs), "unsupported lhs: " << lhs);
    POMAGMA_ASSERT5(support().contains(rhs), "unsupported rhs: " << rhs);
    POMAGMA_ASSERT5(support().contains(val), "unsupported val: " << val);

    if (carrier().set_or_merge(value(lhs, rhs), val)) {
        m_lines.Lx(lhs, rhs).one();
        m_lines.Rx(lhs, rhs).one();
        m_Vlr_table.insert(lhs, rhs, val);
        m_Vlr_table.insert(rhs, lhs, val);
        m_VLr_table.insert(lhs, rhs, val);
        m_VLr_table.insert(rhs, lhs, val);
        m_insert_callback(this, lhs, rhs);
    }
}
Ejemplo n.º 16
0
void TerrainConvex::getFeatures(const MatrixF& mat,const VectorF& n, ConvexFeature* cf)
{
   U32 i;
   cf->material = 0;
   cf->object = mObject;

   // Plane is normal n + support point
   PlaneF plane;
   plane.set(support(n),n);
   S32 vertexCount = cf->mVertexList.size();

   // Emit vertices on the plane
   S32* vertexListPointer;
   if (halfA)
      vertexListPointer = square ? sVertexList[(split45 << 1) | 1]: sVertexList[4];
   else
      vertexListPointer = square ? sVertexList[(split45 << 1)]    : sVertexList[4];

   S32 pm = 0;
   S32 numVerts = *vertexListPointer;
   vertexListPointer += 1;
   for (i = 0; i < numVerts; i++)
   {
      Point3F& cp = point[vertexListPointer[i]];
      cf->mVertexList.increment();
      mat.mulP(cp,&cf->mVertexList.last());
      pm |= 1 << vertexListPointer[i];
   }

   // Emit Edges
   S32* ep = (square && halfA)?
      (split45 ? sEdgeList45A[pm]: sEdgeList135A[pm]):
      (split45 ? sEdgeList45[pm]: sEdgeList135[pm]);

   S32 numEdges = *ep;
   S32 edgeListStart = cf->mEdgeList.size();
   cf->mEdgeList.increment(numEdges);
   ep += 1;
   for (i = 0; i < numEdges; i++)
   {
      cf->mEdgeList[edgeListStart + i].vertex[0] = vertexCount + ep[i * 2 + 0];
      cf->mEdgeList[edgeListStart + i].vertex[1] = vertexCount + ep[i * 2 + 1];
   }

   // Emit faces
   S32* fp = split45 ? sFaceList45[pm]: sFaceList135[pm];
   S32 numFaces = *fp;
   fp += 1;
   S32 faceListStart = cf->mFaceList.size();
   cf->mFaceList.increment(numFaces);
   for (i = 0; i < numFaces; i++)
   {
      cf->mFaceList[faceListStart + i].normal    = normal[fp[i * 4 + 0]];
      cf->mFaceList[faceListStart + i].vertex[0] = vertexCount + fp[i * 4 + 1];
      cf->mFaceList[faceListStart + i].vertex[1] = vertexCount + fp[i * 4 + 2];
      cf->mFaceList[faceListStart + i].vertex[2] = vertexCount + fp[i * 4 + 3];
   }
}
Ejemplo n.º 17
0
void BinaryRelation::validate_disjoint(const BinaryRelation& other) const {
    POMAGMA_INFO("Validating disjoint pair of BinaryRelations");

    // validate supports agree
    POMAGMA_ASSERT_EQ(support().item_dim(), other.support().item_dim());
    POMAGMA_ASSERT_EQ(support().count_items(), other.support().count_items());
    POMAGMA_ASSERT(support() == other.support(),
                   "BinaryRelation supports differ");

    // validate disjointness
    DenseSet this_set(item_dim(), nullptr);
    DenseSet other_set(item_dim(), nullptr);
    for (auto i = support().iter(); i.ok(); i.next()) {
        this_set.init(m_lines.Lx(*i));
        other_set.init(other.m_lines.Lx(*i));
        POMAGMA_ASSERT(this_set.disjoint(other_set),
                       "BinaryRelations intersect at row " << *i);
    }
}
  bool intersect_supports(const PeriodicBasis<RBasis>& basis,
                          const typename PeriodicBasis<RBasis>::Index& lambda,
			  const typename PeriodicBasis<RBasis>::Index& nu,
			  typename PeriodicBasis<RBasis>::Support& supp)
  {
    int k1_nu, k2_nu;
    support(basis, nu, k1_nu, k2_nu);
    return intersect_supports(basis, lambda, nu.j()+nu.e(), k1_nu, k2_nu,
			      supp.j, supp.k1, supp.k2);
  }
Ejemplo n.º 19
0
bool SteerLib::GJK_EPA::GJK(std::vector<Util::Vector>& simplex, const std::vector<Util::Vector>& _shapeA, const std::vector<Util::Vector>& _shapeB)
{
	// choose any initial d vector
	d = Util::Vector(1, 0, 0);

	// get the first Minkowski Difference point
	Util::Vector minkowskiDiffPoint = support(_shapeA, d) - support(_shapeB, -d);

	//std::vector<Util::Vector> simplex;
	// add the point to the simplex
	simplex.push_back(minkowskiDiffPoint);


	// negate d for next point
	d = -d;

	// keep looping, exit conditions are inside loop
	// for convex objects and no rounding errors, this loop should always terminate
	while (true) {

		// add a new point to the simplex because we haven't terminated yet
		minkowskiDiffPoint = support(_shapeA, d) - support(_shapeB, -d);
		simplex.push_back(minkowskiDiffPoint);
		

		// make sure that the last point added is past the origin
		if (dotProduct3d(minkowskiDiffPoint, d) < 0) {
			// if the point added last is not past the origin in the direction of d, then the Minkowski Sum can't contain the origin 
			// since the last point added is on the edge of the Minkowski Difference
			return false; // There is no collision
		}
		else {
			// since the last point is past the origin, check if the origin is in the current simplex
			if (containsOrigin(simplex)) {
				// if it does then there is a collision
				return true;
			}
			// otherwise containsOrigin updates the simplex and d vector
			// the simplex is updated to be the line segment closest to the origin
			// the d vector is set to be the normal of that line segment in the direction of the origin
		}
	}
}
Ejemplo n.º 20
0
//==============================================================================
Bool Gjk::intersect(const ConvexShape& shape0, const ConvexShape& shape1)
{
	// Chose random direction
	m_dir = Vec4(1.0, 0.0, 0.0, 0.0);

	// Do cases 1, 2
	support(shape0, shape1, m_dir, m_simplex[2]);
	if(m_simplex[2].m_v.dot(m_dir) < 0.0)
	{
		return false;
	}

	m_dir = -m_simplex[2].m_v;
	support(shape0, shape1, m_dir, m_simplex[1]);

	if(m_simplex[1].m_v.dot(m_dir) < 0.0)
	{
		return false;
	}

	m_dir = crossAba(m_simplex[2].m_v - m_simplex[1].m_v, -m_simplex[1].m_v);
	m_count = 2;

	U iterations = 20;
	while(iterations--)
	{
		Support a;
		support(shape0, shape1, m_dir, a);

		if(a.m_v.dot(m_dir) < 0.0)
		{
			return false;
		}

		if(update(a))
		{
			return true;
		}
	}

	return true;
}
Ejemplo n.º 21
0
void MainWindow::createConnections()
{
    connect(this, SIGNAL(windowWasShown()), this, SLOT(initUpdates()),
            Qt::ConnectionType(Qt::QueuedConnection | Qt::UniqueConnection));

    connect(ui->tabs, SIGNAL(currentChanged(QWidget *)), this, SLOT(currentWidget(QWidget *)));
    connect(ui->tabs, SIGNAL(currentChanged(QWidget *)), _recorder, SLOT(currentWidget(QWidget *)));
    connect(_playlistTab, SIGNAL(changeTo(QWidget *)), ui->tabs, SLOT(setCurrentWidget(QWidget *)));
    connect(_scheduleTab, SIGNAL(changeTo(QWidget *)), ui->tabs, SLOT(setCurrentWidget(QWidget *)));
    connect(_showInfoTab, SIGNAL(changeTo(QWidget *)), ui->tabs, SLOT(setCurrentWidget(QWidget *)));

    connect(ui->actionSupport, SIGNAL(triggered()), this, SLOT(support()));
    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(aboutTano()));
    connect(ui->actionAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
    connect(ui->actionLogoutExit, SIGNAL(triggered()), this, SLOT(exitLogout()));
    connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(exit()));

    connect(ui->actionTop, SIGNAL(triggered()), this, SLOT(top()));
    connect(ui->actionLite, SIGNAL(triggered()), this, SLOT(lite()));

    connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(openPlaylist()));
    connect(ui->actionOpenFile, SIGNAL(triggered()), _mediaPlayer, SLOT(openFile()));
    connect(ui->actionOpenUrl, SIGNAL(triggered()), _mediaPlayer, SLOT(openUrl()));

    connect(ui->actionSchedule, SIGNAL(triggered()), this, SLOT(showSchedule()));
    connect(ui->actionScheduleCurrent, SIGNAL(triggered()), this, SLOT(showScheduleCurrent()));
    connect(ui->actionSettings, SIGNAL(triggered()), this, SLOT(showSettings()));
    connect(ui->actionSettingsShortcuts, SIGNAL(triggered()), this, SLOT(showSettingsShortcuts()));
    connect(ui->actionEditPlaylist, SIGNAL(triggered()), this, SLOT(showPlaylistEditor()));

    connect(ui->actionPlay, SIGNAL(triggered()), _mediaPlayer, SLOT(togglePause()));
    connect(ui->actionStop, SIGNAL(triggered()), this, SLOT(stop()));
    connect(ui->actionPreview, SIGNAL(triggered(bool)), this, SLOT(preview(bool)));

    connect(_playlistTab->playlist(), SIGNAL(itemSelected(Channel *)), this, SLOT(playChannel(Channel *)));
    connect(_previewTimer, SIGNAL(timeout()), ui->actionNext, SLOT(trigger()));

    if (_trayIcon) {
        connect(_trayIcon, SIGNAL(restoreClick()), this, SLOT(tray()));
        connect(ui->actionTray, SIGNAL(triggered()), this, SLOT(tray()));
    }

    connect(ui->actionFullscreen, SIGNAL(triggered(bool)), this, SLOT(toggleFullscreen(bool)));

    connect(ui->actionMute, SIGNAL(toggled(bool)), _mediaPlayer->osd(), SLOT(mute(bool)));
    connect(ui->actionVolumeDown, SIGNAL(triggered()), _mediaPlayer->osd(), SLOT(volumeDown()));
    connect(ui->actionVolumeUp, SIGNAL(triggered()), _mediaPlayer->osd(), SLOT(volumeUp()));

#if defined(Q_OS_LINUX)
    if (_mediaPlayer->teletextEnabled()) {
        connect(ui->actionTeletext, SIGNAL(triggered(bool)), _mediaPlayer->osd(), SLOT(teletext(bool)));
        connect(ui->actionTeletext, SIGNAL(triggered(bool)), _mediaPlayer, SLOT(teletext(bool)));
        connect(_mediaPlayer->osd(), SIGNAL(teletextClicked()), ui->actionTeletext, SLOT(trigger()));
    }
Ejemplo n.º 22
0
bool shape::intersects(shape const& shape) const {
  vector direction(shape.centroid() - centroid());

  std::vector<vector> simplex;
  simplex.push_back(vertices_[support(direction)] - shape.vertices()[shape.support(-direction)]);
  direction = -direction;

  for(;;) {
    vector const a(vertices_[support(direction)] - shape.vertices()[shape.support(-direction)]);
    if(a.dot(direction) <= 0.0f)
      return false;
    simplex.push_back(a);
    vector const ao(-a);

    if(simplex.size() == 3) {
      vector const b(simplex[1]);
      vector const c(simplex[0]);
      vector const ab(b - a);
      vector const ac(c - a);

      vector const ab_triple(vector::triple_product_left(ac, ab, ab));
      if(ab_triple.dot(ao) >= 0.0f) {
        simplex.erase(simplex.begin());
        direction = ab_triple;
      } else {
        vector const ac_triple(vector::triple_product_left(ab, ac, ac));
        if(ac_triple.dot(ao) >= 0.0f) {
          simplex.erase(simplex.begin() + 1);
          direction = ac_triple;
        } else
          return true;
      }
    } else {
      vector const b(simplex[0]);
      vector const ab(b - a);
      direction = vector::triple_product_left(ab, ao, ab);
      if(!direction)
        direction = ab.left();
    }
  }
}
Ejemplo n.º 23
0
void NullaryFunction::validate () const
{
    SharedLock lock(m_mutex);

    POMAGMA_INFO("Validating NullaryFunction");

    Ob value = m_value;
    if (value) {
        POMAGMA_ASSERT(support().contains(value),
                "unsupported value: " << value);
    }
}
Ejemplo n.º 24
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    setWindowFlags(Qt::FramelessWindowHint);
    setAttribute(Qt::WA_TranslucentBackground);

    ui->horizontalSlider->setRange(0, 0);
    ui->tableWidget->hide();
    ui->tableWidget->hideColumn(2);
    volume=80;

    createContextMenu();
    createSystemTrayIcon();

    playList=new QMediaPlaylist;
    playList->setPlaybackMode(QMediaPlaylist::Loop);
    player=new QMediaPlayer;
    player->setPlaylist(playList);
    player->setVolume(volume);

    connect(ui->horizontalSlider, SIGNAL(sliderMoved(int)), this, SLOT(setPosition(int)));
    connect(ui->tableWidget, SIGNAL(cellClicked(int,int)), this, SLOT(playTo(int, int)));

    connect(player, SIGNAL(positionChanged(qint64)), this, SLOT(positionChanged(qint64)));
    connect(player, SIGNAL(durationChanged(qint64)), this, SLOT(durationChanged(qint64)));
    connect(playList, SIGNAL(currentIndexChanged(int)), this, SLOT(updateSongList(int)));

    connect(ui->action_SongList, SIGNAL(triggered()), this, SLOT(showOrHideSongList()));
    connect(ui->action_Import, SIGNAL(triggered()), this, SLOT(importSongs()));
    connect(ui->action_Last, SIGNAL(triggered()), this, SLOT(playLast()));
    connect(ui->action_Play, SIGNAL(triggered()), this, SLOT(playOrPause()));
    connect(ui->action_Stop, SIGNAL(triggered()), player, SLOT(stop()));
    connect(ui->action_Next, SIGNAL(triggered()), this, SLOT(playNext()));
    connect(ui->action_SoundPlus, SIGNAL(triggered()), this, SLOT(plusSound()));
    connect(ui->action_SoundReduce, SIGNAL(triggered()), this, SLOT(reduceSound()));
    connect(ui->action_Mode1, SIGNAL(triggered()), this, SLOT(setPlaybackMode1()));
    connect(ui->action_Mode2, SIGNAL(triggered()), this, SLOT(setPlaybackMode2()));
    connect(ui->action_Mode3, SIGNAL(triggered()), this, SLOT(setPlaybackMode3()));
    connect(ui->action_Mode4, SIGNAL(triggered()), this, SLOT(setPlaybackMode4()));
    connect(ui->action_Support, SIGNAL(triggered()), this, SLOT(support()));
    connect(ui->action_About, SIGNAL(triggered()), this, SLOT(aboutUs()));
    connect(ui->action_Quit, SIGNAL(triggered()), this, SLOT(close()));

    connect(ui->toolButton_Last, SIGNAL(clicked()), this, SLOT(playLast()));
    connect(ui->toolButton_Play, SIGNAL(clicked()), this, SLOT(playOrPause()));
    connect(ui->toolButton_Stop, SIGNAL(clicked()), player, SLOT(stop()));
    connect(ui->toolButton_Next, SIGNAL(clicked()), this, SLOT(playNext()));
}
Ejemplo n.º 25
0
 forceinline void
 Incremental<View>::find_support(Space& home, Domain dom, int i, int n) {
   if (support(i,n) == NULL) {
     // Find support for value vv.val() in view i
     Tuple l = Base<View,false>::find_support(dom,i,n - ts()->min);
     if (l == NULL) {
       // No possible supports left
       w_remove.push(home,i,n);
     } else {
       // Mark values in support as supported
       add_support(home,l);
     }
   }
 }
Ejemplo n.º 26
0
void SymmetricFunction::unsafe_merge(const Ob dep) {
    POMAGMA_ASSERT5(support().contains(dep), "unsupported dep: " << dep);
    Ob rep = carrier().find(dep);
    POMAGMA_ASSERT5(support().contains(rep), "unsupported rep: " << rep);
    POMAGMA_ASSERT4(rep != dep, "self merge: " << dep << "," << rep);

    // (dep, dep) -> (rep, rep)
    if (defined(dep, dep)) {
        auto dep_iter = m_values.find(std::make_pair(dep, dep));
        Ob dep_val = dep_iter->second;
        m_values.erase(dep_iter);
        m_lines.Lx(dep, dep).zero();
        Ob& rep_val = m_values[std::make_pair(rep, rep)];
        if (carrier().set_or_merge(rep_val, dep_val)) {
            m_lines.Lx(rep, rep).one();
        }
    }

    // (dep, rhs) --> (rep, rhs) for rhs != dep
    rep = carrier().find(rep);
    for (auto iter = iter_lhs(dep); iter.ok(); iter.next()) {
        Ob rhs = *iter;
        auto dep_iter = m_values.find(make_sorted_pair(dep, rhs));
        Ob dep_val = dep_iter->second;
        m_values.erase(dep_iter);
        m_lines.Rx(dep, rhs).zero();
        Ob& rep_val = m_values[make_sorted_pair(rep, rhs)];
        if (carrier().set_or_merge(rep_val, dep_val)) {
            m_lines.Rx(rep, rhs).one();
        }
    }
    DenseSet dep_set(item_dim(), m_lines.Lx(dep));
    DenseSet rep_set(item_dim(), m_lines.Lx(rep));
    rep_set.merge(dep_set);

    // values must be updated in batch by update_values
}
Ejemplo n.º 27
0
  ExecStatus
  Incremental<View>::advise(Space& home, Advisor& _a, const Delta& d) {
    SupportAdvisor& a = static_cast<SupportAdvisor&>(_a);
    ModEvent me = View::modevent(d);
    bool scheduled = !w_support.empty() || !w_remove.empty();

    if (x[a.i].any(d)) {
      ViewValues<View> vv(x[a.i]);
      for (int n = ts()->min; n <= ts()->max; n++) {
        if (vv() && (n == vv.val())) {
          ++vv;
          continue;
        }
        while (SupportEntry* s = support(a.i,n))
          remove_support(home, s->t, a.i, n);
      }
    } else {
      for (int n = x[a.i].min(d); n <= x[a.i].max(d); n++)
        while (SupportEntry* s = support(a.i,n))
          remove_support(home, s->t, a.i, n);
    }

    if (me == ME_INT_VAL) {
      --unassigned;
      // nothing to do or already scheduled
      // propagator is not subsumed since unassigned!=0
      if (((w_support.empty() && w_remove.empty()) || scheduled) &&
          (unassigned != 0))
        return home.ES_FIX_DISPOSE(ac,a);
      else
        return home.ES_NOFIX_DISPOSE(ac,a);
    } else if ((w_support.empty() && w_remove.empty()) || scheduled) {
      // nothing to do or already scheduled
      return ES_FIX;
    }
    return ES_NOFIX;
  }
Ejemplo n.º 28
0
void HistogramOnGrid::setBounds( const std::vector<std::string>& smin, const std::vector<std::string>& smax,
                                 const std::vector<unsigned>& nbins, const std::vector<double>& spacing ) {
    GridVessel::setBounds( smin, smax, nbins, spacing );
    if( !discrete ) {
        std::vector<double> point(dimension,0);
        KernelFunctions kernel( point, bandwidths, kerneltype, false, 1.0, true );
        neigh_tot=1;
        nneigh=kernel.getSupport( dx );
        std::vector<double> support( kernel.getContinuousSupport() );
        for(unsigned i=0; i<dimension; ++i) {
            if( pbc[i] && 2*support[i]>getGridExtent(i) ) error("bandwidth is too large for periodic grid");
            neigh_tot *= (2*nneigh[i]+1);
        }
    }
}
Ejemplo n.º 29
0
ATF_TC_BODY(mkfifo_stat, tc)
{
	struct stat st;

	support();

	(void)memset(&st, 0, sizeof(struct stat));

	ATF_REQUIRE(mkfifo(path, 0600) == 0);
	ATF_REQUIRE(stat(path, &st) == 0);

	if (S_ISFIFO(st.st_mode) == 0)
		atf_tc_fail("invalid mode from mkfifo(2)");

	ATF_REQUIRE(unlink(path) == 0);
}
Ejemplo n.º 30
0
void CalculateAABB (const NewtonCollision* const collision, const dMatrix& matrix, dVector& minP, dVector& maxP)
{
	for (int i = 0; i < 3; i ++) {
		dVector support(0.0f);
		dVector dir (0.0f);
		dir[i] = 1.0f;

		dVector localDir (matrix.UnrotateVector (dir));
		NewtonCollisionSupportVertex (collision, &localDir[0], &support[0]);
		support = matrix.TransformVector (support);
		maxP[i] = support[i];  

		localDir = localDir.Scale (-1.0f);
		NewtonCollisionSupportVertex (collision, &localDir[0], &support[0]);
		support = matrix.TransformVector (support);
		minP[i] = support[i];  
	}
}