예제 #1
0
void Voronoi::ParabolaNode::_createChildren(const Point & leftSite, const Point & rightSite)
{
	_leftChild = make_unique<ParabolaNode>(leftSite);
	_leftChild->_parent = this;
	_rightChild = make_unique<ParabolaNode>(rightSite);
	_rightChild->_parent = this;
	_cross(_leftSibling, leftChild());
	_cross(leftChild(), rightChild());
	_cross(rightChild(), _rightSibling);
}
예제 #2
0
QJSValue THREEVector3::cross(QJSValue threeVector3) {
    THREEVector3 *vec = getAsTHREEVector3(threeVector3);
    if (!vec) {
        qDebug() << "THREEVector3::" << __FUNCTION__ << " parameter was not THREEVector3 was " << threeVector3.toQObject();
        return m_engine->newQObject(this);
    }

    return m_engine->newQObject(_cross(vec));
}
예제 #3
0
static struct ia_circles *_cross_helper(struct ia_circles *c1,
    struct ia_circles *c2, int *indices, int indices_num)
{
	int idx;
	struct ia_circles *c1c = clone_circles(c1);
	struct ia_circles *c2c = clone_circles(c2);
	struct ia_circles *ret = NULL;
	// cross the ones that haven't been crossed in a while
	for(idx = 0; idx < c1c->num_circles; idx++) {
		if(c1c->circles[idx].crossed_rounds_ago > 10) {
			_cross(&c1c->circles[idx],
			    &c2c->circles[idx]);
		} else if(c2c->circles[idx].crossed_rounds_ago > 10) {
			_cross(&c1c->circles[idx],
			    &c2c->circles[idx]);
		}
	}

	for(idx = 0; idx < indices_num; idx++) {
		_cross(&c1c->circles[indices[idx]],
		    &c2c->circles[indices[idx]]);
	}
	refresh_circles(c1c);
	refresh_circles(c2c);
	// pick the best one, free the other
	if(c1c->img->score < c2c->img->score) {
		ret = c1c;
		free_circles(c2c);
		free(c2c);
	} else {
		ret = c2c;
		free_circles(c1c);
		free(c1c);
	}
	
	return ret;
}
예제 #4
0
        std::pair<SEGMENT,SEGMENT> operator()(const BOUNDS& _bounds, ANGLE _angle)
        {
          scalar_type _radius = _bounds.radius();
          scalar_type _cos = _radius * cos(_angle*M_PI/180),
                      _sin = _radius * sin(_angle*M_PI/180);
          vec_type _cross(-_sin,_cos);
          vec_type _dir(_cos,_sin);
          point_type _center = _bounds.center();

          std::pair<SEGMENT,SEGMENT> _result;
          _result.first[0] = _center - _cross - _dir;
          _result.first[1] = _result.first[0] + 2.0*_dir;
          _result.second[0] = _center + _cross - _dir;
          _result.second[1] = _result.second[0] + 2.0*_dir;
          return _result;
        }